[projects/pld-builder.new] experimental php version blacklisting based on build context

glen glen at pld-linux.org
Fri May 8 21:19:30 CEST 2015


commit a306e34b96e67da438363e3a09dc6c757935d533
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Fri May 8 22:17:11 2015 +0300

    experimental php version blacklisting based on build context

 PLD_Builder/install.py |  2 +-
 PLD_Builder/request.py | 44 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+), 1 deletion(-)
---
diff --git a/PLD_Builder/install.py b/PLD_Builder/install.py
index c517088..8870cc1 100644
--- a/PLD_Builder/install.py
+++ b/PLD_Builder/install.py
@@ -191,7 +191,7 @@ def install_br(r, b):
     br = string.strip(nbr)
 
     b.log_line("installing BR: %s" % br)
-    res = chroot.run("poldek --noask --caplookup -Q -v --upgrade %s" % br,
+    res = chroot.run("set -x; poldek --noask --caplookup -Q -v --upgrade %s %s" % (b.ignores(), br),
             user = "root",
             logfile = b.logfile)
     if res != 0:
diff --git a/PLD_Builder/request.py b/PLD_Builder/request.py
index 3735e0c..5e9c87c 100644
--- a/PLD_Builder/request.py
+++ b/PLD_Builder/request.py
@@ -340,6 +340,50 @@ class Batch:
             "--define '_builddir %{_topdir}/BUILD' "
         return rpmdefs + rpmopts
 
+    def php_ignores(self):
+        # transform php package name (52) to version (5.2)
+        def php_name_to_ver(v):
+            return '.'.join(list(v))
+
+        # transform php version (5.2) to package name (52)
+        def php_ver_to_name(v):
+            return v.replace('.', '')
+
+        # available php versions in distro
+        php_versions = ['5.2', '5.3', '5.4', '5.5', '5.6']
+
+        # current version if -D php_suffix is present
+        php_version = php_name_to_ver(defines['php_suffix'])
+
+        # remove current php version
+        php_versions.remove(php_version)
+
+        # map them to poldek ignores
+        # always ignore hhvm
+        res = ['hhvm']
+        for v in map(php_ver_to_name, php_versions):
+            res.append("php%s-*" % v)
+
+        return res
+
+    # build ignore package list
+    # currently only php ignore is filled based on build context
+    def ignore_list(self):
+        ignores = []
+
+        # add php version based ignores
+        if self.defines.has_key('php_suffix'):
+            ignores.extend(self.php_ignores())
+
+        # return empty string if the list is empty
+        if len(ignores) == 0:
+            return ""
+
+        def add_ignore(s):
+            return "--ignore=%s" % s
+
+        return " ".join(map(add_ignore, ignores))
+
     def kernel_string(self):
         r = ""
         if self.kernel != "":
================================================================

---- gitweb:

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



More information about the pld-cvs-commit mailing list