From b66cb43f493aa68ec29ada2bd679080636daddc5 Mon Sep 17 00:00:00 2001 From: Marius Mauch Date: Wed, 13 Jun 2007 17:29:03 +0000 Subject: Add portageq command to list preserved libs svn path=/main/trunk/; revision=6835 --- bin/portageq | 28 +++++++++++++++++++++++----- 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): """ 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): + """ + 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) -- cgit v1.2.3-1-g7c22