From d28d53d1ed5b5d3aea69d732b5e904069832ceb3 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Thu, 19 Feb 2009 17:50:29 +0000 Subject: [PATCH] Merged from trunk -r12619:12633 | 12620 | unify code for unpacking of tar files | | SpankMan | | | 12621 | Bug #259124 - Inside EbuildFetcher._start(), pass the | | zmedico | NOCOLOR variable into the fetch environment, so that | | | --color=n is respected. | | 12622 | Fix grabfile_package() to preprocess atoms before passing | | zmedico | them to isvalidatom() because isvalidatom() has gotten more | | | strict since r12614. Thanks to ABCD for reporting. | | 12623 | Bug #253904 - Add a lookahead mechanism inside | | zmedico | depgraph._dep_check_composite_db._visible() which masks | | | package choices that are likely to trigger slot conflicts. | | | Thanks to Vlastimil Babka for the suggestion. | | 12624 | Call depgraph._dep_check_composite_db._clear_cache() inside | | zmedico | depgraph._add_pkg() since | | | _dep_check_composite_db._visible() is now affected by which | | | packages are added to the graph. | | 12625 | Make save_ebuild_env() filter NOCOLOR, and remove related | | zmedico | code from ebuild.sh since that variable is not loaded from | | | $T/environment anymore. | | 12626 | Set svn:keywords Id on all files. | | zmedico | | | 12628 | In python-3.0, the UserDict.DictMixin class has been | | zmedico | replaced by Mapping and MutableMapping from the collections | | | module, but 2to3 doesn't currently account for this change: | | | http://bugs.python.org/issue2876 As a workaround for the | | | above issue, implement Mapping and MutableMapping classes | | | as substitutes for UserDict.DictMixin so that code | | | converted via 2to3 will run. | | 12629 | Implement a substitute for UserDict.UserDict so that code | | zmedico | converted via 2to3 will run: | | | http://bugs.python.org/issue2876 | | 12630 | Implement UserDict.__contains__() and __iter__(). | | zmedico | | | 12631 | Remove redundant ConfigLoaderKlass.__iter__() method. | | zmedico | | | 12632 | Fix classes that implement __iter__() to copy it to their | | zmedico | keys() method when running under >=python-3.0. | | 12633 | For compatibility with python-3.0, use isinstance() instead | | zmedico | of type(). | svn path=/main/branches/prefix/; revision=12651 --- bin/dohtml | 4 - bin/ebuild.sh | 48 ++--- bin/isolated-functions.sh | 2 +- pym/_emerge/__init__.py | 35 +++- pym/portage/__init__.py | 12 +- pym/portage/cache/mappings.py | 189 ++++++++++++++++-- pym/portage/cache/sql_template.py | 1 + pym/portage/dep.py | 4 +- pym/portage/env/config.py | 12 +- pym/portage/locks.py | 23 ++- pym/portage/tests/bin/setup_env.py | 2 +- pym/portage/tests/bin/test_dobin.py | 2 +- pym/portage/tests/bin/test_dodir.py | 2 +- pym/portage/tests/dep/test_dep_getusedeps.py | 2 +- .../env/config/test_PackageKeywordsFile.py | 2 +- .../tests/env/config/test_PackageMaskFile.py | 2 +- .../tests/env/config/test_PackageUseFile.py | 2 +- pym/portage/tests/news/test_NewsItem.py | 2 +- pym/portage/tests/process/__init__.py | 2 +- pym/portage/tests/process/test_poll.py | 2 +- .../tests/sets/files/testConfigFileSet.py | 2 +- .../tests/sets/files/testStaticFileSet.py | 2 +- pym/portage/util.py | 5 +- 23 files changed, 254 insertions(+), 105 deletions(-) diff --git a/bin/dohtml b/bin/dohtml index 6bc41ff02..69286a741 100755 --- a/bin/dohtml +++ b/bin/dohtml @@ -31,7 +31,6 @@ import os import sys -import types def dodir(path): os.spawnlp(os.P_WAIT, "install", "install", "-d", path) @@ -160,9 +159,6 @@ def main(): (options, args) = parse_args() - if type(options.allowed_exts) == types.StringType: - options.allowed_exts = options.allowed_exts.split(",") - if options.verbose: print "Allowed extensions:", options.allowed_exts print "Document prefix : '" + options.doc_prefix + "'" diff --git a/bin/ebuild.sh b/bin/ebuild.sh index 4b0845fda..69cf87c5d 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -353,6 +353,15 @@ unpack() { fi [[ ! -s ${srcdir}${x} ]] && die "${x} does not exist" + _unpack_tar() { + if [ "${y}" == "tar" ]; then + $1 -dc "${srcdir}${x}" | tar xof - ${tar_opts} + assert "$myfail" + else + $1 -dc "${srcdir}${x}" > ${x%.*} || die "$myfail" + fi + } + myfail="failure unpacking ${x}" case "${x##*.}" in tar) @@ -369,19 +378,10 @@ unpack() { unzip -qo "${srcdir}${x}" || die "$myfail" ;; gz|Z|z) - if [ "${y}" == "tar" ]; then - tar zoxf "${srcdir}${x}" ${tar_opts} || die "$myfail" - else - gzip -dc "${srcdir}${x}" > ${x%.*} || die "$myfail" - fi + _unpack_tar gzip ;; bz2|bz) - if [ "${y}" == "tar" ]; then - bzip2 -dc "${srcdir}${x}" | tar xof - ${tar_opts} - assert "$myfail" - else - bzip2 -dc "${srcdir}${x}" > ${x%.*} || die "$myfail" - fi + _unpack_tar bzip2 ;; 7Z|7z) local my_output @@ -428,23 +428,13 @@ unpack() { fi ;; lzma) - if [ "${y}" == "tar" ]; then - lzma -dc "${srcdir}${x}" | tar xof - ${tar_opts} - assert "$myfail" - else - lzma -dc "${srcdir}${x}" > ${x%.*} || die "$myfail" - fi + _unpack_tar lzma ;; xz) if hasq $eapi 0 1 2 ; then vecho "unpack ${x}: file format not recognized. Ignoring." else - if [ "${y}" == "tar" ]; then - xz -dc "${srcdir}${x}" | tar xof - ${tar_opts} - assert "$myfail" - else - xz -dc "${srcdir}${x}" > ${x%.*} || die "$myfail" - fi + _unpack_tar xz fi ;; *) @@ -1854,18 +1844,6 @@ if ! hasq "$EBUILD_PHASE" clean cleanrm depend && \ unset x y export SANDBOX_ON=${PORTAGE_SANDBOX_ON} unset PORTAGE_SANDBOX_ON - - # After loading the environment, make sure the color variables - # are in sync with the current NOCOLOR setting. - case "${NOCOLOR:-false}" in - yes|true) - unset_colors - ;; - no|false) - set_colors - ;; - esac - fi if ! hasq "$EBUILD_PHASE" clean cleanrm && \ diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh index 1eead1a2c..b3256452c 100755 --- a/bin/isolated-functions.sh +++ b/bin/isolated-functions.sh @@ -528,7 +528,7 @@ save_ebuild_env() { ECLASSDIR ECLASS_DEPTH ENDCOL FAKEROOTKEY \ GOOD HILITE HOME IMAGE \ LAST_E_CMD LAST_E_LEN LD_PRELOAD MISC_FUNCTIONS_ARGS MOPREFIX \ - NORMAL PKGDIR PKGUSE PKG_LOGDIR PKG_TMPDIR \ + NOCOLOR NORMAL PKGDIR PKGUSE PKG_LOGDIR PKG_TMPDIR \ PORTAGE_ACTUAL_DISTDIR PORTAGE_ARCHLIST \ PORTAGE_BASHRC PORTAGE_BASHRCS_SOURCED \ PORTAGE_BINPKG_TAR_OPTS PORTAGE_BINPKG_TMPFILE PORTAGE_BUILDDIR \ diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index e210fedb5..2967beafe 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -46,7 +46,7 @@ from portage import digraph from portage.const import NEWS_LIB_PATH import _emerge.help -import portage.xpak, commands, errno, re, socket, time, types +import portage.xpak, commands, errno, re, socket, time from portage.output import blue, bold, colorize, darkblue, darkgreen, darkred, green, \ nc_len, red, teal, turquoise, xtermTitle, \ xtermTitleReset, yellow @@ -71,7 +71,6 @@ from portage.sets import load_default_config, SETPREFIX from portage.sets.base import InternalPackageSet from itertools import chain, izip -from UserDict import DictMixin try: import cPickle as pickle @@ -293,8 +292,8 @@ def countdown(secs=5, doing="Starting"): # formats a size given in bytes nicely def format_size(mysize): - if type(mysize) not in [types.IntType,types.LongType]: - return str(mysize) + if isinstance(mysize, basestring): + return mysize if 0 != mysize % 1024: # Always round up to the next kB so that it doesn't show 0 kB when # some small file still needs to be fetched. @@ -2485,6 +2484,10 @@ class EbuildFetcher(SpawnProcess): # the config instance in the subproccess. fetch_env = os.environ.copy() + nocolor = settings.get("NOCOLOR") + if nocolor is not None: + fetch_env["NOCOLOR"] = nocolor + fetch_env["PORTAGE_NICENESS"] = "0" if self.prefetch: fetch_env["PORTAGE_PARALLEL_FETCHONLY"] = "1" @@ -4034,7 +4037,7 @@ class Dependency(SlotObject): if self.depth is None: self.depth = 0 -class BlockerCache(DictMixin): +class BlockerCache(portage.cache.mappings.MutableMapping): """This caches blockers of installed packages so that dep_check does not have to be done for every single installed package on every invocation of emerge. The cache is invalidated whenever it is detected that something @@ -4192,11 +4195,6 @@ class BlockerCache(DictMixin): """ return self.BlockerData(*self._cache_data["blockers"][cpv]) - def keys(self): - """This needs to be implemented so that self.__repr__() doesn't raise - an AttributeError.""" - return list(self) - class BlockerDB(object): def __init__(self, root_config): @@ -5090,9 +5088,10 @@ class depgraph(object): # dependencies so that things like --fetchonly can still # function despite collisions. pass - else: + elif not previously_added: self._slot_pkg_map[pkg.root][pkg.slot_atom] = pkg self.mydbapi[pkg.root].cpv_inject(pkg) + self._filtered_trees[pkg.root]["porttree"].dbapi._clear_cache() if not pkg.installed: # Allow this package to satisfy old-style virtuals in case it @@ -8929,6 +8928,20 @@ class depgraph(object): return False except portage.exception.InvalidDependString: pass + in_graph = self._depgraph._slot_pkg_map[ + self._root].get(pkg.slot_atom) + if in_graph is None: + # Mask choices for packages which are not the highest visible + # version within their slot (since they usually trigger slot + # conflicts). + highest_visible, in_graph = self._depgraph._select_package( + self._root, pkg.slot_atom) + if pkg != highest_visible: + return False + elif in_graph != pkg: + # Mask choices for packages that would trigger a slot + # conflict with a previously selected package. + return False return True def _dep_expand(self, atom): diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 729bbd06f..e4245ed2c 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -4,7 +4,7 @@ # $Id$ -VERSION="$Rev: 9373 $"[6:-2] + "-svn" +VERSION="$Rev: 12601 $"[6:-2] + "-svn" # =========================================================================== # START OF IMPORTS -- START OF IMPORTS -- START OF IMPORTS -- START OF IMPORT @@ -28,7 +28,6 @@ try: import commands from time import sleep from random import shuffle - import UserDict from itertools import chain, izip import platform import warnings @@ -7293,7 +7292,7 @@ from portage.dbapi.bintree import bindbapi, binarytree from portage.dbapi.vartree import vardbapi, vartree, dblink from portage.dbapi.porttree import close_portdbapi_caches, portdbapi, portagetree -class FetchlistDict(UserDict.DictMixin): +class FetchlistDict(portage.cache.mappings.Mapping): """This provide a mapping interface to retrieve fetch lists. It's used to allow portage.manifest.Manifest to access fetch lists via a standard mapping interface rather than use the dbapi directly.""" @@ -7313,10 +7312,17 @@ class FetchlistDict(UserDict.DictMixin): def has_key(self, pkg_key): """Returns true if the given package exists within pkgdir.""" return pkg_key in self + + def __iter__(self): + return iter(self.portdb.cp_list(self.cp, mytree=self.mytree)) + def keys(self): """Returns keys for all packages within pkgdir""" return self.portdb.cp_list(self.cp, mytree=self.mytree) + if sys.hexversion >= 0x3000000: + keys = __iter__ + def pkgmerge(mytbz2, myroot, mysettings, mydbapi=None, vartree=None, prev_mtimes=None, blockers=None): """will merge a .tbz2 file, returning a list of runtime dependencies diff --git a/pym/portage/cache/mappings.py b/pym/portage/cache/mappings.py index 010eb7f8e..5fe836daa 100644 --- a/pym/portage/cache/mappings.py +++ b/pym/portage/cache/mappings.py @@ -1,14 +1,174 @@ -# Copyright: 2005 Gentoo Foundation +# Copyright: 2005-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 # Author(s): Brian Harring (ferringb@gentoo.org) -# License: GPL2 # $Id$ +__all__ = ["Mapping", "MutableMapping", "UserDict", "ProtectedDict", + "LazyLoad", "slot_dict_class"] + import sys -import UserDict import warnings import weakref -class ProtectedDict(UserDict.DictMixin): +class Mapping(object): + """ + In python-3.0, the UserDict.DictMixin class has been replaced by + Mapping and MutableMapping from the collections module, but 2to3 + doesn't currently account for this change: + + http://bugs.python.org/issue2876 + + As a workaround for the above issue, use this class as a substitute + for UserDict.DictMixin so that code converted via 2to3 will run. + """ + + def __iter__(self): + return self.iterkeys() + + def keys(self): + return list(self.__iter__()) + + def has_key(self, key): + warnings.warn("portage.cache.mappings.Mapping.has_key() " + \ + "is deprecated, use the in operator instead", DeprecationWarning) + return key in self + + def __contains__(self, key): + try: + value = self[key] + except KeyError: + return False + return True + + def iteritems(self): + for k in self: + yield (k, self[k]) + + def iterkeys(self): + return self.__iter__() + + def itervalues(self): + for _, v in self.iteritems(): + yield v + + def values(self): + return [v for _, v in self.iteritems()] + + def items(self): + return list(self.iteritems()) + + def get(self, key, default=None): + try: + return self[key] + except KeyError: + return default + + def __repr__(self): + return repr(dict(self.iteritems())) + + def __len__(self): + return len(self.keys()) + + if sys.hexversion >= 0x3000000: + items = iteritems + keys = __iter__ + values = itervalues + +class MutableMapping(Mapping): + """ + A mutable vesion of the Mapping class. + """ + + def clear(self): + for key in self.keys(): + del self[key] + + def setdefault(self, key, default=None): + try: + return self[key] + except KeyError: + self[key] = default + return default + + def pop(self, key, *args): + if len(args) > 1: + raise TypeError("pop expected at most 2 arguments, got " + \ + repr(1 + len(args))) + try: + value = self[key] + except KeyError: + if args: + return args[0] + raise + del self[key] + return value + + def popitem(self): + try: + k, v = self.iteritems().next() + except StopIteration: + raise KeyError('container is empty') + del self[k] + return (k, v) + + def update(self, other=None, **kwargs): + if other is None: + pass + elif hasattr(other, 'iteritems'): + for k, v in other.iteritems(): + self[k] = v + elif hasattr(other, 'keys'): + for k in other.keys(): + self[k] = other[k] + else: + for k, v in other: + self[k] = v + if kwargs: + self.update(kwargs) + +class UserDict(MutableMapping): + """ + Use this class as a substitute for UserDict.UserDict so that + code converted via 2to3 will run: + + http://bugs.python.org/issue2876 + """ + + def __init__(self, dict=None, **kwargs): + self.data = {} + if dict is not None: + self.update(dict) + if kwargs: + self.update(kwargs) + + def __repr__(self): + return repr(self.data) + + def __contains__(self, key): + return key in self.data + + def __iter__(self): + return iter(self.data) + + def __len__(self): + return len(self.data) + + def __getitem__(self, key): + return self.data[key] + + def __setitem__(self, key, item): + self.data[key] = item + + def __delitem__(self, key): + del self.data[key] + + def clear(self): + self.data.clear() + + if sys.hexversion >= 0x3000000: + keys = __iter__ + +class ProtectedDict(MutableMapping): """ given an initial dict, this wraps that dict storing changes in a secondary dict, protecting the underlying dict from changes @@ -52,11 +212,6 @@ class ProtectedDict(UserDict.DictMixin): if k not in self.blacklist and k not in self.new: yield k - - def keys(self): - return list(self.__iter__()) - - def __contains__(self, key): return key in self.new or (key not in self.blacklist and key in self.orig) @@ -68,9 +223,8 @@ class ProtectedDict(UserDict.DictMixin): if sys.hexversion >= 0x3000000: keys = __iter__ - items = iteritems -class LazyLoad(UserDict.DictMixin): +class LazyLoad(Mapping): """ Lazy loading of values for a dict """ @@ -90,16 +244,11 @@ class LazyLoad(UserDict.DictMixin): self.pull = None return self.d[key] - def __iter__(self): - return iter(self.keys()) - - def keys(self): - if self.pull != None: + if self.pull is not None: self.d.update(self.pull()) self.pull = None - return self.d.keys() - + return iter(self.d) def has_key(self, key): warnings.warn("portage.cache.mappings.LazyLoad.has_key() is " @@ -118,7 +267,6 @@ class LazyLoad(UserDict.DictMixin): if sys.hexversion >= 0x3000000: keys = __iter__ - items = iteritems _slot_dict_classes = weakref.WeakValueDictionary() @@ -235,6 +383,9 @@ def slot_dict_class(keys, prefix="_val_"): return hasattr(self, self._prefix + k) def has_key(self, k): + warnings.warn("portage.cache.mappings.SlotDict.has_key()" + \ + " is deprecated, use the in operator instead", + DeprecationWarning) return k in self def pop(self, key, *args): diff --git a/pym/portage/cache/sql_template.py b/pym/portage/cache/sql_template.py index e5903cd67..47bef9124 100644 --- a/pym/portage/cache/sql_template.py +++ b/pym/portage/cache/sql_template.py @@ -280,3 +280,4 @@ class SQLDatabase(template.database): if sys.hexversion >= 0x3000000: items = iteritems + keys = __iter__ diff --git a/pym/portage/dep.py b/pym/portage/dep.py index 831a8a324..04817068c 100644 --- a/pym/portage/dep.py +++ b/pym/portage/dep.py @@ -18,7 +18,7 @@ # "a? ( b? ( z ) ) -- Valid # -import re, sys, types +import re, sys import weakref from itertools import chain import portage.exception @@ -230,7 +230,7 @@ def use_reduce(deparray, uselist=[], masklist=[], matchall=0, excludeall=[]): while mydeparray: head = mydeparray.pop(0) - if type(head) == types.ListType: + if not isinstance(head, basestring): additions = use_reduce(head, uselist, masklist, matchall, excludeall) if additions: rlist.append(additions) diff --git a/pym/portage/env/config.py b/pym/portage/env/config.py index c990d9f0e..b6efdbecf 100644 --- a/pym/portage/env/config.py +++ b/pym/portage/env/config.py @@ -1,12 +1,15 @@ # config.py -- Portage Config -# Copyright 2007 Gentoo Foundation +# Copyright 2007-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id$ -from UserDict import UserDict +__all__ = ["ConfigLoaderKlass", "GenericFile", "PackageKeywordsFile", + "PackageUseFile", "PackageMaskFile", "PortageModulesFile"] + +from portage.cache.mappings import UserDict from portage.env.loaders import KeyListFileLoader, KeyValuePairFileLoader, ItemFileLoader -class ConfigLoaderKlass(UserDict, object): +class ConfigLoaderKlass(UserDict): """ A base class stub for things to inherit from. Users may want a non-file backend. @@ -29,9 +32,6 @@ class ConfigLoaderKlass(UserDict, object): self.data, self.errors = self._loader.load() - def __iter__(self): - return iter(self.data) - class GenericFile(UserDict): """ Inherits from ConfigLoaderKlass, attempts to use all known loaders diff --git a/pym/portage/locks.py b/pym/portage/locks.py index 912b2a32f..ddd39323f 100644 --- a/pym/portage/locks.py +++ b/pym/portage/locks.py @@ -7,7 +7,7 @@ __all__ = ["lockdir", "unlockdir", "lockfile", "unlockfile", \ "hardlock_name", "hardlink_is_mine", "hardlink_lockfile", \ "unhardlink_lockfile", "hardlock_cleanup"] -import errno, os, stat, time, types +import errno, os, stat, time from portage.exception import DirectoryNotFound, FileNotFound, \ InvalidData, TryAgain, OperationNotPermitted, PermissionDenied from portage.data import portage_gid @@ -36,12 +36,12 @@ def lockfile(mypath, wantnewlockfile=0, unlinkfile=0, if not mypath: raise InvalidData("Empty path given") - if type(mypath) == types.StringType and mypath[-1] == '/': + if isinstance(mypath, basestring) and mypath[-1] == '/': mypath = mypath[:-1] - if type(mypath) == types.FileType: + if hasattr(mypath, 'fileno'): mypath = mypath.fileno() - if type(mypath) == types.IntType: + if isinstance(mypath, int): lockfilename = mypath wantnewlockfile = 0 unlinkfile = 0 @@ -52,8 +52,8 @@ def lockfile(mypath, wantnewlockfile=0, unlinkfile=0, unlinkfile = 1 else: lockfilename = mypath - - if type(mypath) == types.StringType: + + if isinstance(mypath, basestring): if not os.path.exists(os.path.dirname(mypath)): raise DirectoryNotFound(os.path.dirname(mypath)) preexisting = os.path.exists(lockfilename) @@ -87,7 +87,7 @@ def lockfile(mypath, wantnewlockfile=0, unlinkfile=0, finally: os.umask(old_mask) - elif type(mypath) == types.IntType: + elif isinstance(mypath, int): myfd = mypath else: @@ -143,7 +143,7 @@ def lockfile(mypath, wantnewlockfile=0, unlinkfile=0, raise - if type(lockfilename) == types.StringType and \ + if isinstance(lockfilename, basestring) and \ myfd != HARDLINK_FD and _fstat_nlink(myfd) == 0: # The file was deleted on us... Keep trying to make one... os.close(myfd) @@ -188,7 +188,8 @@ def unlockfile(mytuple): return True # myfd may be None here due to myfd = mypath in lockfile() - if type(lockfilename) == types.StringType and not os.path.exists(lockfilename): + if isinstance(lockfilename, basestring) and \ + not os.path.exists(lockfilename): writemsg("lockfile does not exist '%s'\n" % lockfilename,1) if myfd is not None: os.close(myfd) @@ -200,7 +201,7 @@ def unlockfile(mytuple): unlinkfile = 1 locking_method(myfd,fcntl.LOCK_UN) except OSError: - if type(lockfilename) == types.StringType: + if isinstance(lockfilename, basestring): os.close(myfd) raise IOError("Failed to unlock file '%s'\n" % lockfilename) @@ -231,7 +232,7 @@ def unlockfile(mytuple): # why test lockfilename? because we may have been handed an # fd originally, and the caller might not like having their # open fd closed automatically on them. - if type(lockfilename) == types.StringType: + if isinstance(lockfilename, basestring): os.close(myfd) return True diff --git a/pym/portage/tests/bin/setup_env.py b/pym/portage/tests/bin/setup_env.py index 274d72654..388428a7c 100644 --- a/pym/portage/tests/bin/setup_env.py +++ b/pym/portage/tests/bin/setup_env.py @@ -1,7 +1,7 @@ # setup_env.py -- Make sure bin subdir has sane env for testing # Copyright 2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Id: test_dep_getcpv.py 6182 2007-03-06 07:35:22Z antarus $ +# $Id$ import os, shutil, sys from os.path import dirname, abspath, join diff --git a/pym/portage/tests/bin/test_dobin.py b/pym/portage/tests/bin/test_dobin.py index b6ca12c72..70a97cb0a 100644 --- a/pym/portage/tests/bin/test_dobin.py +++ b/pym/portage/tests/bin/test_dobin.py @@ -1,7 +1,7 @@ # test_dobin.py -- Portage Unit Testing Functionality # Copyright 2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Id: test_dep_getcpv.py 6182 2007-03-06 07:35:22Z antarus $ +# $Id$ from setup_env import * diff --git a/pym/portage/tests/bin/test_dodir.py b/pym/portage/tests/bin/test_dodir.py index 988b67b8d..1035152ce 100644 --- a/pym/portage/tests/bin/test_dodir.py +++ b/pym/portage/tests/bin/test_dodir.py @@ -1,7 +1,7 @@ # test_dodir.py -- Portage Unit Testing Functionality # Copyright 2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Id: test_dodir.py 6182 2007-03-06 07:35:22Z antarus $ +# $Id$ from setup_env import * diff --git a/pym/portage/tests/dep/test_dep_getusedeps.py b/pym/portage/tests/dep/test_dep_getusedeps.py index 99a17b80d..82649e243 100644 --- a/pym/portage/tests/dep/test_dep_getusedeps.py +++ b/pym/portage/tests/dep/test_dep_getusedeps.py @@ -1,7 +1,7 @@ # test_dep_getusedeps.py -- Portage Unit Testing Functionality # Copyright 2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Id: test_dep_getslot.py 5794 2007-01-27 18:16:08Z antarus $ +# $Id$ from portage.tests import TestCase from portage.dep import dep_getusedeps diff --git a/pym/portage/tests/env/config/test_PackageKeywordsFile.py b/pym/portage/tests/env/config/test_PackageKeywordsFile.py index fb053153b..228ce4a82 100644 --- a/pym/portage/tests/env/config/test_PackageKeywordsFile.py +++ b/pym/portage/tests/env/config/test_PackageKeywordsFile.py @@ -1,7 +1,7 @@ # test_PackageKeywordsFile.py -- Portage Unit Testing Functionality # Copyright 2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Id: test_PackageKeywordsFile.py 6182 2007-03-06 07:35:22Z antarus $ +# $Id$ from portage.tests import TestCase from portage.env.config import PackageKeywordsFile diff --git a/pym/portage/tests/env/config/test_PackageMaskFile.py b/pym/portage/tests/env/config/test_PackageMaskFile.py index 4000f1807..dca8002bc 100644 --- a/pym/portage/tests/env/config/test_PackageMaskFile.py +++ b/pym/portage/tests/env/config/test_PackageMaskFile.py @@ -1,7 +1,7 @@ # test_PackageMaskFile.py -- Portage Unit Testing Functionality # Copyright 2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Id: test_PackageMaskFile.py 6182 2007-03-06 07:35:22Z antarus $ +# $Id$ import os diff --git a/pym/portage/tests/env/config/test_PackageUseFile.py b/pym/portage/tests/env/config/test_PackageUseFile.py index 93474b6f7..f6eb38846 100644 --- a/pym/portage/tests/env/config/test_PackageUseFile.py +++ b/pym/portage/tests/env/config/test_PackageUseFile.py @@ -1,7 +1,7 @@ # test_PackageUseFile.py -- Portage Unit Testing Functionality # Copyright 2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Id: test_PackageUseFile.py 6182 2007-03-06 07:35:22Z antarus $ +# $Id$ import os from portage.tests import TestCase diff --git a/pym/portage/tests/news/test_NewsItem.py b/pym/portage/tests/news/test_NewsItem.py index fef66b022..f6c59e6a2 100644 --- a/pym/portage/tests/news/test_NewsItem.py +++ b/pym/portage/tests/news/test_NewsItem.py @@ -1,7 +1,7 @@ # test_NewsItem.py -- Portage Unit Testing Functionality # Copyright 2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Id: test_varExpand.py 5596 2007-01-12 08:08:53Z antarus $ +# $Id$ import os from portage.tests import TestCase diff --git a/pym/portage/tests/process/__init__.py b/pym/portage/tests/process/__init__.py index a4a87a461..21d15a4bf 100644 --- a/pym/portage/tests/process/__init__.py +++ b/pym/portage/tests/process/__init__.py @@ -1,3 +1,3 @@ # Copyright 1998-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Id: __init__.py 6870 2007-06-19 07:22:18Z zmedico $ +# $Id$ diff --git a/pym/portage/tests/process/test_poll.py b/pym/portage/tests/process/test_poll.py index 4ab67674e..ebcc822ef 100644 --- a/pym/portage/tests/process/test_poll.py +++ b/pym/portage/tests/process/test_poll.py @@ -1,6 +1,6 @@ # Copyright 1998-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Id: test_spawn.py 8474 2007-11-09 03:35:38Z zmedico $ +# $Id$ import errno, os, sys import fcntl diff --git a/pym/portage/tests/sets/files/testConfigFileSet.py b/pym/portage/tests/sets/files/testConfigFileSet.py index 7d588fbc3..5a54e6a78 100644 --- a/pym/portage/tests/sets/files/testConfigFileSet.py +++ b/pym/portage/tests/sets/files/testConfigFileSet.py @@ -1,7 +1,7 @@ # testConfigFileSet.py -- Portage Unit Testing Functionality # Copyright 2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Id: testShell.py 7363 2007-07-22 23:21:14Z zmedico $ +# $Id$ import tempfile, os diff --git a/pym/portage/tests/sets/files/testStaticFileSet.py b/pym/portage/tests/sets/files/testStaticFileSet.py index 71c47dc1b..57a8c58cd 100644 --- a/pym/portage/tests/sets/files/testStaticFileSet.py +++ b/pym/portage/tests/sets/files/testStaticFileSet.py @@ -1,7 +1,7 @@ # testStaticFileSet.py -- Portage Unit Testing Functionality # Copyright 2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Id: testShell.py 7363 2007-07-22 23:21:14Z zmedico $ +# $Id$ import tempfile, os diff --git a/pym/portage/util.py b/pym/portage/util.py index e2a32b0aa..1a8acd7f0 100644 --- a/pym/portage/util.py +++ b/pym/portage/util.py @@ -282,7 +282,10 @@ def grabfile_package(myfilename, compatlevel=0, recursive=0): pkgs=grabfile(myfilename, compatlevel, recursive=recursive) for x in range(len(pkgs)-1, -1, -1): pkg = pkgs[x] - if pkg[0] in '-*': # -atom *pkg for packages file + # for packages and package.mask files + if pkg[:1] == "-": + pkg = pkg[1:] + if pkg[:1] == "*": pkg = pkg[1:] if not isvalidatom(pkg): writemsg("--- Invalid atom in %s: %s\n" % (myfilename, pkgs[x]), -- 2.26.2