Merged from trunk -r12699:12704
authorFabian Groffen <grobian@gentoo.org>
Thu, 5 Mar 2009 18:32:23 +0000 (18:32 -0000)
committerFabian Groffen <grobian@gentoo.org>
Thu, 5 Mar 2009 18:32:23 +0000 (18:32 -0000)
   | 12700   | In LazyItemsDict, avoid storing empty lists and dicts when   |
   | zmedico | no positional or keyword arguments are given.                |

   | 12701   | Fix headers that contain $Header instead of $Id.             |
   | zmedico |                                                              |

   | 12702   | Fix breakage in USE_EXPAND wildcard handling, from r12697.   |
   | zmedico |                                                              |

   | 12703   | Make USE_EXPAND wildcard expansion more efficient, and       |
   | zmedico | prevent possible duplicates.                                 |

   | 12704   | If deepcopy() raises a TypeError for a lazy item that has    |
   | zmedico | been added via a call to LazyItemsDict.addLazySingleton(),   |
   |         | automatically evaluate the the singleton and instead call    |
   |         | deepcopy() on the result.                                    |

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

12 files changed:
bin/ebuild
bin/glsa-check
bin/misc-functions.sh
pym/portage/__init__.py
pym/portage/_selinux.py
pym/portage/cache/metadata_overlay.py
pym/portage/cache/sqlite.py
pym/portage/cache/volatile.py
pym/portage/debug.py
pym/portage/manifest.py
pym/portage/update.py
pym/portage/util.py

index 6b24e566b1dc7ea1241e0af76436b6a1e2094ba2..ca639e47500f9107fab96d78e10c54efa62b58ca 100755 (executable)
@@ -1,7 +1,7 @@
 #!@PORTAGE_PYTHON@ -O
 # Copyright 1999-2006 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-src/portage/bin/ebuild,v 1.18.2.3 2005/05/07 04:32:59 ferringb Exp $
+# $Id$
 
 import sys
 # This block ensures that ^C interrupts are handled quietly.
index 2b8e94db9ed25a31d4279837a1f84e508b822acb..45f3e95ffe7e3c345b4acbfb829caf99c83d0308 100644 (file)
@@ -1,7 +1,7 @@
 #!@PORTAGE_PYTHON@
-
-# $Header: $
-# This program is licensed under the GPL, version 2
+# Copyright 2008-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
 
 import os
 import sys
index 0ad07211687ed5ddded5c59dc8f1ff22a149f655..eedb213642e7f5418fcb788a8b31d1ee2fda711e 100644 (file)
@@ -1,7 +1,7 @@
 #!@PORTAGE_BASH@
-# Copyright 1999-2006 Gentoo Foundation
+# Copyright 1999-2009 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header$
+# $Id$
 #
 # Miscellaneous shell functions that make use of the ebuild env but don't need
 # to be included directly in ebuild.sh.
index b760d84238552af7033bc207a0b6c48d7d838a09..3a039647a7df75e4e15f1add2369003461796d48 100644 (file)
@@ -2134,7 +2134,9 @@ class config(object):
                                if ebuild_force_test:
                                        self.usemask.discard("test")
 
-               use.difference_update([x for x in use if x not in iuse_implicit])
+               # Allow _* flags from USE_EXPAND wildcards to pass through here.
+               use.difference_update([x for x in use \
+                       if x not in iuse_implicit and x[-2:] != '_*'])
 
                # Use the calculated USE flags to regenerate the USE_EXPAND flags so
                # that they are consistent. For optimal performance, use slice
@@ -2160,10 +2162,11 @@ class config(object):
                        if has_wildcard:
                                # * means to enable everything in IUSE that's not masked
                                if has_iuse:
-                                       for x in iuse_implicit:
-                                               if x[:prefix_len] == prefix and x not in self.usemask:
-                                                       suffix = x[prefix_len:]
-                                                       var_split.append(suffix)
+                                       for suffix in has_iuse:
+                                               x = prefix + suffix
+                                               if x not in usemask:
+                                                       if suffix not in expand_flags:
+                                                               var_split.append(suffix)
                                                        use.add(x)
                                else:
                                        # If there is a wildcard and no matching flags in IUSE then
@@ -2206,7 +2209,8 @@ class config(object):
                # attribute since we still want to be able to see global USE
                # settings for things like emerge --info.
 
-               self.configdict["pkg"]["PORTAGE_USE"] = " ".join(sorted(use))
+               self.configdict["pkg"]["PORTAGE_USE"] = \
+                       " ".join(sorted(x for x in use if x[-2:] != '_*'))
 
        def _get_implicit_iuse(self):
                """
index e4d80fa1e42640645124873627eb0b2d23b04681..b5afd9233de9c7266e28779786eee2047d70c253 100644 (file)
@@ -1,6 +1,6 @@
-# Copyright 1999-2006 Gentoo Foundation
+# Copyright 1999-2009 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: $
+# $Id$
 
 import selinux
 from selinux import is_selinux_enabled
index e25759c4a33a4ffc224400681ef65908d239162c..a12ffd7ba32bb09196d4045df2a91f2540617ce4 100644 (file)
@@ -1,6 +1,6 @@
-# Copyright 1999-2006 Gentoo Foundation
+# Copyright 1999-2009 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: $
+# $Id$
 
 import time
 from portage.cache import template
index a3d313c47e2d19e50f350588a876e46c014f8b6d..f6e8c103cf5ba0f3c6534c75706bfc8d53fe06a4 100644 (file)
@@ -1,6 +1,6 @@
-# Copyright 1999-2006 Gentoo Foundation
+# Copyright 1999-2009 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: $
+# $Id$
 
 from portage.cache import fs_template
 from portage.cache import cache_errors
index eb4f1eb9b9210bc7b0ccdb3f30c8ff0d72bd4376..108393185ba9c599caf39c93e3930c12531ddb96 100644 (file)
@@ -1,6 +1,6 @@
-# Copyright 1999-2006 Gentoo Foundation
+# Copyright 1999-2009 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: $
+# $Id$
 
 import copy
 from portage.cache import template
index b9e56ed003ebd690e37286058569e272cc53b8ff..343f8ab6e4150ffc62ee9131885c1c163a787b8e 100644 (file)
@@ -1,6 +1,6 @@
-# Copyright 1999-2006 Gentoo Foundation
+# Copyright 1999-2009 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: $
+# $Id$
 
 import os, sys, threading
 
index 1244e42322a39be0ac1394262c01701e6d4eb82c..02836e7ece8009f11711423538cc0b2f9a4e7909 100644 (file)
@@ -1,6 +1,6 @@
 # Copyright 1999-2009 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: $
+# $Id$
 
 import errno, os
 
index fffdc26eb22c6f4555546c760b5eeb0844fffeac..70ff686643f57404e64bb39a3c765d483e86b28e 100644 (file)
@@ -1,6 +1,6 @@
 # Copyright 1999-2009 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: $
+# $Id$
 
 import errno, os, re, sys
 
index 42139c656a5de808831a169e59a81efbe76f6186..d1032f7b92c1562404546424af0d0be7cbe1e571 100644 (file)
@@ -1073,6 +1073,10 @@ class LazyItemsDict(dict):
        def addLazyItem(self, item_key, value_callable, *pargs, **kwargs):
                """Add a lazy item for the given key.  When the item is requested,
                value_callable will be called with *pargs and **kwargs arguments."""
+               if not pargs:
+                       pargs = None
+               if not kwargs:
+                       kwargs = None
                self.lazy_items[item_key] = (value_callable, pargs, kwargs)
                # make it show up in self.keys(), etc...
                dict.__setitem__(self, item_key, None)
@@ -1095,6 +1099,10 @@ class LazyItemsDict(dict):
        def __getitem__(self, item_key):
                if item_key in self.lazy_items:
                        value_callable, pargs, kwargs = self.lazy_items[item_key]
+                       if pargs is None:
+                               pargs = ()
+                       if kwargs is None:
+                               kwargs = {}
                        return value_callable(*pargs, **kwargs)
                else:
                        return dict.__getitem__(self, item_key)
@@ -1132,6 +1140,10 @@ class LazyItemsDict(dict):
 
                If deepcopy() needs to work, this problem can be avoided by
                implementing lazy items with normal (non-bound) functions.
+
+               If deepcopy() raises a TypeError for a lazy item that has been added
+               via a call to addLazySingleton(), the singleton will be automatically
+               evaluated and deepcopy() will instead be called on the result.
                """
                if memo is None:
                        memo = {}
@@ -1141,9 +1153,17 @@ class LazyItemsDict(dict):
                for k in self:
                        k_copy = deepcopy(k, memo)
                        if k in self.lazy_items:
-                               dict.__setitem__(result, k_copy, None)
-                               result.lazy_items[k_copy] = \
-                                       deepcopy(self.lazy_items[k], memo)
+                               lazy_item = self.lazy_items[k]
+                               try:
+                                       result.lazy_items[k_copy] = deepcopy(lazy_item, memo)
+                               except TypeError:
+                                       # If deepcopy fails for a lazy singleton, try to
+                                       # evaluate the singleton and deepcopy the result.
+                                       if not isinstance(lazy_item[0], self._SingletonWrapper):
+                                               raise
+                                       dict.__setitem__(result, k_copy, deepcopy(self[k], memo))
+                               else:
+                                       dict.__setitem__(result, k_copy, None)
                        else:
                                dict.__setitem__(result, k_copy, deepcopy(self[k], memo))
                return result