diff options
-rw-r--r-- | cnf/make.globals | 1 | ||||
-rw-r--r-- | man/make.conf.5 | 8 | ||||
-rw-r--r-- | pym/portage/dbapi/vartree.py | 28 | ||||
-rw-r--r-- | pym/portage/package/ebuild/_config/special_env_vars.py | 2 |
4 files changed, 25 insertions, 14 deletions
diff --git a/cnf/make.globals b/cnf/make.globals index b1569885b..c35429143 100644 --- a/cnf/make.globals +++ b/cnf/make.globals @@ -64,6 +64,7 @@ FEATURES="assume-digests binpkg-logs # transition from compiling python modules in live file system to compiling # them in src_install() function. 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. diff --git a/man/make.conf.5 b/man/make.conf.5 index 688263709..7d07344bd 100644 --- a/man/make.conf.5 +++ b/man/make.conf.5 @@ -896,6 +896,14 @@ is used to sync the local portage tree when `emerge \-\-sync` is run. .br Defaults to rsync://rsync.gentoo.org/gentoo\-portage .TP +\fBUNINSTALL_IGNORE\fR = \fI[space delimited list of fnmatch patterns]\fR +This variable prevents uninstallation of files that match +specific \fBfnmatch\fR(3) patterns. In order to ignore file +collisions with these files at install time, the same patterns +can be added to the \fBCOLLISION_IGNORE\fR variable. +.br +Defaults to "/lib/modules/*". +.TP \fBUSE\fR = \fI[space delimited list of USE items]\fR This variable contains options that control the build behavior of several packages. More information in \fBebuild\fR(5). Possible USE values diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index b8405d483..60bab73ba 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -2064,7 +2064,9 @@ class dblink(object): #process symlinks second-to-last, directories last. mydirs = set() - modprotect = os.path.join(self._eroot, "lib/modules/") + + uninstall_ignore = portage.util.shlex_split( + self.settings.get("UNINSTALL_IGNORE", "")) def unlink(file_name, lstatobj): if bsd_chflags: @@ -2171,6 +2173,18 @@ class dblink(object): if lstatobj is None: show_unmerge("---", unmerge_desc["!found"], file_type, obj) continue + + f_match = obj[len(eroot)-1:] + ignore = False + for pattern in uninstall_ignore: + if fnmatch.fnmatch(f_match, pattern): + ignore = True + break + + if ignore: + show_unmerge("---", unmerge_desc["cfgpro"], file_type, obj) + continue + # don't use EROOT, CONTENTS entries already contain EPREFIX if obj.startswith(real_root): relative_path = obj[real_root_len:] @@ -2214,18 +2228,6 @@ class dblink(object): continue elif relative_path in cfgfiledict: stale_confmem.append(relative_path) - # next line includes a tweak to protect modules from being unmerged, - # but we don't protect modules from being overwritten if they are - # upgraded. We effectively only want one half of the config protection - # functionality for /lib/modules. For portage-ng both capabilities - # should be able to be independently specified. - # TODO: For rebuilds, re-parent previous modules to the new - # installed instance (so they are not orphans). For normal - # uninstall (not rebuild/reinstall), remove the modules along - # with all other files (leave no orphans). - if obj.startswith(modprotect): - show_unmerge("---", unmerge_desc["cfgpro"], file_type, obj) - continue # Don't unlink symlinks to directories here since that can # remove /lib and /usr/lib symlinks. diff --git a/pym/portage/package/ebuild/_config/special_env_vars.py b/pym/portage/package/ebuild/_config/special_env_vars.py index 4795e88bc..a01c17714 100644 --- a/pym/portage/package/ebuild/_config/special_env_vars.py +++ b/pym/portage/package/ebuild/_config/special_env_vars.py @@ -164,7 +164,7 @@ environ_filter += [ "RESUMECOMMAND", "RESUMECOMMAND_FTP", "RESUMECOMMAND_HTTP", "RESUMECOMMAND_HTTPS", "RESUMECOMMAND_RSYNC", "RESUMECOMMAND_SFTP", - "SYNC", "USE_EXPAND_HIDDEN", "USE_ORDER", + "SYNC", "UNINSTALL_IGNORE", "USE_EXPAND_HIDDEN", "USE_ORDER", ] environ_filter = frozenset(environ_filter) |