Merged from trunk -r14388:14396
authorFabian Groffen <grobian@gentoo.org>
Thu, 24 Sep 2009 17:26:52 +0000 (17:26 -0000)
committerFabian Groffen <grobian@gentoo.org>
Thu, 24 Sep 2009 17:26:52 +0000 (17:26 -0000)
   | 14389    | Fix stack_dicts() to always return a dict.                  |
   | zmedico  |                                                             |

   | 14390    | Make SlotDict use call self.iteritems() where appropriate   |
   | zmedico  | since it implements that method even when running in python |
   |          | 3.x.                                                        |

   | 14391    | Optimize SlotDict.iteritems() a little.                     |
   | zmedico  |                                                             |

   | 14392    | Optimize vardbapi.getpath(). Thanks to Marat Radchenko      |
   | zmedico  | <marat@slonopotamus.org> for this patch.                    |

   | 14393    | Bug #285979 - Replace references to CDEPEND with UNUSED_00, |
   | zmedico  | to make it clear that this key really is unused.            |

   | 14394    | Fix formatting of size of downloads with Python 3.          |
   | arfrever |                                                             |

   | 14395    | Fix "TypeError: object of type 'filter' has no len()".      |
   | arfrever |                                                             |

   | 14396    | Bug #286118 - Fix dbapi.move_ent() methods so they don't    |
   | zmedico  | assume Atom instances can be concatenated with strings      |
   |          | (even though they can now, it's not really a good           |
   |          | assumption).                                                |

svn path=/main/branches/prefix/; revision=14406

bin/ebuild.sh
bin/repoman
pym/_emerge/Package.py
pym/_emerge/format_size.py
pym/portage/__init__.py
pym/portage/cache/flat_list.py
pym/portage/cache/mappings.py
pym/portage/cache/metadata.py
pym/portage/dbapi/bintree.py
pym/portage/dbapi/vartree.py
pym/portage/util.py

index aea4d797bcc68ac1d08862b9bb735f0896143435..18c60b27e12265c1301159b6b3f45c84081c7ef0 100755 (executable)
@@ -2074,12 +2074,11 @@ ebuild_main() {
                fi
 
                auxdbkeys="DEPEND RDEPEND SLOT SRC_URI RESTRICT HOMEPAGE LICENSE
-                       DESCRIPTION KEYWORDS INHERITED IUSE CDEPEND PDEPEND PROVIDE EAPI
+                       DESCRIPTION KEYWORDS INHERITED IUSE UNUSED_00 PDEPEND PROVIDE EAPI
                        PROPERTIES DEFINED_PHASES UNUSED_05 UNUSED_04
                        UNUSED_03 UNUSED_02 UNUSED_01"
 
                #the extra $(echo) commands remove newlines
-               unset CDEPEND
                [ -n "${EAPI}" ] || EAPI=0
                local eapi=$EAPI
 
index de78f903b9863a9b4173e9b1fd3478b6af00346b..1ce1556d5733756aca7e8c6b4de2a28be404aebb 100755 (executable)
@@ -375,7 +375,6 @@ non_ascii_re = re.compile(r'[^\x00-\x7f]')
 
 missingvars=["KEYWORDS","LICENSE","DESCRIPTION","HOMEPAGE","SLOT"]
 allvars = set(x for x in portage.auxdbkeys if not x.startswith("UNUSED_"))
-allvars.discard("CDEPEND")
 allvars.update(Package.metadata_keys)
 allvars = sorted(allvars)
 commitmessage=None
@@ -1498,8 +1497,8 @@ for x in scanlist:
                        stats[m+".syntax"] += 1
                        fails[m+".syntax"].append(catpkg+".ebuild "+m+": "+b)
 
-               badlicsyntax = len(filter(lambda x:x=="LICENSE", type_list))
-               badprovsyntax = len(filter(lambda x:x=="PROVIDE", type_list))
+               badlicsyntax = len([x for x in type_list if x == "LICENSE"])
+               badprovsyntax = len([x for x in type_list if x == "PROVIDE"])
                baddepsyntax = len(type_list) != badlicsyntax + badprovsyntax 
                badlicsyntax = badlicsyntax > 0
                badprovsyntax = badprovsyntax > 0
index e37600cf2d9597292ffc86fb4832b7a3718d5c87..a7a8bfba8a2b4f21b232e1935ab525a18c50c08c 100644 (file)
@@ -154,7 +154,6 @@ class Package(Task):
 
 _all_metadata_keys = set(x for x in portage.auxdbkeys \
        if not x.startswith("UNUSED_"))
-_all_metadata_keys.discard("CDEPEND")
 _all_metadata_keys.update(Package.metadata_keys)
 _all_metadata_keys = frozenset(_all_metadata_keys)
 
index ff1aeb23f889ec348faea099bb800cd8b19c7384..b0d39db3347760bf541334c7029d0bccde270c4d 100644 (file)
@@ -15,7 +15,7 @@ def format_size(mysize):
                # Always round up to the next kB so that it doesn't show 0 kB when
                # some small file still needs to be fetched.
                mysize += 1024 - mysize % 1024
-       mystr=str(mysize/1024)
+       mystr=str(mysize//1024)
        mycount=len(mystr)
        while (mycount > 3):
                mycount-=3
index fe1acf30de1151f0949131abfeef51732652b2b5..4578c42c0b32d907568d0bcaef6d12adeca568b9 100644 (file)
@@ -8428,7 +8428,7 @@ def getmaskingstatus(mycpv, settings=None, portdb=None):
 auxdbkeys=[
   'DEPEND',    'RDEPEND',   'SLOT',      'SRC_URI',
        'RESTRICT',  'HOMEPAGE',  'LICENSE',   'DESCRIPTION',
-       'KEYWORDS',  'INHERITED', 'IUSE',      'CDEPEND',
+       'KEYWORDS',  'INHERITED', 'IUSE', 'UNUSED_00',
        'PDEPEND',   'PROVIDE', 'EAPI',
        'PROPERTIES', 'DEFINED_PHASES', 'UNUSED_05', 'UNUSED_04',
        'UNUSED_03', 'UNUSED_02', 'UNUSED_01',
index c7d618c26b8e7411eff0344f6f1cf5dbca17cc2c..bf465efdb21e929b1636f54636e49c7f5a36e7c4 100644 (file)
@@ -19,7 +19,7 @@ class database(fs_template.FsBased):
        # do not screw with this ordering. _eclasses_ needs to be last
        auxdbkey_order=('DEPEND', 'RDEPEND', 'SLOT', 'SRC_URI',
                'RESTRICT',  'HOMEPAGE',  'LICENSE', 'DESCRIPTION',
-               'KEYWORDS',  'IUSE', 'CDEPEND',
+               'KEYWORDS',  'IUSE', 'UNUSED_00',
                'PDEPEND',   'PROVIDE', 'EAPI', 'PROPERTIES', 'DEFINED_PHASES')
 
        def __init__(self, label, auxdbkeys, **config):
index a6c111897261d3b826bbf6a5173843c1c4085bbc..bd9f082b9ab43878f41cadd41a69c64080c898d5 100644 (file)
@@ -333,12 +333,12 @@ def slot_dict_class(keys, prefix="_val_"):
                                        self.update(kwargs)
 
                        def __iter__(self):
-                               for k, v in self.items():
+                               for k, v in self.iteritems():
                                        yield k
 
                        def __len__(self):
                                l = 0
-                               for i in self.items():
+                               for i in self.iteritems():
                                        l += 1
                                return l
 
@@ -346,9 +346,10 @@ def slot_dict_class(keys, prefix="_val_"):
                                return list(self)
 
                        def iteritems(self):
+                               prefix = self._prefix
                                for k in self.allowed_keys:
                                        try:
-                                               yield (k, getattr(self, self._prefix + k))
+                                               yield (k, getattr(self, prefix + k))
                                        except AttributeError:
                                                pass
 
@@ -356,7 +357,7 @@ def slot_dict_class(keys, prefix="_val_"):
                                return list(self.iteritems())
 
                        def itervalues(self):
-                               for k, v in self.items():
+                               for k, v in self.iteritems():
                                        yield v
 
                        def values(self):
@@ -442,7 +443,7 @@ def slot_dict_class(keys, prefix="_val_"):
 
                        def popitem(self):
                                try:
-                                       k, v = next(iter(self.items()))
+                                       k, v = self.iteritems().next()
                                except StopIteration:
                                        raise KeyError('container is empty')
                                del self[k]
@@ -461,7 +462,7 @@ def slot_dict_class(keys, prefix="_val_"):
                                                pass
 
                        def __str__(self):
-                               return str(dict(self.items()))
+                               return str(dict(self.iteritems()))
 
                        if sys.hexversion >= 0x3000000:
                                items = iteritems
index 3f8ff1149618b69cf6e65fef1d69e5b207ba674b..81b1f17fd42de61e8fd687e4c8b2ac55b12613c0 100644 (file)
@@ -26,7 +26,7 @@ class database(flat_hash.database):
        complete_eclass_entries = False
        auxdbkey_order=('DEPEND', 'RDEPEND', 'SLOT', 'SRC_URI',
                'RESTRICT',  'HOMEPAGE',  'LICENSE', 'DESCRIPTION',
-               'KEYWORDS',  'INHERITED', 'IUSE', 'CDEPEND',
+               'KEYWORDS',  'INHERITED', 'IUSE', 'UNUSED_00',
                'PDEPEND',   'PROVIDE', 'EAPI', 'PROPERTIES', 'DEFINED_PHASES')
 
        autocommits = True
index 0f1de429ae633c78eb621d6050c074703b443501..fc0dd730ab2e97238cabb60fcc4e046148367cb9 100644 (file)
@@ -2,6 +2,8 @@
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
+from __future__ import print_function
+
 __all__ = ["bindbapi", "binarytree"]
 
 import portage
@@ -241,20 +243,19 @@ class binarytree(object):
                for atom in (origcp, newcp):
                        if not isjustname(atom):
                                raise InvalidPackageName(str(atom))
-               origcat = origcp.split("/")[0]
-               mynewcat = newcp.split("/")[0]
+               mynewcat = catsplit(newcp)[0]
                origmatches=self.dbapi.cp_list(origcp)
                moves = 0
                if not origmatches:
                        return moves
                for mycpv in origmatches:
-
-                       mycpsplit = catpkgsplit(mycpv)
-                       mynewcpv = newcp + "-" + mycpsplit[2]
-                       if mycpsplit[3] != "r0":
-                               mynewcpv += "-" + mycpsplit[3]
-                       myoldpkg = mycpv.split("/")[1]
-                       mynewpkg = mynewcpv.split("/")[1]
+                       mycpv_cp = portage.cpv_getkey(mycpv)
+                       if mycpv_cp != origcp:
+                               # Ignore PROVIDE virtual match.
+                               continue
+                       mynewcpv = mycpv.replace(mycpv_cp, str(newcp), 1)
+                       myoldpkg = catsplit(mycpv)[1]
+                       mynewpkg = catsplit(mynewcpv)[1]
 
                        if (mynewpkg != myoldpkg) and os.path.exists(self.getname(mynewcpv)):
                                writemsg(_("!!! Cannot update binary: Destination exists.\n"),
index 24e93dc204c41baa373bcdb5b3b9e8ae44b3d4e7..3bf002a7812f2cd8c5067a24a442ac6955ecfec2 100644 (file)
@@ -51,6 +51,7 @@ from portage.cache.mappings import slot_dict_class
 import codecs
 import re, shutil, stat, errno, copy, subprocess
 import logging
+import os as _os
 import sys
 import warnings
 
@@ -1555,9 +1556,13 @@ class vardbapi(dbapi):
                self._owners = self._owners_db(self)
 
        def getpath(self, mykey, filename=None):
-               rValue = os.path.join(self.root, VDB_PATH, mykey)
-               if filename != None:
-                       rValue = os.path.join(rValue, filename)
+               # This is an optimized hotspot, so don't use unicode-wrapped
+               # os module and don't use os.path.join().
+               rValue = self.root + _os.sep + VDB_PATH + _os.sep + mykey
+               if filename is not None:
+                       # If filename is always relative, we can do just
+                       # rValue += _os.sep + filename
+                       rValue = _os.path.join(rValue, filename)
                return rValue
 
        def cpv_exists(self, mykey):
@@ -1603,12 +1608,12 @@ class vardbapi(dbapi):
                if not origmatches:
                        return moves
                for mycpv in origmatches:
-                       mycpsplit = catpkgsplit(mycpv)
-                       mynewcpv = newcp + "-" + mycpsplit[2]
-                       mynewcat = newcp.split("/")[0]
-                       if mycpsplit[3] != "r0":
-                               mynewcpv += "-" + mycpsplit[3]
-                       mycpsplit_new = catpkgsplit(mynewcpv)
+                       mycpv_cp = cpv_getkey(mycpv)
+                       if mycpv_cp != origcp:
+                               # Ignore PROVIDE virtual match.
+                               continue
+                       mynewcpv = mycpv.replace(mycpv_cp, str(newcp), 1)
+                       mynewcat = catsplit(newcp)[0]
                        origpath = self.getpath(mycpv)
                        if not os.path.exists(origpath):
                                continue
index bae33a05f45e2cb9d4972173d42fbe029a0a4955..a3d33fc3161e8d51293e25845dab29a4809b8a23 100644 (file)
@@ -217,12 +217,10 @@ def stack_dicts(dicts, incremental=0, incrementals=[], ignore_none=0):
        """Stacks an array of dict-types into one array. Optionally merging or
        overwriting matching key/value pairs for the dict[key]->string.
        Returns a single dict."""
-       final_dict = None
+       final_dict = {}
        for mydict in dicts:
                if not mydict:
                        continue
-               if final_dict is None:
-                       final_dict = {}
                for k, v in mydict.items():
                        if k in final_dict and (incremental or (k in incrementals)):
                                final_dict[k] += " " + v