Add preserve-libs for stable branch (not default)
authorZac Medico <zmedico@gentoo.org>
Fri, 21 Sep 2012 21:19:18 +0000 (14:19 -0700)
committerZac Medico <zmedico@gentoo.org>
Fri, 21 Sep 2012 21:33:18 +0000 (14:33 -0700)
EAPI 5 supports automatic rebuilds via the slot-operator and sub-slots,
which makes preserve-libs much more user-friendly, since it makes
@preserved-rebuild unnecessary (also see bug #364425 for explanation of
@preserved-rebuild shortcomings). Therefore, enable preserve-libs for
the stable branch, but not by default. After EAPI 5 is widely adopted,
we can consider enabling preserve-libs by default.

NEWS
bin/portageq
cnf/make.globals
pym/_emerge/actions.py
pym/_emerge/main.py
pym/portage/_sets/__init__.py
pym/portage/const.py
pym/portage/dbapi/vartree.py

diff --git a/NEWS b/NEWS
index 461daff29f05ff8830a2ee368e7acacd6ec5960f..b8985b404958994655ec8f88fc69510acd9ffc23 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,18 +2,19 @@ News (mainly features/major bug fixes)
 
 portage-2.2
 -------------
-
-* Add link level dependency awareness to emerge --depclean and --prune actions
-  in order to protect against uninstallation of required libraries.
+* FEATURES=preserve-libs is enabled by default.
 * Add support for generic package sets (also see RELEASE-NOTES)
-* Add support for FEATURES=preserve-libs which preserves libraries when the
-  sonames change during upgrade or downgrade, and the @preserved-rebuild
-  package set which rebuilds consumers of preserved libraries.
 
-portage-2.1.11.19
+portage-2.1.11.20
 -------------
 * Add support for EAPI 5. Refer to the PMS EAPI Cheat Sheet, portage's html
   docs installed with USE=doc, or `man 5 ebuild` for more info about EAPI 5.
+* Add support for FEATURES=preserve-libs which preserves libraries when the
+  sonames change during upgrade or downgrade, and the @preserved-rebuild
+  package set which rebuilds consumers of preserved libraries.
+* Add link level dependency awareness to emerge --depclean and --prune actions
+  in order to protect against uninstallation of required libraries. Refer to
+  the --depclean-lib-check in the emerge(1) man page.
 
 portage-2.1.11
 -------------
index 849a866200c9d5c28a37967216218b6b92e83e16..3e7577b9c80bf2a3896318fe280c27ea3bd1a0b2 100755 (executable)
@@ -773,9 +773,6 @@ list_preserved_libs.uses_eroot = True
 # DO NOT CHANGE CODE BEYOND THIS POINT - IT'S NOT NEEDED!
 #
 
-if not portage.const._ENABLE_PRESERVE_LIBS:
-       del list_preserved_libs
-
 non_commands = frozenset(['elog', 'eval_atom_use',
        'exithandler', 'expand_new_virt', 'main',
        'usage', 'writemsg', 'writemsg_stdout'])
index dad28118c2a4f5265bdd804d42fe693a312ee2cf..bc69abe1287d5676d074a36e15195523535d6ca8 100644 (file)
@@ -66,10 +66,6 @@ FEATURES="assume-digests binpkg-logs
 COLLISION_IGNORE="/lib/modules/* *.py[co]"
 UNINSTALL_IGNORE="/lib/modules/*"
 
-# Enable preserve-libs for testing with portage versions that support it.
-# This setting is commented out for portage versions that don't support it.
-FEATURES="${FEATURES} preserve-libs"
-
 # Default chunksize for binhost comms
 PORTAGE_BINHOST_CHUNKSIZE="3000"
 
index 8e75dad466a932aacf6e4609c07e320480bd00e2..4b16dc9dc330ae36b11ea3ef86641abffcb73923 100644 (file)
@@ -31,7 +31,7 @@ from portage import shutil
 from portage import eapi_is_supported, _unicode_decode
 from portage.cache.cache_errors import CacheError
 from portage.const import GLOBAL_CONFIG_PATH
-from portage.const import _ENABLE_DYN_LINK_MAP, _DEPCLEAN_LIB_CHECK_DEFAULT
+from portage.const import _DEPCLEAN_LIB_CHECK_DEFAULT
 from portage.dbapi.dep_expand import dep_expand
 from portage.dbapi._expand_new_virt import expand_new_virt
 from portage.dep import Atom
@@ -544,7 +544,8 @@ def action_depclean(settings, trees, ldpath_mtimes,
        # specific packages.
 
        msg = []
-       if not _ENABLE_DYN_LINK_MAP:
+       if "preserve-libs" not in settings.features and \
+               not myopts.get("--depclean-lib-check", _DEPCLEAN_LIB_CHECK_DEFAULT) != "n":
                msg.append("Depclean may break link level dependencies. Thus, it is\n")
                msg.append("recommended to use a tool such as " + good("`revdep-rebuild`") + " (from\n")
                msg.append("app-portage/gentoolkit) in order to detect such breakage.\n")
index aff1d3733d59d2bc567293a7748a8158f1998ed5..d19b7950fd65db47ea4f4e9619b4893d64b9be52 100644 (file)
@@ -25,7 +25,6 @@ from portage.output import create_color_func
 good = create_color_func("GOOD")
 bad = create_color_func("BAD")
 
-from portage.const import _ENABLE_DYN_LINK_MAP
 import portage.elog
 import portage.util
 import portage.locks
@@ -468,6 +467,7 @@ def insert_optional_args(args):
                '--buildpkg'             : y_or_n,
                '--complete-graph'       : y_or_n,
                '--deep'       : valid_integers,
+               '--depclean-lib-check'   : y_or_n,
                '--deselect'             : y_or_n,
                '--binpkg-respect-use'   : y_or_n,
                '--fail-clean'           : y_or_n,
@@ -491,9 +491,6 @@ def insert_optional_args(args):
                '--usepkgonly'           : y_or_n,
        }
 
-       if _ENABLE_DYN_LINK_MAP:
-               default_arg_opts['--depclean-lib-check'] = y_or_n
-
        short_arg_opts = {
                'D' : valid_integers,
                'j' : valid_integers,
@@ -728,6 +725,12 @@ def parse_opts(tmpcmdline, silent=False):
                        "action" : "store"
                },
 
+               "--depclean-lib-check": {
+                       "help"    : "check for consumers of libraries before removing them",
+                       "type"    : "choice",
+                       "choices" : true_y_or_n
+               },
+
                "--deselect": {
                        "help"    : "remove atoms/sets from the world file",
                        "type"    : "choice",
@@ -977,13 +980,6 @@ def parse_opts(tmpcmdline, silent=False):
 
        }
 
-       if _ENABLE_DYN_LINK_MAP:
-               argument_options["--depclean-lib-check"] = {
-                       "help"    : "check for consumers of libraries before removing them",
-                       "type"    : "choice",
-                       "choices" : true_y_or_n
-               }
-
        from optparse import OptionParser
        parser = OptionParser()
        if parser.has_option("--help"):
@@ -1058,9 +1054,8 @@ def parse_opts(tmpcmdline, silent=False):
        else:
                myoptions.complete_graph = None
 
-       if _ENABLE_DYN_LINK_MAP:
-               if myoptions.depclean_lib_check in true_y:
-                       myoptions.depclean_lib_check = True
+       if myoptions.depclean_lib_check in true_y:
+               myoptions.depclean_lib_check = True
 
        if myoptions.exclude:
                bad_atoms = _find_bad_atoms(myoptions.exclude)
index f92c2cba669e1acd05483422d101ec9b7d2e68a8..de3e8e45e8ef788937cffcadcde8398be9bd52f8 100644 (file)
@@ -142,6 +142,10 @@ class SetConfig(object):
                parser.set("module-rebuild", "class", "portage.sets.dbapi.OwnerSet")
                parser.set("module-rebuild", "files", "/lib/modules")
 
+               parser.remove_section("preserved-rebuild")
+               parser.add_section("preserved-rebuild")
+               parser.set("preserved-rebuild", "class", "portage.sets.libs.PreservedLibraryConsumerSet")
+
                parser.remove_section("x11-module-rebuild")
                parser.add_section("x11-module-rebuild")
                parser.set("x11-module-rebuild", "class", "portage.sets.dbapi.OwnerSet")
index 1e3da36f2c09be3a2de84da0b847bc5db57495a5..3242861cf9a2befb06d82d1f357f42d7a0b1928f 100644 (file)
@@ -99,7 +99,7 @@ SUPPORTED_FEATURES       = frozenset([
                            "metadata-transfer", "mirror", "multilib-strict", "news",
                            "noauto", "noclean", "nodoc", "noinfo", "noman",
                            "nostrip", "notitles", "parallel-fetch", "parallel-install",
-                           "prelink-checksums",
+                           "prelink-checksums", "preserve-libs",
                            "protect-owned", "python-trace", "sandbox",
                            "selinux", "sesandbox", "sfperms",
                            "sign", "skiprocheck", "split-elog", "split-log", "splitdebug",
@@ -166,18 +166,7 @@ if "PORTAGE_OVERRIDE_EPREFIX" in os.environ:
 
 # Private constants for use in conditional code in order to minimize the diff
 # between branches.
-_ENABLE_DYN_LINK_MAP    = True
 _DEPCLEAN_LIB_CHECK_DEFAULT = True
-_ENABLE_PRESERVE_LIBS   = True
 _ENABLE_REPO_NAME_WARN  = True
 _ENABLE_SET_CONFIG      = True
 _ENABLE_INHERIT_CHECK   = True
-
-
-# The definitions above will differ between branches, so it's useful to have
-# common lines of diff context here in order to avoid merge conflicts.
-
-if _ENABLE_PRESERVE_LIBS:
-       SUPPORTED_FEATURES = set(SUPPORTED_FEATURES)
-       SUPPORTED_FEATURES.add("preserve-libs")
-       SUPPORTED_FEATURES = frozenset(SUPPORTED_FEATURES)
index 1dadd3cbb29acb3ae52b1ecf25323f3ec663d1b1..7d6d6a8f1f22ecbb0ad14889a4e3de0fa67989b9 100644 (file)
@@ -40,7 +40,6 @@ portage.proxy.lazyimport.lazyimport(globals(),
 
 from portage.const import CACHE_PATH, CONFIG_MEMORY_FILE, \
        PORTAGE_PACKAGE_ATOM, PRIVATE_PATH, VDB_PATH
-from portage.const import _ENABLE_DYN_LINK_MAP, _ENABLE_PRESERVE_LIBS
 from portage.dbapi import dbapi
 from portage.exception import CommandNotFound, \
        InvalidData, InvalidLocation, InvalidPackageName, \
@@ -172,15 +171,9 @@ class vardbapi(dbapi):
                self._counter_path = os.path.join(self._eroot,
                        CACHE_PATH, "counter")
 
-               self._plib_registry = None
-               if _ENABLE_PRESERVE_LIBS:
-                       self._plib_registry = PreservedLibsRegistry(settings["ROOT"],
-                               os.path.join(self._eroot, PRIVATE_PATH,
-                               "preserved_libs_registry"))
-
-               self._linkmap = None
-               if _ENABLE_DYN_LINK_MAP:
-                       self._linkmap = LinkageMap(self)
+               self._plib_registry = PreservedLibsRegistry(settings["ROOT"],
+                       os.path.join(self._eroot, PRIVATE_PATH, "preserved_libs_registry"))
+               self._linkmap = LinkageMap(self)
                self._owners = self._owners_db(self)
 
                self._cached_counter = None