[projects/pld-builder.new] install: erase only conflicting packages that are actually installed
arekm
arekm at pld-linux.org
Wed Aug 12 11:46:06 CEST 2026
commit e1545b44bf8b01c019ef2cbb2e7563c34362fb3d
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Wed Aug 12 10:21:22 2026 +0200
install: erase only conflicting packages that are actually installed
Conflict reports name the candidate too, and one name outside the rpm db
failed the whole poldek --erase batch. From the tomcat9 build, where the
chroot had java-eclipse-jdt and the BR asked for java-eclipse-jdt8:
error: java-eclipse-jdt8-4.20-3.noarch (cnfl java-eclipse-jdt) conflicts
with installed java-eclipse-jdt-4.38-1.noarch
error: Failed dependencies:
java-eclipse-jdt conflicts with java-eclipse-jdt8-4.20-3.noarch
removing: java-eclipse-jdt java-eclipse-jdt8
error: java-eclipse-jdt8: no such package
package removal failed
Erasing java-eclipse-jdt alone would have worked.
Names go through rpm --whatprovides, the way rpm itself matches Conflicts,
so a BuildConflicts capability resolves to its provider package. An empty
rpm answer means the query failed and is an error, not "nothing installed".
Broken since 0a33171 (2026-04-16), which batched the removals into one poldek
call and turned a tolerated "no such package" into a fatal error.
PLD_Builder/install.py | 28 +++++++++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
---
diff --git a/PLD_Builder/install.py b/PLD_Builder/install.py
index ccd561a..a258b96 100644
--- a/PLD_Builder/install.py
+++ b/PLD_Builder/install.py
@@ -88,14 +88,40 @@ def upgrade_from_batch(r, b):
logbuf.close()
return True
+def installed_providers(names):
+ """Return installed packages providing any of names, or None if the rpm
+ query itself failed. A name may be a plain package name or a capability
+ (BuildConflicts can name either); --whatprovides matches the way rpm
+ resolves Conflicts."""
+ names = set(names)
+ if not names:
+ return set()
+ f = chroot.popen("rpm -q --whatprovides --queryformat '%%{NAME}\\n' %s" % ' '.join(sorted(names)),
+ user = "root", encoding = "utf-8")
+ lines = [l.strip() for l in f]
+ f.close()
+ # healthy rpm prints a line for every queried name (a provider name or
+ # a "no package provides" message); no output means the query failed
+ if not lines:
+ return None
+ # message lines contain spaces, package names cannot
+ return set(l for l in lines if l and ' ' not in l)
+
def uninstall(conflicting, b):
b.log_line("uninstalling conflicting packages")
- killset, err = close_killset(conflicting)
+ # poldek names the installed side of a conflict, rpm the candidate side;
+ # only the former can be erased, and one bogus name fails the whole batch
+ installed = installed_providers(conflicting)
+ if installed is None:
+ b.log_line("error: cannot query rpm database in chroot")
+ return False
+ killset, err = close_killset(installed)
if err:
util.append_to(b.logfile, err)
b.log_line("error: conflicting packages uninstallation failed")
return False
if not killset:
+ b.log_line("no conflicting packages installed")
return True
pkgs = ' '.join(sorted(killset))
b.log_line("removing: %s" % pkgs)
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/projects/pld-builder.new.git/commitdiff/44916a7a9112928736ec2b65b4fa58a90bc5828c
More information about the pld-cvs-commit
mailing list