summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Mauch <genone@gentoo.org>2007-12-03 19:09:20 +0000
committerMarius Mauch <genone@gentoo.org>2007-12-03 19:09:20 +0000
commitd63fc90d72cae46824239af0f1e5158f0d029ee0 (patch)
tree833dc36cd8a447aadfb03f7b918c659c115e5a2c
parent12ff9528ba0a3e49aa52c543f3518f722208a890 (diff)
downloadportage-d63fc90d72cae46824239af0f1e5158f0d029ee0.tar.gz
portage-d63fc90d72cae46824239af0f1e5158f0d029ee0.tar.bz2
portage-d63fc90d72cae46824239af0f1e5158f0d029ee0.zip
implement the final part of FEATURES=preserved-libs and remove previously preserved libs that don't have any consumers left. Also fix the notice if preserved libs are found to use the preserved-rebuild package set instead of revdep-rebuild.
svn path=/main/trunk/; revision=8821
-rwxr-xr-xbin/repoman1
-rw-r--r--cnf/sets.conf5
-rw-r--r--pym/_emerge/__init__.py2
-rw-r--r--pym/portage/dbapi/vartree.py40
-rw-r--r--pym/portage/sets/__init__.py2
5 files changed, 46 insertions, 4 deletions
diff --git a/bin/repoman b/bin/repoman
index f6ab04dc9..e404a9159 100755
--- a/bin/repoman
+++ b/bin/repoman
@@ -313,6 +313,7 @@ qawarnings=[
"IUSE.invalid",
"KEYWORDS.stupid",
"KEYWORDS.missing",
+"LICENSE.missing",
"RESTRICT.invalid",
"ebuild.minorsyn",
"ebuild.badheader",
diff --git a/cnf/sets.conf b/cnf/sets.conf
index 8f7852b85..7b3f4e9b1 100644
--- a/cnf/sets.conf
+++ b/cnf/sets.conf
@@ -32,3 +32,8 @@ class = portage.sets.dbapi.EverythingSet
class = portage.sets.files.StaticFileSet
multiset = true
directory = /etc/portage/sets
+
+# Set to rebuild all packages that need a preserved lib that only remains due
+# to FEATURES=preserved-libs
+[preserved-rebuild]
+class = portage.sets.dbapi.PreservedConsumerSet
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py
index 559a0c685..4af56b273 100644
--- a/pym/_emerge/__init__.py
+++ b/pym/_emerge/__init__.py
@@ -5068,7 +5068,7 @@ def post_emerge(trees, mtimedb, retval):
print colorize("WARN", ">>>") + " package: %s" % cpv
for f in plibdata[cpv]:
print colorize("WARN", " * ") + " - %s" % f
- print "Use " + colorize("GOOD", "revdep-rebuild") + " to rebuild packages using these libraries"
+ print "Use " + colorize("GOOD", "emerge @preserved-rebuild") + " to rebuild packages using these libraries"
print "and then remerge the packages listed above."
sys.exit(retval)
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index cc34a133a..d75029dc6 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -1125,7 +1125,8 @@ class dblink(object):
self._unmerge_pkgfiles(pkgfiles, others_in_slot)
# Remove the registration of preserved libs for this pkg instance
- self.vartree.dbapi.plib_registry.unregister(self.mycpv, self.settings["SLOT"], self.settings["COUNTER"])
+ plib_registry = self.vartree.dbapi.plib_registry
+ plib_registry.unregister(self.mycpv, self.settings["SLOT"], self.settings["COUNTER"])
if myebuildpath:
ebuild_phase = "postrm"
@@ -1140,7 +1141,42 @@ class dblink(object):
# regenerate reverse NEEDED map
self.vartree.dbapi.libmap.update()
-
+
+ # remove preserved libraries that don't have any consumers left
+ # FIXME: this code is quite ugly and can likely be optimized in several ways
+ plib_dict = plib_registry.getPreservedLibs()
+ for cpv in plib_dict:
+ keeplist = []
+ plib_dict[cpv].sort()
+ for f in plib_dict[cpv]:
+ if not os.path.exists(f) or os.path.realpath(f) in keeplist:
+ continue
+ unlink_list = []
+ while os.path.islink(f):
+ if os.path.basename(f) in self.vartree.dbapi.libmap.get():
+ unlink_list = []
+ keeplist.append(os.path.realpath(f))
+ break
+ else:
+ unlink_list.append(f)
+ f = os.readlink(f)
+ if not os.path.islink(f) and not os.path.basename(f) in self.vartree.dbapi.libmap.get():
+ unlink_list.append(f)
+ for obj in unlink_list:
+ try:
+ if os.path.islink(f):
+ obj_type = "sym"
+ else:
+ obj_type = "obj"
+ writemsg_stdout("<<< !needed %s %s\n" % (obj_type, obj))
+ os.unlink(obj)
+ except OSError, e:
+ if e.errno == errno.ENOENT:
+ pass
+ else:
+ raise e
+ plib_registry.pruneNonExisting()
+
finally:
if builddir_lock:
try:
diff --git a/pym/portage/sets/__init__.py b/pym/portage/sets/__init__.py
index 940aa1020..30c2bff49 100644
--- a/pym/portage/sets/__init__.py
+++ b/pym/portage/sets/__init__.py
@@ -130,7 +130,7 @@ def make_default_config(settings, trees):
sc.set("user-sets", "multiset", "true")
sc.add_section("rebuild-needed")
- sc.set("rebuild-needed", "class", "portage.sets.dbapi.MissingLibraryConsumerSet")
+ sc.set("rebuild-needed", "class", "portage.sets.dbapi.PreservedLibraryConsumerSet")
return sc