[projects/pld-builder.new] install: retry conflict removal until the BR check comes back clean

arekm arekm at pld-linux.org
Sun Aug 23 00:38:37 CEST 2026


commit d13b3ddae19a65dbec43f973449ed67b660235d3
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Sun Aug 23 00:26:42 2026 +0200

    install: retry conflict removal until the BR check comes back clean

 PLD_Builder/install.py | 68 ++++++++++++++++++++++++++------------------------
 1 file changed, 36 insertions(+), 32 deletions(-)
---
diff --git a/PLD_Builder/install.py b/PLD_Builder/install.py
index 2fa0359..eb183bb 100644
--- a/PLD_Builder/install.py
+++ b/PLD_Builder/install.py
@@ -211,44 +211,48 @@ def install_br(r, b):
         b.log_line("no BR needed")
         return True
 
-    nbr = ""
-    for bre in needed.keys():
-        nbr = nbr + " " + re.escape(bre)
-    br = nbr.strip()
     b.log_line("updating poldek cache...")
     chroot.run("poldek --up --upa", user = "root", logfile = b.logfile, nonet=False)
-    # check conflicts in BRed packages
-    b.log_line("checking conflicting packages in BRed packages")
-    f = chroot.popen("poldek --test --test --noask --caplookup -Q -v %s --pmopt='--nodigest' --upgrade %s" % (b.ignores(), br), user = "root", encoding = "utf-8", nonet=False)
-    # phonon-devel-4.3.1-1.i686 conflicts with qt4-phonon-devel-4.5.0-6.i686
-    # jdbc-stdext >= 2.0 is required by installed java-struts-1.3.10-1.noarch
-    # jmx is needed by (installed) java-commons-modeler-2.0-1.noarch
-    # poldek: file /usr/include/php/main/php_config.h from install of php82-devel-4:8.2.17-3.x86_64 conflicts with file from package php83-devel-4:8.3.7-1.x86_64
-    # poldek: php80-devel < 4:8.1 is obsoleted by (installed) php83-devel-4:8.3.7-1.x86_64
-    rx = re.compile(r".*(conflicts with|conflicts with file from package|is required by|is obsoleted by|is needed by)( installed| \(installed\)|) (?P<name>[^\s]+)-[^-]+-[^-]+($| .*)")
-    conflicting = {}
-    for l in f:
-        b.log_line("poldek: %s" % l.rstrip())
-        m = rx.search(l)
-        if m: conflicting[m.group('name')] = 1
-    f.close()
-    if len(conflicting) == 0:
-        b.log_line("no conflicts found")
-    else:
+    # one removal round can expose conflicts the previous check could not
+    # report: rpm's test stops at dependency errors before file conflicts
+    # are even checked, so re-check until clean
+    removal_rounds = 0
+    while True:
+        nbr = ""
+        for bre in needed.keys():
+            nbr = nbr + " " + re.escape(bre)
+        br = nbr.strip()
+        # check conflicts in BRed packages
+        b.log_line("checking conflicting packages in BRed packages")
+        f = chroot.popen("poldek --test --test --noask --caplookup -Q -v %s --pmopt='--nodigest' --upgrade %s" % (b.ignores(), br), user = "root", encoding = "utf-8", nonet=False)
+        # phonon-devel-4.3.1-1.i686 conflicts with qt4-phonon-devel-4.5.0-6.i686
+        # jdbc-stdext >= 2.0 is required by installed java-struts-1.3.10-1.noarch
+        # jmx is needed by (installed) java-commons-modeler-2.0-1.noarch
+        # poldek: file /usr/include/php/main/php_config.h from install of php82-devel-4:8.2.17-3.x86_64 conflicts with file from package php83-devel-4:8.3.7-1.x86_64
+        # poldek: php80-devel < 4:8.1 is obsoleted by (installed) php83-devel-4:8.3.7-1.x86_64
+        rx = re.compile(r".*(conflicts with|conflicts with file from package|is required by|is obsoleted by|is needed by)( installed| \(installed\)|) (?P<name>[^\s]+)-[^-]+-[^-]+($| .*)")
+        conflicting = {}
+        for l in f:
+            b.log_line("poldek: %s" % l.rstrip())
+            m = rx.search(l)
+            if m: conflicting[m.group('name')] = 1
+        f.close()
+        if len(conflicting) == 0:
+            b.log_line("no conflicts found")
+            break
+        removal_rounds += 1
+        if removal_rounds > 3:
+            b.log_line("error: conflicts still present after 3 removal rounds")
+            return False
         if not uninstall(conflicting, b):
             return False
 
-    # recheck BuildRequires since above uninstallation could remove some required deps
-    needed = get_missing_br(r, b);
-
-    if len(needed) == 0:
-        b.log_line("no BR needed")
-        return True
+        # recheck BuildRequires since above uninstallation could remove some required deps
+        needed = get_missing_br(r, b);
 
-    nbr = ""
-    for bre in needed.keys():
-        nbr = nbr + " " + re.escape(bre)
-    br = nbr.strip()
+        if len(needed) == 0:
+            b.log_line("no BR needed")
+            return True
 
     b.log_line("installing BR: %s" % br)
     res = chroot.run("set -x; poldek --noask --caplookup -Q -v %s --pmopt='--nodigest' --upgrade %s" % (b.ignores(), br),
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/pld-builder.new.git/commitdiff/d13b3ddae19a65dbec43f973449ed67b660235d3



More information about the pld-cvs-commit mailing list