From: Fabian Groffen Date: Fri, 14 Sep 2007 20:16:01 +0000 (-0000) Subject: Merged from trunk 7758:7773 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=d6ac933622ba947b6a96285186b4e1425073e1eb;p=portage.git Merged from trunk 7758:7773 | 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 --- diff --git a/man/repoman.1 b/man/repoman.1 index 306ddd0a1..31fc3efea 100644 --- a/man/repoman.1 +++ b/man/repoman.1 @@ -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 diff --git a/pym/emerge/__init__.py b/pym/emerge/__init__.py index 065d41878..c22c11c60 100644 --- a/pym/emerge/__init__.py +++ b/pym/emerge/__init__.py @@ -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) diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index aeff98dee..22249ab61 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -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 diff --git a/pym/portage/eclass_cache.py b/pym/portage/eclass_cache.py index 5a0d3c3ad..8fac8aec4 100644 --- a/pym/portage/eclass_cache.py +++ b/pym/portage/eclass_cache.py @@ -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: diff --git a/pym/portage/env/loaders.py b/pym/portage/env/loaders.py index ba250ecd4..1d0ca01aa 100644 --- a/pym/portage/env/loaders.py +++ b/pym/portage/env/loaders.py @@ -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: diff --git a/pym/portage/getbinpkg.py b/pym/portage/getbinpkg.py index 93d43db09..1362b1707 100644 --- a/pym/portage/getbinpkg.py +++ b/pym/portage/getbinpkg.py @@ -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: diff --git a/pym/portage/sets/__init__.py b/pym/portage/sets/__init__.py index 7c288c264..e62a9d750 100644 --- a/pym/portage/sets/__init__.py +++ b/pym/portage/sets/__init__.py @@ -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 diff --git a/pym/portage/sets/dbapi.py b/pym/portage/sets/dbapi.py index 709bbbdec..5c16b1701 100644 --- a/pym/portage/sets/dbapi.py +++ b/pym/portage/sets/dbapi.py @@ -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: diff --git a/pym/portage/sets/files.py b/pym/portage/sets/files.py index c19c7727d..00f24097d 100644 --- a/pym/portage/sets/files.py +++ b/pym/portage/sets/files.py @@ -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): diff --git a/pym/portage/sets/profiles.py b/pym/portage/sets/profiles.py index a1be8e47f..7dbc35e36 100644 --- a/pym/portage/sets/profiles.py +++ b/pym/portage/sets/profiles.py @@ -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] diff --git a/pym/portage/sets/security.py b/pym/portage/sets/security.py index c2c6048e1..6c463df9a 100644 --- a/pym/portage/sets/security.py +++ b/pym/portage/sets/security.py @@ -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 diff --git a/pym/portage/sets/shell.py b/pym/portage/sets/shell.py index 6a84918a7..7bfaeaecb 100644 --- a/pym/portage/sets/shell.py +++ b/pym/portage/sets/shell.py @@ -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 diff --git a/pym/portage/tests/ebuild/test_spawn.py b/pym/portage/tests/ebuild/test_spawn.py index 66e8f9ea7..f582723bc 100644 --- a/pym/portage/tests/ebuild/test_spawn.py +++ b/pym/portage/tests/ebuild/test_spawn.py @@ -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() diff --git a/pym/portage/tests/sets/files/testConfigFileSet.py b/pym/portage/tests/sets/files/testConfigFileSet.py index 69acf3d10..7d588fbc3 100644 --- a/pym/portage/tests/sets/files/testConfigFileSet.py +++ b/pym/portage/tests/sets/files/testConfigFileSet.py @@ -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()) diff --git a/pym/portage/tests/sets/files/testStaticFileSet.py b/pym/portage/tests/sets/files/testStaticFileSet.py index 8f0b5d050..71c47dc1b 100644 --- a/pym/portage/tests/sets/files/testStaticFileSet.py +++ b/pym/portage/tests/sets/files/testStaticFileSet.py @@ -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()) diff --git a/pym/portage/tests/sets/shell/testShell.py b/pym/portage/tests/sets/shell/testShell.py index 938c265e1..b1f4aa46c 100644 --- a/pym/portage/tests/sets/shell/testShell.py +++ b/pym/portage/tests/sets/shell/testShell.py @@ -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)