implement the final part of FEATURES=preserved-libs and remove previously preserved...
authorMarius Mauch <genone@gentoo.org>
Mon, 3 Dec 2007 19:09:20 +0000 (19:09 -0000)
committerMarius Mauch <genone@gentoo.org>
Mon, 3 Dec 2007 19:09:20 +0000 (19:09 -0000)
svn path=/main/trunk/; revision=8821

bin/repoman
cnf/sets.conf
pym/_emerge/__init__.py
pym/portage/dbapi/vartree.py
pym/portage/sets/__init__.py

index f6ab04dc9a19772b9080be5371ec86afa4e233ab..e404a9159c12a2bfbd2380f070062c0c75352a96 100755 (executable)
@@ -313,6 +313,7 @@ qawarnings=[
 "IUSE.invalid",
 "KEYWORDS.stupid",
 "KEYWORDS.missing",
+"LICENSE.missing",
 "RESTRICT.invalid",
 "ebuild.minorsyn",
 "ebuild.badheader",
index 8f7852b857085a6876dbe085789ee6bd17b9af41..7b3f4e9b11b61b2befb4d628e9c7fcdfd770c500 100644 (file)
@@ -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
index 559a0c68562e7110d3387776cb350c8e80bf20f9..4af56b273f2efad8c90ace6108ca05c43f47b37c 100644 (file)
@@ -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)
index cc34a133ab30e61b2b5e0b4ff6564b1523bb261d..d75029dc69925d2c6db55b565dd5c7fe37052658 100644 (file)
@@ -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:
index 940aa10204da6be927627b1bdf26fd7a6202e0f6..30c2bff495711cc152b695440b9f4ee5d2fecc58 100644 (file)
@@ -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