diff options
author | Sam James <sam@gentoo.org> | 2022-03-05 05:57:25 +0000 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2022-04-13 04:05:45 +0100 |
commit | eecd073d274c6d669f324cbb31151789d32f87fb (patch) | |
tree | d78534bf72a33d80b95b30595f731707b7d1becf | |
parent | .github: add pypy3.8, pypy3.9 to CI (diff) | |
download | portage-eecd073d274c6d669f324cbb31151789d32f87fb.tar.gz portage-eecd073d274c6d669f324cbb31151789d32f87fb.tar.bz2 portage-eecd073d274c6d669f324cbb31151789d32f87fb.zip |
autoclean: only enable for global updates and depcleans
Closes: https://bugs.gentoo.org/792195
Signed-off-by: Sam James <sam@gentoo.org>
Closes: https://github.com/gentoo/portage/pull/795
Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r-- | cnf/make.globals | 2 | ||||
-rw-r--r-- | lib/_emerge/actions.py | 22 | ||||
-rw-r--r-- | lib/portage/dbapi/vartree.py | 24 |
3 files changed, 22 insertions, 26 deletions
diff --git a/cnf/make.globals b/cnf/make.globals index 69b365f71..f42cffe8b 100644 --- a/cnf/make.globals +++ b/cnf/make.globals @@ -101,7 +101,7 @@ EMERGE_WARNING_DELAY="10" # Automatically clean installed packages after they are updated. # This option will be removed and forced to yes. -AUTOCLEAN="yes" +AUTOCLEAN="no" PORTAGE_BZIP2_COMMAND="bzip2" diff --git a/lib/_emerge/actions.py b/lib/_emerge/actions.py index f82069f9a..e697459c8 100644 --- a/lib/_emerge/actions.py +++ b/lib/_emerge/actions.py @@ -672,12 +672,6 @@ def action_build( ldpath_mtimes, autoclean=1, ) - else: - portage.writemsg_stdout( - colorize("WARN", "WARNING:") - + " AUTOCLEAN is disabled. This can cause serious" - + " problems due to overlapping packages.\n" - ) return retval @@ -776,6 +770,15 @@ def action_depclean( # relatively safe to ignore missing deps when only asked to remove # specific packages. + # Force autoclean for depcleans (but not purges), as it was changed + # to default off to not run it on every unmerge. + # bug #792195 + if action == "depclean": + settings.unlock() + settings["AUTOCLEAN"] = "yes" + settings.backup_changes("AUTOCLEAN") + settings.lock() + msg = [] if ( "preserve-libs" not in settings.features @@ -3386,6 +3389,13 @@ def run_action(emerge_config): # Reload the whole config from scratch. load_emerge_config(emerge_config=emerge_config) + # Let's autoclean if we applied updates, rather than always doing it + # bug #792195 + emerge_config.target_config.settings.unlock() + emerge_config.target_config.settings["AUTOCLEAN"] = "yes" + emerge_config.target_config.settings.backup_changes("AUTOCLEAN") + emerge_config.target_config.settings.lock() + xterm_titles = "notitles" not in emerge_config.target_config.settings.features if xterm_titles: xtermTitle("emerge") diff --git a/lib/portage/dbapi/vartree.py b/lib/portage/dbapi/vartree.py index 863efe9cc..190bf8c92 100644 --- a/lib/portage/dbapi/vartree.py +++ b/lib/portage/dbapi/vartree.py @@ -5086,21 +5086,18 @@ class dblink: emerge_log = self._emerge_log - # If we have any preserved libraries then autoclean - # is forced so that preserve-libs logic doesn't have + # We always autoclean now for the current package-case for simplicity. + # If it were conditional, we'd always need to do it when any preserved-libs, + # so that preserve-libs logic doesn't have # to account for the additional complexity of the # AUTOCLEAN=no mode. - autoclean = self.settings.get("AUTOCLEAN", "yes") == "yes" or preserve_paths - - if autoclean: - emerge_log(_(" >>> AUTOCLEAN: %s") % (slot_atom,)) + emerge_log(_(" >>> AUTOCLEAN: %s") % (slot_atom,)) others_in_slot.append(self) # self has just been merged for dblnk in list(others_in_slot): if dblnk is self: continue - if not (autoclean or dblnk.mycpv == self.mycpv or reinstall_self): - continue + showMessage(_(">>> Safely unmerging already-installed instance...\n")) emerge_log(_(" === Unmerging... (%s)") % (dblnk.mycpv,)) others_in_slot.remove(dblnk) # dblnk will unmerge itself now @@ -5130,17 +5127,6 @@ class dblink: self.unlockdb() showMessage(_(">>> Original instance of package unmerged safely.\n")) - if len(others_in_slot) > 1: - showMessage( - colorize("WARN", _("WARNING:")) - + _( - " AUTOCLEAN is disabled. This can cause serious" - " problems due to overlapping packages.\n" - ), - level=logging.WARN, - noiselevel=-1, - ) - # We hold both directory locks. self.dbdir = self.dbpkgdir self.lockdb() |