TODO for portage-2.2 release:
=============================
- package set integration in emerge (genone)
-- user interface for preserve-libs FEATURE (genone, fuzzyray?)
+x user interface for preserve-libs FEATURE (genone, fuzzyray?)
+- resolve the eselect-news situation (genone)
+
+(- denotes open/incomplete tasks, x denotes completed tasks)
existing_node = None
myeb = None
usepkgonly = "--usepkgonly" in self.myopts
+ empty = "empty" in self.myparams
+ selective = "selective" in self.myparams
for find_existing_node in True, False:
if existing_node:
break
for db, pkg_type, built, installed, db_keys in dbs:
if existing_node:
break
- if installed and matched_packages:
+ if installed and not find_existing_node and \
+ (matched_packages or empty):
# We only need to select an installed package here
# if there is no other choice.
continue
"empty" not in self.myparams and \
vardb.cpv_exists(cpv):
break
+ if installed and not (selective or not myarg):
+ break
# Metadata accessed above is cached internally by
# each db in order to optimize visibility checks.
# Now that all possible checks visibility checks
setconfigpaths = [os.path.join(GLOBAL_CONFIG_PATH, "sets.conf")]
setconfigpaths.append(os.path.join(settings["PORTDIR"], "sets.conf"))
setconfigpaths += [os.path.join(x, "sets.conf") for x in settings["PORDIR_OVERLAY"].split()]
- setconfigpaths.append(os.path.join(os.sep, settings["PORTAGE_CONFIGROOT"], USER_CONFIG_PATH, "sets.conf"))
+ setconfigpaths.append(os.path.join(settings["PORTAGE_CONFIGROOT"],
+ USER_CONFIG_PATH.lstrip(os.path.sep), "sets.conf"))
#setconfig = SetConfig(setconfigpaths, settings, trees[settings["ROOT"]])
setconfig = make_default_config(settings, trees[settings["ROOT"]])
del setconfigpaths
""" Update the global library->consumer map for the given vdb instance. """
obj_dict = {}
for cpv in self._dbapi.cpv_all():
- needed_list = self._dbapi.aux_get(cpv, ["NEEDED"])[0]
- for l in needed_list.split("\n"):
+ needed_list = grabfile(self._dbapi.getpath(cpv, "NEEDED"))
+ for l in needed_list:
mysplit = l.split()
if len(mysplit) < 2:
continue
sc.set("config", "class", "portage.sets.files.ConfigFileSet")
sc.set("config", "multiset", "true")
- sc.add_section("user_sets")
- sc.set("user_sets", "class", "portage.sets.files.StaticFileSet")
- sc.set("user_sets", "multiset", "true")
+ sc.add_section("user-sets")
+ sc.set("user-sets", "class", "portage.sets.files.StaticFileSet")
+ sc.set("user-sets", "multiset", "true")
+
+ sc.add_section("rebuild-needed")
+ sc.set("rebuild-needed", "class", "portage.sets.dbapi.MissingLibraryConsumerSet")
return sc
# Distributed under the terms of the GNU General Public License v2
# $Id$
-from portage.versions import catsplit
+from portage.versions import catsplit, catpkgsplit
from portage.sets import PackageSet, SetConfigError
+from portage.dbapi.vartree import dblink
+from portage.util import grabfile
+
+import os
__all__ = ["CategorySet", "EverythingSet"]
rValue[myname] = myset
return rValue
multiBuilder = classmethod(multiBuilder)
+
+class LibraryConsumerSet(PackageSet):
+ _operations = ["merge", "unmerge"]
+
+ def __init__(self, vardbapi):
+ super(LibraryConsumerSet, self).__init__()
+ self.dbapi = vardbapi
+
+ def mapPathsToAtoms(self, paths):
+ rValue = set()
+ for cpv in self.dbapi.cpv_all():
+ mysplit = catsplit(cpv)
+ link = dblink(mysplit[0], mysplit[1], myroot=self.dbapi.root, \
+ mysettings=self.dbapi.settings, treetype='vartree', \
+ vartree=self.dbapi.vartree)
+ if paths.intersection(link.getcontents().keys()):
+ rValue.add("/".join(catpkgsplit(cpv)[:2]))
+ return rValue
+
+
+class PreservedLibraryConsumerSet(LibraryConsumerSet):
+ def load(self):
+ reg = self.dbapi.plib_registry
+ libmap = self.dbapi.libmap.get()
+ consumers = set()
+ if reg:
+ for libs in reg.getPreservedLibs().values():
+ for lib in libs:
+ paths = libmap.get(os.path.basename(lib), [])
+ consumers.update(paths)
+ else:
+ return
+ if not consumers:
+ return
+ self._setAtoms(self.mapPathsToAtoms(consumers))
+
+ def singleBuilder(cls, options, settings, trees):
+ return PreservedLibraryConsumerSet(trees["vartree"].dbapi)
+ singleBuilder = classmethod(singleBuilder)
+
+class MissingLibraryConsumerSet(LibraryConsumerSet):
+ _operations = ["merge", "unmerge"]
+
+ def load(self):
+ atoms = set()
+ consumers = set()
+ for lib in self.dbapi.libmap.get():
+ found=False
+ for searchdir in grabfile(os.path.join(os.sep, self.dbapi.root, "etc/ld.so.conf")):
+ if os.path.exists(os.path.join(searchdir, lib)):
+ found=True
+ break
+ if not found:
+ consumers.update(self.dbapi.libmap.get()[lib])
+ if not consumers:
+ return
+ self._setAtoms(self.mapPathsToAtoms(consumers))
+
+ def singleBuilder(cls, options, settings, trees):
+ return MissingLibraryConsumerSet(trees["vartree"].dbapi)
+ singleBuilder = classmethod(singleBuilder)