[projects/pld-builder.new] Add rpm version detection for deps checking command

baggins baggins at pld-linux.org
Sat Jan 23 20:04:46 CET 2021


commit e6e9e8d0865ed23920eca170ef40f2dca0700f54
Author: Jan Rękorajski <baggins at pld-linux.org>
Date:   Sat Jan 23 20:04:01 2021 +0100

    Add rpm version detection for deps checking command

 PLD_Builder/install.py | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)
---
diff --git a/PLD_Builder/install.py b/PLD_Builder/install.py
index db16785..8d7a5c0 100644
--- a/PLD_Builder/install.py
+++ b/PLD_Builder/install.py
@@ -127,14 +127,29 @@ def uninstall_self_conflict(b):
     return True
 
 def install_br(r, b):
+    def is_rpmorg():
+        f = chroot.popen("rpm --version 2>&1")
+        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)\(.*')
 
         tmpdir = b.tmpdir()
-        rpmcommand = "rpmbuild --nobuild"
-        # TODO: detect rpm version and use the below for rpm 4.x
-        # rpmcommand = "rpmbuild --nobuild -br"
+        if is_rpmorg():
+            rpmcommand = "rpmbuild --nobuild -br"
+        else:
+            rpmcommand = "rpmbuild --nobuild"
         cmd = "set -e; TMPDIR=%(tmpdir)s %(rpmcommand) %(rpmdefs)s %(topdir)s/%(spec)s 2>&1" % {
             'rpmcommand': rpmcommand,
             'tmpdir': tmpdir,
================================================================

---- gitweb:

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



More information about the pld-cvs-commit mailing list