# package sets, the latter doesn't make sense for some sets like "system"
# or "security" and therefore isn't supported by them.
_operations = ["merge"]
-
+ description = "generic package set"
+
def __init__(self, name):
self._name = name
self._atoms = set()
return True
return False
+ def getMetadata(self, key):
+ if hasattr(self, key.lower()):
+ return getattr(self, key.lower())
+ else:
+ return ""
+
class EditablePackageSet(PackageSet):
def getAtoms(self):
from portage.sets.dbapi import EverythingSet
rValue = set()
- rValue.add(StaticFileSet("world", os.path.join(root, PRIVATE_PATH, "world")))
+ worldset = StaticFileSet("world", os.path.join(root, PRIVATE_PATH, "world"))
+ worldset.description = "Set of packages that were directly installed"
+ rValue.add(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))
l = [s for s in l.union(l2) if s.getName() in sys.argv[1:]]
for x in l:
print x.getName()+":"
+ print "DESCRIPTION = %s" % x.getMetadata("Description")
for n in sorted(x.getAtoms()):
print "- "+n
print
class EverythingSet(PackageSet):
_operations = ["merge", "unmerge"]
-
+ description = "Package set containing all installed packages"
+
def __init__(self, name, vdbapi):
super(EverythingSet, self).__init__(name)
self._db = vdbapi
self._db = portdbapi
self._category = category
self._check = only_visible
+ if only_visible:
+ s="visible"
+ else:
+ s="all"
+ self.description = "Package set containing %s packages of category %s" % (s, self._category)
def load(self):
myatoms = []
# Distributed under the terms of the GNU General Public License v2
# $Id$
-from portage.util import grabfile_package, grabdict_package, write_atomic
+from portage.util import grabfile, grabfile_package, grabdict_package, write_atomic
import os
from portage.sets import PackageSet, EditablePackageSet
super(StaticFileSet, self).__init__(name)
self._filename = filename
self._mtime = None
+ self.description = "Package set loaded from file %s" % self._filename
+ metadata = grabfile(self._filename + ".metadata")
+ key = None
+ for line in metadata:
+ if len(line) == 0 and key != None:
+ setattr(self, key, " ".join(value))
+ key = None
+ elif line[-1] == ":" and key == None:
+ key = line[:-1].lower()
+ value = []
+ elif key != None:
+ value.append(line)
+ else:
+ pass
def write(self):
write_atomic(self._filename, "\n".join(self._atoms)+"\n")
def __init__(self, name, filename):
super(ConfigFileSet, self).__init__(name)
self._filename = filename
+ self.description = "Package set generated from %s" % self._filename
def load(self):
self._setAtoms(grabdict_package(self._filename, recursive=True).keys())
def __init__(self, name, profile_paths):
super(PackagesSystemSet, self).__init__(name)
self._profile_paths = profile_paths
+ self.description = "System packages for profile %s" % self._profile_paths[-1]
def load(self):
mylist = [grabfile_package(os.path.join(x, "packages")) for x in self._profile_paths]
_operations = ["merge"]
_skip_applied = False
+ description = "package set that includes all packages possibly affected by a GLSA"
+
def __init__(self, name, settings, vardbapi, portdbapi):
super(SecuritySet, self).__init__(name)
self._settings = settings
class NewGlsaSet(SecuritySet):
_skip_applied = True
+ description = "Package set that includes all packages possibly affected by an unapplied GLSA"
class AffectedSet(SecuritySet):
+ description = "Package set that includes all packages affected by an unapplied GLSA"
+
def useGlsa(self, myglsa):
return myglsa.isVulnerable()
class NewAffectedSet(AffectedSet):
_skip_applied = True
+ description = "Package set that includes all packages affected by an unapplied GLSA"
def __init__(self, name, command):
super(CommandOutputSet, self).__init__(name)
self._command = command
+ self.description = "Package set generated from output of '%s'" % self._command
def load(self):
pipe = subprocess.Popen(self._command, stdout=subprocess.PIPE, shell=True)