Merged from trunk 7758:7773
authorFabian Groffen <grobian@gentoo.org>
Fri, 14 Sep 2007 20:16:01 +0000 (20:16 -0000)
committerFabian Groffen <grobian@gentoo.org>
Fri, 14 Sep 2007 20:16:01 +0000 (20:16 -0000)
   | 7759      | Bug #190268 - Avoid unwanted sandbox violations in         |
   | zmedico   | src_test(). - Allow SANDBOX_* variables to pass through. - |
   |           | Don't try to create an sandbox instance inside a test case |
   |           | in order to interaction with SANDBOX_* variables in        |
   |           | src_test().                                                |

   | 7761      | Fix a typo.                                                |
   | zmedico   |                                                            |

   | 7763      | In depgraph.altlist(), try to merge asap_nodes sooner by   |
   | zmedico   | giving them an exemption from the accept_root_node flag.   |
   |           | (branches/2.1.2 r7762)                                     |

   | 7764      | compress two loop iterations into one                      |
   | WarnerBro |                                                            |

   | 7765      | sigh, or, not and                                          |
   | WarnerBro |                                                            |

   | 7766      | or I was right the first time :(                           |
   | WarnerBro |                                                            |

   | 7767      | Remove name from PackageSet, it's pointless as the caller  |
   | genone    | has to keep track of the name himself anyway               |

   | 7768      | Adjust for r7767                                           |
   | genone    |                                                            |

   | 7769      | Bug #192298 - Handle PermissionDenied error in             |
   | zmedico   | cache.update_eclasses().                                   |

   | 7770      | Catch errno.ENOTDIR instead of using os.path.isdir().      |
   | zmedico   |                                                            |

   | 7771      | Bug #192195 - In dir_get_list(), append a trailing / to    |
   | zmedico   | the address when necessary in order to avoid getting a 400 |
   |           | error from the http server.                                |

   | 7772      | Bug #187795 - remove pointless digest.disjointed and       |
   | zmedico   | digest.notadded warnings since they are always added to    |
   |           | cvs automatically anyway.                                  |

   | 7773      | Bug #191645 - Document the --force option.                 |
   | zmedico   |                                                            |

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

16 files changed:
man/repoman.1
pym/emerge/__init__.py
pym/portage/__init__.py
pym/portage/eclass_cache.py
pym/portage/env/loaders.py
pym/portage/getbinpkg.py
pym/portage/sets/__init__.py
pym/portage/sets/dbapi.py
pym/portage/sets/files.py
pym/portage/sets/profiles.py
pym/portage/sets/security.py
pym/portage/sets/shell.py
pym/portage/tests/ebuild/test_spawn.py
pym/portage/tests/sets/files/testConfigFileSet.py
pym/portage/tests/sets/files/testStaticFileSet.py
pym/portage/tests/sets/shell/testShell.py

index 306ddd0a109691b4239e5a7b981bdbf4b9b9466a..31fc3efead59c4ec9565cfae6bfa62ae1be09f80 100644 (file)
@@ -13,6 +13,12 @@ It checks the quality of CVS repositories.
 Note: \fBrepoman commit\fR only works \fIinside local\fR CVS repositories.
 .SH OPTIONS
 .TP
+\fB--force\fR
+Force commit to proceed, regardless of QA issues. For convenience, this option
+causes the most time consuming QA checks to be skipped. The commit message will
+include an indication that this option has been enabled, together with the
+usual portage version stamp.
+.TP
 \fB-q\fR, \fB--quiet\fR
 Be less verbose about extraneous info
 .TP
@@ -159,18 +165,12 @@ ChangeLogs that exist but have not been added to cvs
 .B digest.assumed
 Existing digest must be assumed correct (Package level only)
 .TP
-.B digest.disjointed
-Digests not added to cvs when the matching ebuild has been added
-.TP
 .B digest.fail
 Digest does not match the specified local file
 .TP
 .B digest.missing
 Digest files that are missing (ebuild exists, digest doesn't)
 .TP
-.B digest.notadded
-Digests that exist but have not been added to cvs
-.TP
 .B digest.partial
 Digest files do not contain all corresponding URI elements
 .TP
index 065d41878032c0b4b878016be81c13056df85ef7..c22c11c6045d02bc7f6a8aa0095d6efc1befbb20 100644 (file)
@@ -53,7 +53,7 @@ from portage.const import EPREFIX
 from portage.data import secpass
 from portage.util import normalize_path as normpath
 from portage.util import writemsg
-from portage.sets.dbapi import InternalPackageSet
+from portage.sets import InternalPackageSet
 from portage.sets.profiles import PackagesSystemSet as SystemSet
 from portage.sets.files import WorldSet
 
@@ -568,7 +568,7 @@ def getlist(settings, mode):
 
 def clean_world(vardb, cpv):
        """Remove a package from the world file when unmerged."""
-       world_set = WorldSet("world", vardb.settings["ROOT"])
+       world_set = WorldSet(vardb.settings["ROOT"])
        world_set.lock()
        worldlist = list(world_set) # loads latest from disk
        mykey = portage.cpv_getkey(cpv)
@@ -601,9 +601,9 @@ class RootConfig(object):
                self.settings = trees["vartree"].settings
                self.root = self.settings["ROOT"]
                self.sets = {}
-               world_set = WorldSet("world", self.root)
+               world_set = WorldSet(self.root)
                self.sets["world"] = world_set
-               system_set = SystemSet("system", self.settings.profiles)
+               system_set = SystemSet(self.settings.profiles)
                self.sets["system"] = system_set
 
 def create_world_atom(pkg_key, metadata, args_set, root_config):
@@ -2335,7 +2335,8 @@ class depgraph(object):
                                        for ignore_priority in xrange(DepPriority.SOFT,
                                                DepPriority.MEDIUM_SOFT + 1):
                                                for node in nodes:
-                                                       if not accept_root_node and \
+                                                       if nodes is not asap_nodes and \
+                                                               not accept_root_node and \
                                                                not mygraph.parent_nodes(node):
                                                                continue
                                                        selected_nodes = set()
@@ -5468,9 +5469,9 @@ def action_depclean(settings, trees, ldpath_mtimes,
        vardb = dep_check_trees[myroot]["vartree"].dbapi
        # Constrain dependency selection to the installed packages.
        dep_check_trees[myroot]["porttree"] = dep_check_trees[myroot]["vartree"]
-       system_set = SystemSet("system", settings.profiles)
+       system_set = SystemSet(settings.profiles)
        syslist = list(system_set)
-       world_set = WorldSet("world", myroot)
+       world_set = WorldSet(myroot)
        worldlist = list(world_set)
        args_set = InternalPackageSet()
        fakedb = portage.fakedbapi(settings=settings)
index aeff98dee3067521fbfbe59101c44f8d1f74caa0..22249ab610160693a053fb1df9a9ae4908f756e8 100644 (file)
@@ -1202,8 +1202,7 @@ class config(object):
 
                        # Blacklist vars that could interfere with portage internals.
                        for blacklisted in "CATEGORY", "PKGUSE", "PORTAGE_CONFIGROOT", \
-                               "ROOT", "SANDBOX_DENY", "SANDBOX_PREDICT", "SANDBOX_READ", \
-                               "SANDBOX_WRITE", "EPREFIX", "EROOT":
+                               "ROOT", "EPREFIX", "EROOT":
                                for cfg in self.lookuplist:
                                        cfg.pop(blacklisted, None)
                        del blacklisted, cfg
index 5a0d3c3ad0d2a48ce653b827e96d71dbc8274fbf..8fac8aec4826813fc1e4070b7888329b39563f65 100644 (file)
@@ -4,8 +4,9 @@
 # $Id$
 
 from portage.util import normalize_path, writemsg
-import os, sys
+import errno, os, sys
 from portage.data import portage_gid
+from portage.exception import PermissionDenied
 
 class cache(object):
        """
@@ -42,9 +43,22 @@ class cache(object):
                self._eclass_locations = {}
                eclass_len = len(".eclass")
                for x in [normalize_path(os.path.join(y,"eclass")) for y in self.porttrees]:
-                       if not os.path.isdir(x):
-                               continue
-                       for y in [y for y in os.listdir(x) if y.endswith(".eclass")]:
+                       eclass_filenames = []
+                       try:
+                               for y in os.listdir(x):
+                                       if y.endswith(".eclass"):
+                                               eclass_filenames.append(y)
+                       except OSError, e:
+                               if e.errno == errno.ENOENT:
+                                       del e
+                                       continue
+                               elif e.errno == errno.ENOTDIR:
+                                       del e
+                                       continue
+                               elif e.errno == PermissionDenied.errno:
+                                       raise PermissionDenied(x)
+                               raise
+                       for y in eclass_filenames:
                                try:
                                        mtime = long(os.stat(os.path.join(x, y)).st_mtime)
                                except OSError:
index ba250ecd47ac1a97b2f974bbbdcb24aaae09cd00..1d0ca01aac4bba924601e32222feabb7e6724ad3 100644 (file)
@@ -41,8 +41,7 @@ def RecursiveFileLoader(filename):
                for root, dirs, files in os.walk(filename):
                        if 'CVS' in dirs:
                                dirs.remove('CVS')
-                       files = [f for f in files if not f.startswith('.')]
-                       files = [f for f in files if not f.endswith('~')]
+                       files = [f for f in files if not f.startswith('.') and not f.endswith('~')]
                        for f in files:
                                yield os.path.join(root, f)
        else:
index 93d43db09072c0d1f4b47343aeb0abc2139e354b..1362b1707d2328e1bd80aac441e747313f30656e 100644 (file)
@@ -299,6 +299,10 @@ def dir_get_list(baseurl,conn=None):
 
        listing = None
        if protocol in ["http","https"]:
+               if not address.endswith("/"):
+                       # http servers can return a 400 error here
+                       # if the address doesn't end with a slash.
+                       address += "/"
                page,rc,msg = make_http_request(conn,address,params,headers)
                
                if page:
index 7c288c264382d0929a378a070ea6842fc22a1a78..e62a9d750899bbd5a542a68b6fcf8ac3a755b8d4 100644 (file)
@@ -19,11 +19,9 @@ class PackageSet(object):
        # package sets, the latter doesn't make sense for some sets like "system"
        # or "security" and therefore isn't supported by them.
        _operations = ["merge"]
-       _atommap = {}
        description = "generic package set"
        
-       def __init__(self, name):
-               self.name = name
+       def __init__(self):
                self._atoms = set()
                self._atommap = {}
                self._loaded = False
@@ -150,7 +148,7 @@ class EditablePackageSet(PackageSet):
 
 class InternalPackageSet(EditablePackageSet):
        def __init__(self, initial_atoms=None):
-               super(InternalPackageSet, self).__init__("")
+               super(InternalPackageSet, self).__init__()
                if initial_atoms != None:
                        self.update(initial_atoms)
 
@@ -174,23 +172,23 @@ def make_default_sets(configroot, root, profile_paths, settings=None,
        from portage.sets.dbapi import EverythingSet
        from portage.const import PRIVATE_PATH, USER_CONFIG_PATH
        
-       rValue = set()
-       worldset = StaticFileSet("world", os.path.join(root, PRIVATE_PATH, "world"))
+       rValue = {}
+       worldset = StaticFileSet(os.path.join(root, PRIVATE_PATH, "world"))
        worldset.description = "Set of packages that were directly installed"
-       rValue.add(worldset)
+       rValue["world"] = worldset
        for suffix in ["mask", "unmask", "keywords", "use"]:
                myname = "package_"+suffix
-               myset = ConfigFileSet(myname, os.path.join(configroot, USER_CONFIG_PATH.lstrip(os.sep), "package."+suffix))
-               rValue.add(myset)
-       rValue.add(PackagesSystemSet("system", profile_paths))
+               myset = ConfigFileSet(os.path.join(configroot, USER_CONFIG_PATH.lstrip(os.sep), "package."+suffix))
+               rValue[myname] = myset
+       rValue["system"] = PackagesSystemSet(profile_paths)
        if settings != None and portdbapi != None:
-               rValue.add(NewAffectedSet("security", settings, vdbapi, portdbapi))
+               rValue["security"] = NewAffectedSet(settings, vdbapi, portdbapi)
        else:
-               rValue.add(InternalPackageSet("security"))
+               rValue["security"] = InternalPackageSet()
        if vdbapi != None:
-               rValue.add(EverythingSet("everything", vdbapi))
+               rValue["everything"] = EverythingSet(vdbapi)
        else:
-               rValue.add(InternalPackageSet("everything"))
+               rValue["everything"] = InternalPackageSet()
 
        return rValue
 
@@ -198,7 +196,7 @@ def make_extra_static_sets(configroot):
        from portage.sets.files import StaticFileSet
        from portage.const import PRIVATE_PATH, USER_CONFIG_PATH
        
-       rValue = set()
+       rValue = {}
        mydir = os.path.join(configroot, USER_CONFIG_PATH.lstrip(os.sep), "sets")
        try:
                mysets = os.listdir(mydir)
@@ -207,14 +205,14 @@ def make_extra_static_sets(configroot):
        for myname in mysets:
                if myname in DEFAULT_SETS:
                        continue
-               rValue.add(StaticFileSet(myname, os.path.join(mydir, myname)))
+               rValue[myname] = StaticFileSet(os.path.join(mydir, myname))
        return rValue
 
 def make_category_sets(portdbapi, settings, only_visible=True):
        from portage.sets.dbapi import CategorySet
-       rValue = set()
+       rValue = {}
        for c in settings.categories:
-               rValue.add(CategorySet("category_%s" % c, c, portdbapi, only_visible=only_visible))
+               rValue["category_%s" % c] = CategorySet(c, portdbapi, only_visible=only_visible)
        return rValue
 
 # adhoc test code
@@ -228,16 +226,18 @@ if __name__ == "__main__":
                for s in sys.argv[1:]:
                        if s.startswith("category_"):
                                c = s[9:]
-                               l.add(CategorySet("category_%s" % c, c, portage.db['/']['porttree'].dbapi, only_visible=False))
+                               l["category_%s" % c] = CategorySet(c, portage.db['/']['porttree'].dbapi, only_visible=False)
                        elif os.path.exists(s):
-                               l.add(StaticFileSet(os.path.basename(s), s))
+                               l[os.path.basename(s)] = StaticFileSet(s)
                        elif s != "*":
                                print "ERROR: could not create set '%s'" % s
                if not "*" in sys.argv:
-                       l = [s for s in l if s.name in sys.argv[1:]]
+                       for n in l:
+                               if n not in sys.argv[1:]:
+                                       del l[n]
        for x in l:
-               print x.name+":"
-               print "DESCRIPTION = %s" % x.getMetadata("Description")
-               for n in sorted(x.getAtoms()):
+               print x+":"
+               print "DESCRIPTION = %s" % l[x].getMetadata("Description")
+               for n in sorted(l[x].getAtoms()):
                        print "- "+n
                print
index 709bbbdece28c49dc6609e6590884b5cc79dd758..5c16b170198046bf861484ab485523a1db71a1de 100644 (file)
@@ -9,8 +9,8 @@ class EverythingSet(PackageSet):
        _operations = ["merge", "unmerge"]
        description = "Package set containing all installed packages"
        
-       def __init__(self, name, vdbapi):
-               super(EverythingSet, self).__init__(name)
+       def __init__(self, vdbapi):
+               super(EverythingSet, self).__init__()
                self._db = vdbapi
        
        def load(self):
@@ -27,9 +27,9 @@ class EverythingSet(PackageSet):
 class CategorySet(PackageSet):
        _operations = ["merge", "unmerge"]
        
-       def __init__(self, name, category, portdbapi, only_visible=True):
-               super(CategorySet, self).__init__(name)
-               self._db = portdbapi
+       def __init__(self, category, dbapi, only_visible=True):
+               super(CategorySet, self).__init__()
+               self._db = dbapi
                self._category = category
                self._check = only_visible
                if only_visible:
index c19c7727dc7f19f2d8fd6ce07dab4a77c44c9d76..00f24097dfeffd7004672a36f793348428fa0713 100644 (file)
@@ -15,8 +15,8 @@ from portage.env.validators import ValidAtomValidator
 class StaticFileSet(EditablePackageSet):
        _operations = ["merge", "unmerge"]
        
-       def __init__(self, name, filename):
-               super(StaticFileSet, self).__init__(name)
+       def __init__(self, filename):
+               super(StaticFileSet, self).__init__()
                self._filename = filename
                self._mtime = None
                self.description = "Package set loaded from file %s" % self._filename
@@ -56,12 +56,13 @@ class StaticFileSet(EditablePackageSet):
                                if e.errno != errno.ENOENT:
                                        raise
                                del e
+                               data = {}
                        self._setAtoms(data.keys())
                        self._mtime = mtime
        
 class ConfigFileSet(PackageSet):
-       def __init__(self, name, filename):
-               super(ConfigFileSet, self).__init__(name)
+       def __init__(self, filename):
+               super(ConfigFileSet, self).__init__()
                self._filename = filename
                self.description = "Package set generated from %s" % self._filename
                self.loader = KeyListFileLoader(self._filename, ValidAtomValidator)
@@ -73,8 +74,8 @@ class ConfigFileSet(PackageSet):
 class WorldSet(StaticFileSet):
        description = "Set of packages that were directly installed by the user"
        
-       def __init__(self, name, root):
-               super(WorldSet, self).__init__(name, os.path.join(os.sep, root, PRIVATE_PATH, "world"))
+       def __init__(self, root):
+               super(WorldSet, self).__init__(os.path.join(os.sep, root, PRIVATE_PATH, "world"))
                self._lock = None
 
        def _ensure_dirs(self):
index a1be8e47f27d91b9dc33faba36391f48ccab1b66..7dbc35e367df60ac1dfe50d1c60b9684752fae41 100644 (file)
@@ -9,8 +9,8 @@ from portage.sets import PackageSet
 class PackagesSystemSet(PackageSet):
        _operations = ["merge"]
 
-       def __init__(self, name, profile_paths):
-               super(PackagesSystemSet, self).__init__(name)
+       def __init__(self, profile_paths):
+               super(PackagesSystemSet, self).__init__()
                self._profile_paths = profile_paths
                self.description = "System packages for profile %s" % self._profile_paths[-1]
        
index c2c6048e1bc3d8ca794534ee2f4254ee6397da67..6c463df9aba702ac20a38b80098b1d8e253600c6 100644 (file)
@@ -14,8 +14,8 @@ class SecuritySet(PackageSet):
        
        description = "package set that includes all packages possibly affected by a GLSA"
                
-       def __init__(self, name, settings, vardbapi, portdbapi):
-               super(SecuritySet, self).__init__(name)
+       def __init__(self, settings, vardbapi, portdbapi):
+               super(SecuritySet, self).__init__()
                self._settings = settings
                self._vardbapi = vardbapi
                self._portdbapi = portdbapi
index 6a84918a7fbc250c3711758ae28d4c877943e5cd..7bfaeaecbd7e82fabc00357463ce0972f7aad269 100644 (file)
@@ -23,8 +23,8 @@ class CommandOutputSet(PackageSet):
        """
        _operations = ["merge", "unmerge"]
 
-       def __init__(self, name, command):
-               super(CommandOutputSet, self).__init__(name)
+       def __init__(self, command):
+               super(CommandOutputSet, self).__init__()
                self._command = command
                self.description = "Package set generated from output of '%s'" % self._command
        
index 66e8f9ea7d8ff14e8c756e0fc1352e474a598566..f582723bcbd5bf1fa4835b485c01bce3db6502dd 100644 (file)
@@ -16,8 +16,16 @@ class SpawnTestCase(TestCase):
                        os.close(fd)
                        null_fd = os.open('/dev/null', os.O_RDWR)
                        test_string = 2 * "blah blah blah\n"
+                       # Test cases are unique because they run inside src_test() which
+                       # may or may not already be running within a sandbox. Interaction
+                       # with SANDBOX_* variables may trigger unwanted sandbox violations
+                       # that are only reproducible with certain combinations of sandbox,
+                       # usersandbox, and userpriv FEATURES. Attempts to filter SANDBOX_*
+                       # variables can interfere with a currently running sandbox
+                       # instance. Therefore, use free=1 here to avoid potential
+                       # interactions (see bug #190268).
                        spawn("echo -n '%s'" % test_string, settings, logfile=logfile,
-                               fd_pipes={0:sys.stdin.fileno(), 1:null_fd, 2:null_fd})
+                               free=1, fd_pipes={0:sys.stdin.fileno(), 1:null_fd, 2:null_fd})
                        os.close(null_fd)
                        f = open(logfile, 'r')
                        log_content = f.read()
index 69acf3d10e56cbb82f0679e2de641f7934500073..7d588fbc33f0aa85338e42c54e3a22c865762129 100644 (file)
@@ -22,11 +22,10 @@ class ConfigFileSetTestCase(TestCase):
                os.close(fd)
 
        def tearDown(self):
-#              os.unlink(self.testfile)
-               pass
+               os.unlink(self.testfile)
 
        def testConfigStaticFileSet(self):
-               s = ConfigFileSet('test', self.testfile)
+               s = ConfigFileSet(self.testfile)
                s.load()
                self.assertEqual(set(test_cps), s.getAtoms())
 
index 8f0b5d050325b48b06569d8360933dfacdc1cb35..71c47dc1b70cb551c743854a443c56f0f55e057c 100644 (file)
@@ -22,7 +22,7 @@ class StaticFileSetTestCase(TestCase):
                os.unlink(self.testfile)
 
        def testSampleStaticFileSet(self):
-               s = StaticFileSet('test', self.testfile)
+               s = StaticFileSet(self.testfile)
                s.load()
                self.assertEqual(set(test_cps), s.getAtoms())
 
index 938c265e1194df189aaefff042d9f6b9073901c5..b1f4aa46c6c9aa8370e006d9326bca286063e5c5 100644 (file)
@@ -23,6 +23,6 @@ class CommandOutputSetTestCase(TestCase):
                command += " -e "
                for a in input:
                  command += "\"%s\n\"" % a
-               s = CommandOutputSet('testset', command)
+               s = CommandOutputSet(command)
                atoms = s.getAtoms()
                self.assertEqual(atoms, input)