From 6f065d4911cd72a33e01fa8100d53ed16c6e7e4e Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 21 Sep 2012 14:19:18 -0700 Subject: Add preserve-libs for stable branch (not default) 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 | 15 ++++++++------- bin/portageq | 3 --- cnf/make.globals | 4 ---- pym/_emerge/actions.py | 5 +++-- pym/_emerge/main.py | 23 +++++++++-------------- pym/portage/_sets/__init__.py | 4 ++++ pym/portage/const.py | 13 +------------ pym/portage/dbapi/vartree.py | 13 +++---------- 8 files changed, 28 insertions(+), 52 deletions(-) diff --git a/NEWS b/NEWS index 461daff29..b8985b404 100644 --- 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 ------------- diff --git a/bin/portageq b/bin/portageq index 849a86620..3e7577b9c 100755 --- a/bin/portageq +++ b/bin/portageq @@ -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']) diff --git a/cnf/make.globals b/cnf/make.globals index dad28118c..bc69abe12 100644 --- a/cnf/make.globals +++ b/cnf/make.globals @@ -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" diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py index 8e75dad46..4b16dc9dc 100644 --- a/pym/_emerge/actions.py +++ b/pym/_emerge/actions.py @@ -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") diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py index aff1d3733..d19b7950f 100644 --- a/pym/_emerge/main.py +++ b/pym/_emerge/main.py @@ -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) diff --git a/pym/portage/_sets/__init__.py b/pym/portage/_sets/__init__.py index f92c2cba6..de3e8e45e 100644 --- a/pym/portage/_sets/__init__.py +++ b/pym/portage/_sets/__init__.py @@ -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") diff --git a/pym/portage/const.py b/pym/portage/const.py index 1e3da36f2..3242861cf 100644 --- a/pym/portage/const.py +++ b/pym/portage/const.py @@ -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) diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index 1dadd3cbb..7d6d6a8f1 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -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 -- cgit v1.2.3-1-g7c22