summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pym/portage/sets/__init__.py14
-rw-r--r--pym/portage/sets/dbapi.py8
-rw-r--r--pym/portage/sets/files.py17
-rw-r--r--pym/portage/sets/profiles.py1
-rw-r--r--pym/portage/sets/security.py6
-rw-r--r--pym/portage/sets/shell.py1
6 files changed, 43 insertions, 4 deletions
diff --git a/pym/portage/sets/__init__.py b/pym/portage/sets/__init__.py
index ceebab5a2..72e8b2091 100644
--- a/pym/portage/sets/__init__.py
+++ b/pym/portage/sets/__init__.py
@@ -18,7 +18,8 @@ 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"]
-
+ description = "generic package set"
+
def __init__(self, name):
self._name = name
self._atoms = set()
@@ -59,6 +60,12 @@ class PackageSet(object):
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):
@@ -107,7 +114,9 @@ def make_default_sets(configroot, root, profile_paths, settings=None,
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))
@@ -156,6 +165,7 @@ if __name__ == "__main__":
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
diff --git a/pym/portage/sets/dbapi.py b/pym/portage/sets/dbapi.py
index a1b064b57..1b2520ef6 100644
--- a/pym/portage/sets/dbapi.py
+++ b/pym/portage/sets/dbapi.py
@@ -8,7 +8,8 @@ from portage.sets import PackageSet
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
@@ -32,6 +33,11 @@ class CategorySet(PackageSet):
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 = []
diff --git a/pym/portage/sets/files.py b/pym/portage/sets/files.py
index d79571c57..921d04b8c 100644
--- a/pym/portage/sets/files.py
+++ b/pym/portage/sets/files.py
@@ -2,7 +2,7 @@
# 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
@@ -14,6 +14,20 @@ class StaticFileSet(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")
@@ -31,6 +45,7 @@ class ConfigFileSet(PackageSet):
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())
diff --git a/pym/portage/sets/profiles.py b/pym/portage/sets/profiles.py
index 14394598e..55b7942f5 100644
--- a/pym/portage/sets/profiles.py
+++ b/pym/portage/sets/profiles.py
@@ -13,6 +13,7 @@ class PackagesSystemSet(PackageSet):
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]
diff --git a/pym/portage/sets/security.py b/pym/portage/sets/security.py
index cf4af0940..3bc9cbca4 100644
--- a/pym/portage/sets/security.py
+++ b/pym/portage/sets/security.py
@@ -13,6 +13,8 @@ class SecuritySet(PackageSet):
_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
@@ -53,10 +55,14 @@ class SecuritySet(PackageSet):
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"
diff --git a/pym/portage/sets/shell.py b/pym/portage/sets/shell.py
index baef6dee0..2383dba81 100644
--- a/pym/portage/sets/shell.py
+++ b/pym/portage/sets/shell.py
@@ -12,6 +12,7 @@ class CommandOutputSet(PackageSet):
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)