aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2022-12-01 06:31:53 +0000
committerSam James <sam@gentoo.org>2022-12-01 07:08:02 +0000
commit66f64d08ffb13ca24cfc11584fe667b1c391fbe8 (patch)
treea2f88ae82a63bdc55d426be5225e4f2ace4751c3
parentNEWS: add placeholders for 3.0.41 (diff)
downloadportage-66f64d08.tar.gz
portage-66f64d08.tar.bz2
portage-66f64d08.zip
vartree: use ewarn if merging despite collisions
Use ewarn, not eerror, if merge is going ahead despite collisions. Collisions aren't always fatal - say if FEATURES="protect-owned unmerge-orphans" and the collision is over an orphaned file. This changes the colors used once we discover that all relevant files are orphaned to be warning rather than an error, to make it less scary and distinguish from other situations. Closes: https://github.com/gentoo/portage/pull/952 Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r--NEWS4
-rw-r--r--lib/portage/dbapi/vartree.py18
2 files changed, 18 insertions, 4 deletions
diff --git a/NEWS b/NEWS
index d64fcac91..a907526aa 100644
--- a/NEWS
+++ b/NEWS
@@ -2,7 +2,9 @@ portage-3.0.41 (UNRELEASED)
--------------
Features:
-* TODO
+* vartree: On collisions which are non-fatal (e.g. orphaned files when using
+ FEATURES="protect-owned"), Portage now has friendlier output
+ by using ewarn rather than eerror.
Bug fixes:
* TODO
diff --git a/lib/portage/dbapi/vartree.py b/lib/portage/dbapi/vartree.py
index a95d60691..139424c0a 100644
--- a/lib/portage/dbapi/vartree.py
+++ b/lib/portage/dbapi/vartree.py
@@ -4187,6 +4187,9 @@ class dblink:
def _eqawarn(self, phase, lines):
self._elog("eqawarn", phase, lines)
+ def _ewarn(self, phase, lines):
+ self._elog("ewarn", phase, lines)
+
def _eerror(self, phase, lines):
self._elog("eerror", phase, lines)
@@ -4388,6 +4391,9 @@ class dblink:
],
)
+ def ewarn(lines):
+ self._ewarn("preinst", lines)
+
def eerror(lines):
self._eerror("preinst", lines)
@@ -4884,6 +4890,10 @@ class dblink:
finally:
self.unlockdb()
+ collision_message_type = ewarn
+ if collision_protect or protect_owned and owners:
+ collision_message_type = eerror
+
for pkg, owned_files in owners.items():
msg = []
msg.append(pkg_info_strs[pkg.mycpv])
@@ -4892,10 +4902,10 @@ class dblink:
"\t%s" % os.path.join(destroot, f.lstrip(os.path.sep))
)
msg.append("")
- eerror(msg)
+ collision_message_type(msg)
if not owners:
- eerror(
+ collision_message_type(
[_("None of the installed" " packages claim the file(s)."), ""]
)
@@ -4935,10 +4945,12 @@ class dblink:
" If necessary, refer to your elog "
"messages for the whole content of the above message."
)
- eerror(wrap(msg, 70))
if abort:
+ eerror(wrap(msg, 70))
return 1
+ else:
+ ewarn(wrap(msg, 70))
# The merge process may move files out of the image directory,
# which causes invalidation of the .installed flag.