From 1d65230670d47d552f33f73ba822a79d12e5a53b Mon Sep 17 00:00:00 2001 From: Marius Mauch Date: Fri, 26 Oct 2007 00:55:26 +0000 Subject: [PATCH] use a @ prefix for sets, and replace world/system with their real prefixed names if found on the commandline svn path=/main/trunk/; revision=8301 --- pym/_emerge/__init__.py | 13 ++++++++++--- pym/portage/sets/__init__.py | 4 +++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index 1bd0ae72a..2aaf5fb33 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -52,7 +52,7 @@ import portage.exception from portage.data import secpass from portage.util import normalize_path as normpath from portage.util import writemsg -from portage.sets import SetConfig, make_default_config +from portage.sets import SetConfig, make_default_config, SETPREFIX from portage.sets.profiles import PackagesSystemSet as SystemSet from portage.sets.base import InternalPackageSet from portage.sets.files import WorldSet @@ -6496,8 +6496,15 @@ def emerge_main(): # only expand sets for actions taking package arguments oldargs = myfiles[:] if myaction not in ["search", "metadata", "sync"]: + newargs = [] + for a in myfiles: + if a in ("system", "world"): + newargs.append(SETPREFIX+a) + else: + newargs.append(a) + myfiles = newargs for s in settings.sets: - if s in myfiles: + if SETPREFIX+s in myfiles: # TODO: check if the current setname also resolves to a package name if myaction in ["unmerge", "prune", "clean", "depclean"] and not packagesets[s].supportsOperation("unmerge"): print "emerge: the given set %s does not support unmerge operations" % s @@ -6509,7 +6516,7 @@ def emerge_main(): mysets[s] = settings.sets[s] for e in settings.sets[s].errors: print e - myfiles.remove(s) + myfiles.remove(SETPREFIX+s) # Need to handle empty sets specially, otherwise emerge will react # with the help message for empty argument lists if oldargs and not myfiles: diff --git a/pym/portage/sets/__init__.py b/pym/portage/sets/__init__.py index 8497e1587..4d5ce25b5 100644 --- a/pym/portage/sets/__init__.py +++ b/pym/portage/sets/__init__.py @@ -10,6 +10,8 @@ DEFAULT_SETS = ["world", "system", "everything", "security"] \ +["package_"+x for x in ["mask", "unmask", "use", "keywords"]] del x +SETPREFIX = "@" + class SetConfigError(Exception): pass @@ -96,7 +98,7 @@ class SetConfig(SafeConfigParser): myset = self.getSetsWithAliases()[setname] myatoms = myset.getAtoms() for n in myset.getNonAtoms(): - if n in self.aliases: + if n[0] == SETPREFIX and n[1:] in self.aliases: myatoms.update(self.getSetAtoms(n)) return myatoms -- 2.26.2