diff options
author | Marius Mauch <genone@gentoo.org> | 2007-06-13 17:29:03 +0000 |
---|---|---|
committer | Marius Mauch <genone@gentoo.org> | 2007-06-13 17:29:03 +0000 |
commit | b66cb43f493aa68ec29ada2bd679080636daddc5 (patch) | |
tree | ec527b6314811bf35fccb1ae34d2e4a2e38cf0aa | |
parent | 69fbce664e8fbd9043e85c8680afae4d41a60923 (diff) | |
download | portage-b66cb43f493aa68ec29ada2bd679080636daddc5.tar.gz portage-b66cb43f493aa68ec29ada2bd679080636daddc5.tar.bz2 portage-b66cb43f493aa68ec29ada2bd679080636daddc5.zip |
Add portageq command to list preserved libs
svn path=/main/trunk/; revision=6835
-rwxr-xr-x | bin/portageq | 28 | ||||
-rw-r--r-- | pym/portage/dbapi/vartree.py | 4 |
2 files changed, 25 insertions, 7 deletions
diff --git a/bin/portageq b/bin/portageq index f4812a26e..968cc129a 100755 --- a/bin/portageq +++ b/bin/portageq @@ -44,7 +44,6 @@ import types # and will automaticly add a command by the same name as the function! # - def has_version(argv): """<root> <category/package> Return code 0 if it's available, 1 otherwise. @@ -294,6 +293,24 @@ def get_repo_path(argv): for arg in arvg[1:]: print portage.db[argv[0]]["porttree"].dbapi.getRepositoryPath(argv[1]) +def list_preserved_libs(argv): + """<root> + Print a list of libraries preserved during a package update in the form + package: path. Returns 0 if no preserved libraries could be found, + 1 otherwise. + """ + + if len(argv) != 1: + print "ERROR: wrong number of arguments" + sys.exit(2) + mylibs = portage.db[argv[0]]["vartree"].dbapi.plib_registry.getPreservedLibs() + rValue = 0 + for cpv in mylibs.keys(): + for path in mylibs[cpv]: + print "%s: %s" % (cpv, path) + rValue = 1 + return rValue + #----------------------------------------------------------------------------- # # DO NOT CHANGE CODE BEYOND THIS POINT - IT'S NOT NEEDED! @@ -311,11 +328,12 @@ def usage(argv): # Show our commands -- we do this by scanning the functions in this # file, and formatting each functions documentation. # - for name in globals().keys(): - # Drop python stuff, modules, and our own support functions. - if (name in ("usage", "__doc__", "__name__", "main", "os", "portage", "sys", "__builtins__", "types", "string","exithandler")): - continue + commands = [x for x in globals().keys() if x not in \ + ("usage", "__doc__", "__name__", "main", "os", "portage", \ + "sys", "__builtins__", "types", "string","exithandler")] + commands.sort() + for name in commands: # Drop non-functions obj = globals()[name] if (type(obj) != types.FunctionType): diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index 31834a628..f7a9defce 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -189,8 +189,8 @@ class vardbapi(dbapi): self._aux_cache_filename = os.path.join(self.root, CACHE_PATH.lstrip(os.path.sep), "vdb_metadata.pickle") - self.libmap = LibraryPackageMap(os.path.join(self.root, CACHE_PATH, "library_consumers"), self) - self.plib_registry = PreservedLibsRegistry(os.path.join(self.root, CACHE_PATH, "preserved_libs_registry")) + self.libmap = LibraryPackageMap(os.path.join(self.root, CACHE_PATH.lstrip(os.sep), "library_consumers"), self) + self.plib_registry = PreservedLibsRegistry(os.path.join(self.root, PRIVATE_PATH, "preserved_libs_registry")) def getpath(self, mykey, filename=None): rValue = os.path.join(self.root, VDB_PATH, mykey) |