[libvirt] [dockerfiles PATCH 2/4] refresh: Improve project handling

Andrea Bolognani abologna at redhat.com
Fri Aug 9 08:35:25 UTC 2019


Instead of adding native projects first and then coming back
to add MinGW projects at a later time, add all projects in a
single step.

Signed-off-by: Andrea Bolognani <abologna at redhat.com>
---
 refresh | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/refresh b/refresh
index 89c2818..b26a9f3 100755
--- a/refresh
+++ b/refresh
@@ -63,18 +63,15 @@ class Dockerfile:
         self.path = path
         stem = path.stem[len(Dockerfile.PREFIX):]
 
-        self.projects = []
         project_name = None
 
         for project in Dockerfile.PROJECTS:
             if stem.rfind(project + "-") >= 0:
                 project_name = project
                 stem = stem[len(project_name) + 1:]
-                for subproject in Dockerfile.PROJECTS[project]:
-                    self.projects += [subproject]
                 break
 
-        if self.projects == []:
+        if not project_name:
             raise Exception("File '{}' does not have any matching "
                             "project.".format(path))
 
@@ -93,15 +90,16 @@ class Dockerfile:
             self.os = stem
             self.cross_arch = None
 
-        # Fedora Rawhide is special in that we use it to perform MinGW
-        # builds, so we need to add the corresponding projects
-        if self.os == "fedora-rawhide":
-            mingw_projects = []
-            for subproject in self.projects:
-                if Dockerfile.PROJECTS[project_name][subproject]:
-                    mingw_projects += [subproject + "+mingw*"]
+        self.projects = []
+
+        for project in Dockerfile.PROJECTS[project_name]:
+            self.projects += [project]
+            # Fedora Rawhide is special in that we use it to perform MinGW
+            # builds, so we need to add the corresponding projects
+            if (self.os == "fedora-rawhide" and
+                Dockerfile.PROJECTS[project_name][project]):
+                self.projects += [project + "+mingw*"]
 
-            self.projects += mingw_projects
 
     def refresh(self, lcitool):
 
-- 
2.21.0




More information about the libvir-list mailing list