[projects/pld-builder.new] Use the same commands for BuildConflicts resolution as for BuildRequires

baggins baggins at pld-linux.org
Fri Aug 20 10:55:07 CEST 2021


commit 9c20dc6ad410f043a0d2242a49616195be86537c
Author: Jan Rękorajski <baggins at pld-linux.org>
Date:   Fri Aug 20 10:54:00 2021 +0200

    Use the same commands for BuildConflicts resolution as for BuildRequires

 PLD_Builder/install.py | 43 ++++++++++++++++++++++++-------------------
 1 file changed, 24 insertions(+), 19 deletions(-)
---
diff --git a/PLD_Builder/install.py b/PLD_Builder/install.py
index d367da4..f1818c9 100644
--- a/PLD_Builder/install.py
+++ b/PLD_Builder/install.py
@@ -99,24 +99,43 @@ def uninstall(conflicting, b):
                 b.log_line("package %s removal failed" % k)
     return True
 
+def is_rpmorg():
+    f = chroot.popen("rpm --version 2>&1", encoding = "utf-8")
+    v = re.compile(r'(RPM version|rpm \(RPM\)) (?P<major>\d)\.(?P<minor>\d+)(\.\d+)?')
+    for l in f:
+        m = v.search(l)
+        if m:
+            major = int(m.group('major'))
+            minor = int(m.group('minor'))
+            if major == 4 and minor > 5:
+                f.close()
+                return True
+    f.close()
+    return False
+
 def uninstall_self_conflict(b):
     b.log_line("checking BuildConflict-ing packages")
-    f = chroot.popen("set -e; TMPDIR=%(tmpdir)s " \
-        "rpmbuild -bp --nobuild --short-circuit --define 'prep exit 0' %(rpmdefs)s %(topdir)s/%(spec)s 2>&1" % {
+    if is_rpmorg():
+        rpmcommand = "rpmbuild --nobuild -br"
+    else:
+        rpmcommand = "rpmbuild --nobuild"
+    cmd = "set -e; TMPDIR=%(tmpdir)s %(rpmcommand)s %(rpmdefs)s %(topdir)s/%(spec)s 2>&1" % {
+        'rpmcommand': rpmcommand,
         'tmpdir': b.tmpdir(),
-        'rpmdefs' : b.rpmbuild_opts(),
         'topdir' : b.get_topdir(),
+        'rpmdefs' : b.rpmbuild_opts(),
         'spec': b.spec,
-    }, encoding = "utf-8")
+    }
+    f = chroot.popen(cmd, encoding = "utf-8")
     # java-sun >= 1.5 conflicts with soprano-2.1.67-1.src
     # java-sun conflicts with soprano-2.1.67-1.src
     # plplot conflicts with plplot-5.15.0-4.x86_64
     rx = re.compile(r"\s+(?P<name>[\w-]+)\s+.*conflicts with [^\s]+-[^-]+-[^-]+\.[^.\s]+($| .*)")
     conflicting = {}
     for l in f:
+        b.log_line("rpm: %s" % l.rstrip())
         m = rx.search(l)
         if m:
-            b.log_line("rpmbuild: %s" % l.rstrip())
             conflicting[m.group('name')] = 1
     f.close()
     if len(conflicting) and not uninstall(conflicting, b):
@@ -125,20 +144,6 @@ def uninstall_self_conflict(b):
     return True
 
 def install_br(r, b):
-    def is_rpmorg():
-        f = chroot.popen("rpm --version 2>&1", encoding = "utf-8")
-        v = re.compile(r'(RPM version|rpm \(RPM\)) (?P<major>\d)\.(?P<minor>\d+)(\.\d+)?')
-        for l in f:
-            m = v.search(l)
-            if m:
-                major = int(m.group('major'))
-                minor = int(m.group('minor'))
-                if major == 4 and minor > 5:
-                    f.close()
-                    return True
-        f.close()
-        return False
-
     def get_missing_br(r, b):
         # ignore internal rpm dependencies, see lib/rpmns.c for list
         ignore_br = re.compile(r'^\s*(rpmlib|cpuinfo|getconf|uname|soname|user|group|mounted|diskspace|digest|gnupg|macro|envvar|running|sanitycheck|vcheck|signature|verify|exists|executable|readable|writable)\(.*')
================================================================

---- gitweb:

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



More information about the pld-cvs-commit mailing list