[libvirt-jenkins-ci PATCH 2/3] lcitool: Refactor varmap generation a bit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Some values don't depend on whether the underlying OS user deb or
rpm as the package format, so we can set them in common code.

Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx>
---
 guests/lcitool | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/guests/lcitool b/guests/lcitool
index 209380a..b72abec 100755
--- a/guests/lcitool
+++ b/guests/lcitool
@@ -646,9 +646,16 @@ class Application:
 
     def _dockerfile_build_varmap(self, facts, mappings, pip_mappings, projects, cross_arch):
         if facts["package_format"] == "deb":
-            return self._dockerfile_build_varmap_deb(facts, mappings, pip_mappings, projects, cross_arch)
+            varmap = self._dockerfile_build_varmap_deb(facts, mappings, pip_mappings, projects, cross_arch)
         if facts["package_format"] == "rpm":
-            return self._dockerfile_build_varmap_rpm(facts, mappings, pip_mappings, projects, cross_arch)
+            varmap = self._dockerfile_build_varmap_rpm(facts, mappings, pip_mappings, projects, cross_arch)
+
+        varmap["package_manager"] = facts["package_manager"]
+
+        if cross_arch:
+            varmap["cross_abi"] = Util.native_arch_to_abi(cross_arch)
+
+        return varmap
 
     def _dockerfile_build_varmap_deb(self, facts, mappings, pip_mappings, projects, cross_arch):
         package_format = facts["package_format"]
@@ -700,7 +707,6 @@ class Application:
         pip_pkg_align = " \\\n" + (" " * len("RUN pip3 "))
 
         varmap = {}
-        varmap["package_manager"] = package_manager
         varmap["pkgs"] = pkg_align[1:] + pkg_align.join(sorted(set(pkgs.values())))
 
         if cross_arch:
@@ -712,7 +718,6 @@ class Application:
             pkg_names = [p + ":" + deb_arch for p in cross_pkgs.values()]
             pkg_names.append(gcc)
             varmap["cross_pkgs"] = pkg_align[1:] + pkg_align.join(sorted(set(pkg_names)))
-            varmap["cross_abi"] = abi
             varmap["cross_lib"] = lib
 
         if pip_pkgs:
@@ -771,11 +776,9 @@ class Application:
         pip_pkg_align = " \\\n" + (" " * len("RUN pip3 "))
 
         varmap = {}
-        varmap["package_manager"] = package_manager
         varmap["pkgs"] = pkg_align[1:] + pkg_align.join(sorted(set(pkgs.values())))
 
         if cross_arch:
-            varmap["cross_abi"] = Util.native_arch_to_abi(cross_arch)
             varmap["cross_pkgs"] = pkg_align[1:] + pkg_align.join(sorted(set(cross_pkgs.values())))
 
         if pip_pkgs:
-- 
2.25.1





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux