From: Fabian Groffen Date: Thu, 12 Mar 2009 19:21:56 +0000 (-0000) Subject: Merged from trunk -r12824:13062 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=2575ca89ec0500efff48d08bf83e225904d0bb0c;p=portage.git Merged from trunk -r12824:13062 | 13056 | Add new xpak.5 man page by Lars Hartmann chaotikaorg>. | | zmedico | | | 13059 | Bug #262012 - Only trigger the slot conflict message about | | zmedico | --newuse when the installed version is the same as the new | | | one. If they are different versions then there's some other | | | problem. | | 13060 | Bug #262211 - Make vardbapi.aux_get() translate empty SLOT | | zmedico | to 0 since other code expects non-empty SLOT (for generation | | | package slot atoms). | | 13061 | Bug #262211 - Avoid triggering an InvalidAtom exception | | zmedico | inside the Package constructor when SLOT is empty. | | 13062 | Use absolute imports instead of relative. | | zmedico | | svn path=/main/branches/prefix/; revision=13094 --- diff --git a/man/xpak.5 b/man/xpak.5 new file mode 100644 index 000000000..22667dc67 --- /dev/null +++ b/man/xpak.5 @@ -0,0 +1,190 @@ +.TH XPAK 5 "March 2009" "Portage 2.2" "Portage" +.SH NAME +xpak \- The XPAK Data Format +.SH NOTES +.SS Data Types +.IP Integer +every offset or length(len) value in this documentation will be an unsigned +32bit integer in big endian byte order(32bit unsigned big int or uint32(big) +). +.IP String +All strings, mentioned in this documentation are ASCII encoded, and not +nullterminated +.IP Values +The actual values of the individual xpak entries are stored as Strings. +.P +.SS Vertical Bars +The vertical bars '|' are not part of the file format, they are merely used to +illustrate how the offset values apply to the data. + +.SH SYNOPSIS + +.IP tarball + |<-xpak_offset->| +.br +|< xpak >|"STOP" + +.IP xpak +"XPAKPACK""XPAKSTOP" + +.IP index +|<-------------index_len------------->| +.br +|<...>| + +.IP indexN + |<-name_len->| +.br +|< name >| + +.IP data +|<--------------data_len------------->| +.br +|<-dataN_offset->|<-dataN_len->| +.br +|< data >|< data_N >|| + +.SH DETAILED +Every gentoo binary package has a xpak attached to it which contains build +time information like the use flags it was built with, the ebuild it was +built from, the environmental variables, CFLAGs, CXXFLAGs, .... + +.SS xpak + +If you look at a gentoo binary package (binpkg) with a hex-editor you'll +notice the behinf the data, which belongs to the tarball you find a binary +blob - the +.I xpak +, an offset which holds the bytes from the start of the +.I xpak +to the end of the file - +.I xpak_offset +and finally the String +.I "STOP". + + || + |<---xpak---->|"STOP"| + +Here you see the +.I tbz2 +archive, and the attached +.I xpak +blob, the +.I xpak-offset +and +the string +.I "STOP" +at the end. + +If we read the offset value and count +.I offset +bytes backwards from the start of +.I xpak_offset +, we have found the start of the +.I xpak +Block which starts with the String +.I "XPAKPACK". +This xpak block consists of the string +.I "XPAKPACK" +, the length of the +.I index +block - +.I index-len +, the length of the data block - +.I data-len +, an +.I index-len +bytes long binary blob with the +.I index +, a +.I data-len +bytes long binary blob with the +.I data +and the string +.I "XPAKSTOP" +at the end: + + ||| + "XPAKPACK"|<--index-->|<--data-->|"XPAKSTOP" + +To actually get the +.I index +and the +.I data +, we cut out +.I index_len +bytes after the end of +.I data_len + for the index block and then cut out the next +.I data_len +bytes for the data block. If we have done everything right up to this point, +the following bytes would be the ASCII formatted string +.I "XPAKSTOP" +. + +The actual data is truncated into one big block - so if we want to read it we +need the actual positions of each information in this big data block, this +information can be obtained using the indices which are stored in the +.I index +block. + +.SS Index block +The index block consists of several truncated index blocks: + + |<-----------------------index_len---------------------->| + || + +The +.I index +block holds all information we need to find the data we want in the +.I data +block. It consists of truncated index elements with a length +.I index_len. +Each of those index elements stands for one information in the data block and +consists of the length of its name ( +.I name_len> +), a +.I name_len + bytes long string (the Name of the data block), this index belongs to, the +offset of the +.I data +block ( +.I data_offset +) and the length of that data block ( +.I data_len +): + + || + |<--name-->| + +.SS Data block +the data block contains truncated data blocks with a total length of +.I data_len +: + + |<------------------------data_len------------------------>| + || + +This binary block is +.I data_len +bytes long and consists of truncated data. + +To select one data element, we need the +.I data_offset +and the +.I data_len +from +the +.I index +, if we have those we can count +.I data_offset +bytes from the start of the +.I data +block, and then cut out the next +.I data_len +bytes. there we got our data block: + + |<-----dataN_offset----->|<--dataN_len->| + ||| +.SH AUTHORS +Lars Hartmann chaotikaorg> diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index 93cee1ba8..eda2ca394 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -1595,7 +1595,12 @@ class Package(Task): self.root = self.root_config.root self.metadata = _PackageMetadataWrapper(self, self.metadata) self.cp = portage.cpv_getkey(self.cpv) - self.slot_atom = portage.dep.Atom("%s:%s" % (self.cp, self.slot)) + slot = self.slot + if not slot: + # Avoid an InvalidAtom exception when creating slot_atom. + # This package instance will be masked due to empty SLOT. + slot = '0' + self.slot_atom = portage.dep.Atom("%s:%s" % (self.cp, slot)) self.category, self.pf = portage.catsplit(self.cpv) self.cpv_split = portage.catpkgsplit(self.cpv) self.pv_split = self.cpv_split[1:] @@ -4892,7 +4897,11 @@ class depgraph(object): # This shouldn't happen. return None - if unmatched_node.installed and not matched_node.installed: + if unmatched_node.installed and not matched_node.installed and \ + unmatched_node.cpv == matched_node.cpv: + # If the conflicting packages are the same version then + # --newuse should be all that's needed. If they are different + # versions then there's some other problem. return "New USE are correctly set, but --newuse wasn't" + \ " requested, so an installed package with incorrect USE " + \ "happened to get pulled into the dependency graph. " + \ diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index 256d15646..1cbdea35e 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -1705,6 +1705,10 @@ class vardbapi(dbapi): cache_data[aux_key] = mydata[aux_key] self._aux_cache["packages"][mycpv] = (mydir_mtime, cache_data) self._aux_cache["modified"].add(mycpv) + if not mydata['SLOT']: + # Empty slot triggers InvalidAtom exceptions when generating slot + # atoms for packages, so translate it to '0' here. + mydata['SLOT'] = '0' return [mydata[x] for x in wants] def _aux_get(self, mycpv, wants, st=None): diff --git a/pym/portage/tests/bin/test_dobin.py b/pym/portage/tests/bin/test_dobin.py index 70a97cb0a..40854d046 100644 --- a/pym/portage/tests/bin/test_dobin.py +++ b/pym/portage/tests/bin/test_dobin.py @@ -3,7 +3,7 @@ # Distributed under the terms of the GNU General Public License v2 # $Id$ -from setup_env import * +from portage.tests.bin.setup_env import * class DoBin(BinTestCase): def testDoBin(self): diff --git a/pym/portage/tests/bin/test_dodir.py b/pym/portage/tests/bin/test_dodir.py index 1035152ce..eab681028 100644 --- a/pym/portage/tests/bin/test_dodir.py +++ b/pym/portage/tests/bin/test_dodir.py @@ -3,7 +3,7 @@ # Distributed under the terms of the GNU General Public License v2 # $Id$ -from setup_env import * +from portage.tests.bin.setup_env import * class DoDir(BinTestCase): def testDoDir(self):