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

[libvirt] [dockerfiles PATCH v3 1/3] refresh: Learn how to deal with the project's name



Let's change the refresh script in order to take into consideration
Dockerfiles containing the project's name. This is needed in order to
add different projects to libvirt-dockerfiles.

An important change that deservers a mention here is that the PROJECTS
variable, part of Dockerfile class, has been added as a dictionary of
dictionaries as it has to store subprojects tied to a project, and each
of those subprojects may or may not be subject of a mingw build
(although this is not the case yet for libvirt, it may be for a other
projects, osinfo-db being one of them.

Together with this change, let's rename all the existent Dockerfiles to
mention their projects. So, 'buildenv-centos-7.Dockerfile' has been
renamed to 'buildenv-libvirt-centos-7.Dockerfile', for instance.

Signed-off-by: Fabiano Fidêncio <fidencio redhat com>
---
 ...le => buildenv-libvirt-centos-7.Dockerfile |  0
 ...libvirt-debian-10-cross-aarch64.Dockerfile |  0
 ...-libvirt-debian-10-cross-armv6l.Dockerfile |  0
 ...-libvirt-debian-10-cross-armv7l.Dockerfile |  0
 ...nv-libvirt-debian-10-cross-i686.Dockerfile |  0
 ...nv-libvirt-debian-10-cross-mips.Dockerfile |  0
 ...ibvirt-debian-10-cross-mips64el.Dockerfile |  0
 ...-libvirt-debian-10-cross-mipsel.Dockerfile |  0
 ...libvirt-debian-10-cross-ppc64le.Dockerfile |  0
 ...v-libvirt-debian-10-cross-s390x.Dockerfile |  0
 ...e => buildenv-libvirt-debian-10.Dockerfile |  0
 ...-libvirt-debian-9-cross-aarch64.Dockerfile |  0
 ...v-libvirt-debian-9-cross-armv6l.Dockerfile |  0
 ...v-libvirt-debian-9-cross-armv7l.Dockerfile |  0
 ...env-libvirt-debian-9-cross-mips.Dockerfile |  0
 ...libvirt-debian-9-cross-mips64el.Dockerfile |  0
 ...v-libvirt-debian-9-cross-mipsel.Dockerfile |  0
 ...-libvirt-debian-9-cross-ppc64le.Dockerfile |  0
 ...nv-libvirt-debian-9-cross-s390x.Dockerfile |  0
 ...le => buildenv-libvirt-debian-9.Dockerfile |  0
 ...ibvirt-debian-sid-cross-aarch64.Dockerfile |  0
 ...libvirt-debian-sid-cross-armv6l.Dockerfile |  0
 ...libvirt-debian-sid-cross-armv7l.Dockerfile |  0
 ...v-libvirt-debian-sid-cross-i686.Dockerfile |  0
 ...v-libvirt-debian-sid-cross-mips.Dockerfile |  0
 ...bvirt-debian-sid-cross-mips64el.Dockerfile |  0
 ...libvirt-debian-sid-cross-mipsel.Dockerfile |  0
 ...ibvirt-debian-sid-cross-ppc64le.Dockerfile |  0
 ...-libvirt-debian-sid-cross-s390x.Dockerfile |  0
 ... => buildenv-libvirt-debian-sid.Dockerfile |  0
 ...e => buildenv-libvirt-fedora-29.Dockerfile |  0
 ...e => buildenv-libvirt-fedora-30.Dockerfile |  0
 ...buildenv-libvirt-fedora-rawhide.Dockerfile |  0
 ...e => buildenv-libvirt-ubuntu-16.Dockerfile |  0
 ...e => buildenv-libvirt-ubuntu-18.Dockerfile |  0
 refresh                                       | 52 ++++++++++++++-----
 36 files changed, 40 insertions(+), 12 deletions(-)
 rename buildenv-centos-7.Dockerfile => buildenv-libvirt-centos-7.Dockerfile (100%)
 rename buildenv-debian-10-cross-aarch64.Dockerfile => buildenv-libvirt-debian-10-cross-aarch64.Dockerfile (100%)
 rename buildenv-debian-10-cross-armv6l.Dockerfile => buildenv-libvirt-debian-10-cross-armv6l.Dockerfile (100%)
 rename buildenv-debian-10-cross-armv7l.Dockerfile => buildenv-libvirt-debian-10-cross-armv7l.Dockerfile (100%)
 rename buildenv-debian-10-cross-i686.Dockerfile => buildenv-libvirt-debian-10-cross-i686.Dockerfile (100%)
 rename buildenv-debian-10-cross-mips.Dockerfile => buildenv-libvirt-debian-10-cross-mips.Dockerfile (100%)
 rename buildenv-debian-10-cross-mips64el.Dockerfile => buildenv-libvirt-debian-10-cross-mips64el.Dockerfile (100%)
 rename buildenv-debian-10-cross-mipsel.Dockerfile => buildenv-libvirt-debian-10-cross-mipsel.Dockerfile (100%)
 rename buildenv-debian-10-cross-ppc64le.Dockerfile => buildenv-libvirt-debian-10-cross-ppc64le.Dockerfile (100%)
 rename buildenv-debian-10-cross-s390x.Dockerfile => buildenv-libvirt-debian-10-cross-s390x.Dockerfile (100%)
 rename buildenv-debian-10.Dockerfile => buildenv-libvirt-debian-10.Dockerfile (100%)
 rename buildenv-debian-9-cross-aarch64.Dockerfile => buildenv-libvirt-debian-9-cross-aarch64.Dockerfile (100%)
 rename buildenv-debian-9-cross-armv6l.Dockerfile => buildenv-libvirt-debian-9-cross-armv6l.Dockerfile (100%)
 rename buildenv-debian-9-cross-armv7l.Dockerfile => buildenv-libvirt-debian-9-cross-armv7l.Dockerfile (100%)
 rename buildenv-debian-9-cross-mips.Dockerfile => buildenv-libvirt-debian-9-cross-mips.Dockerfile (100%)
 rename buildenv-debian-9-cross-mips64el.Dockerfile => buildenv-libvirt-debian-9-cross-mips64el.Dockerfile (100%)
 rename buildenv-debian-9-cross-mipsel.Dockerfile => buildenv-libvirt-debian-9-cross-mipsel.Dockerfile (100%)
 rename buildenv-debian-9-cross-ppc64le.Dockerfile => buildenv-libvirt-debian-9-cross-ppc64le.Dockerfile (100%)
 rename buildenv-debian-9-cross-s390x.Dockerfile => buildenv-libvirt-debian-9-cross-s390x.Dockerfile (100%)
 rename buildenv-debian-9.Dockerfile => buildenv-libvirt-debian-9.Dockerfile (100%)
 rename buildenv-debian-sid-cross-aarch64.Dockerfile => buildenv-libvirt-debian-sid-cross-aarch64.Dockerfile (100%)
 rename buildenv-debian-sid-cross-armv6l.Dockerfile => buildenv-libvirt-debian-sid-cross-armv6l.Dockerfile (100%)
 rename buildenv-debian-sid-cross-armv7l.Dockerfile => buildenv-libvirt-debian-sid-cross-armv7l.Dockerfile (100%)
 rename buildenv-debian-sid-cross-i686.Dockerfile => buildenv-libvirt-debian-sid-cross-i686.Dockerfile (100%)
 rename buildenv-debian-sid-cross-mips.Dockerfile => buildenv-libvirt-debian-sid-cross-mips.Dockerfile (100%)
 rename buildenv-debian-sid-cross-mips64el.Dockerfile => buildenv-libvirt-debian-sid-cross-mips64el.Dockerfile (100%)
 rename buildenv-debian-sid-cross-mipsel.Dockerfile => buildenv-libvirt-debian-sid-cross-mipsel.Dockerfile (100%)
 rename buildenv-debian-sid-cross-ppc64le.Dockerfile => buildenv-libvirt-debian-sid-cross-ppc64le.Dockerfile (100%)
 rename buildenv-debian-sid-cross-s390x.Dockerfile => buildenv-libvirt-debian-sid-cross-s390x.Dockerfile (100%)
 rename buildenv-debian-sid.Dockerfile => buildenv-libvirt-debian-sid.Dockerfile (100%)
 rename buildenv-fedora-29.Dockerfile => buildenv-libvirt-fedora-29.Dockerfile (100%)
 rename buildenv-fedora-30.Dockerfile => buildenv-libvirt-fedora-30.Dockerfile (100%)
 rename buildenv-fedora-rawhide.Dockerfile => buildenv-libvirt-fedora-rawhide.Dockerfile (100%)
 rename buildenv-ubuntu-16.Dockerfile => buildenv-libvirt-ubuntu-16.Dockerfile (100%)
 rename buildenv-ubuntu-18.Dockerfile => buildenv-libvirt-ubuntu-18.Dockerfile (100%)

diff --git a/buildenv-centos-7.Dockerfile b/buildenv-libvirt-centos-7.Dockerfile
similarity index 100%
rename from buildenv-centos-7.Dockerfile
rename to buildenv-libvirt-centos-7.Dockerfile
diff --git a/buildenv-debian-10-cross-aarch64.Dockerfile b/buildenv-libvirt-debian-10-cross-aarch64.Dockerfile
similarity index 100%
rename from buildenv-debian-10-cross-aarch64.Dockerfile
rename to buildenv-libvirt-debian-10-cross-aarch64.Dockerfile
diff --git a/buildenv-debian-10-cross-armv6l.Dockerfile b/buildenv-libvirt-debian-10-cross-armv6l.Dockerfile
similarity index 100%
rename from buildenv-debian-10-cross-armv6l.Dockerfile
rename to buildenv-libvirt-debian-10-cross-armv6l.Dockerfile
diff --git a/buildenv-debian-10-cross-armv7l.Dockerfile b/buildenv-libvirt-debian-10-cross-armv7l.Dockerfile
similarity index 100%
rename from buildenv-debian-10-cross-armv7l.Dockerfile
rename to buildenv-libvirt-debian-10-cross-armv7l.Dockerfile
diff --git a/buildenv-debian-10-cross-i686.Dockerfile b/buildenv-libvirt-debian-10-cross-i686.Dockerfile
similarity index 100%
rename from buildenv-debian-10-cross-i686.Dockerfile
rename to buildenv-libvirt-debian-10-cross-i686.Dockerfile
diff --git a/buildenv-debian-10-cross-mips.Dockerfile b/buildenv-libvirt-debian-10-cross-mips.Dockerfile
similarity index 100%
rename from buildenv-debian-10-cross-mips.Dockerfile
rename to buildenv-libvirt-debian-10-cross-mips.Dockerfile
diff --git a/buildenv-debian-10-cross-mips64el.Dockerfile b/buildenv-libvirt-debian-10-cross-mips64el.Dockerfile
similarity index 100%
rename from buildenv-debian-10-cross-mips64el.Dockerfile
rename to buildenv-libvirt-debian-10-cross-mips64el.Dockerfile
diff --git a/buildenv-debian-10-cross-mipsel.Dockerfile b/buildenv-libvirt-debian-10-cross-mipsel.Dockerfile
similarity index 100%
rename from buildenv-debian-10-cross-mipsel.Dockerfile
rename to buildenv-libvirt-debian-10-cross-mipsel.Dockerfile
diff --git a/buildenv-debian-10-cross-ppc64le.Dockerfile b/buildenv-libvirt-debian-10-cross-ppc64le.Dockerfile
similarity index 100%
rename from buildenv-debian-10-cross-ppc64le.Dockerfile
rename to buildenv-libvirt-debian-10-cross-ppc64le.Dockerfile
diff --git a/buildenv-debian-10-cross-s390x.Dockerfile b/buildenv-libvirt-debian-10-cross-s390x.Dockerfile
similarity index 100%
rename from buildenv-debian-10-cross-s390x.Dockerfile
rename to buildenv-libvirt-debian-10-cross-s390x.Dockerfile
diff --git a/buildenv-debian-10.Dockerfile b/buildenv-libvirt-debian-10.Dockerfile
similarity index 100%
rename from buildenv-debian-10.Dockerfile
rename to buildenv-libvirt-debian-10.Dockerfile
diff --git a/buildenv-debian-9-cross-aarch64.Dockerfile b/buildenv-libvirt-debian-9-cross-aarch64.Dockerfile
similarity index 100%
rename from buildenv-debian-9-cross-aarch64.Dockerfile
rename to buildenv-libvirt-debian-9-cross-aarch64.Dockerfile
diff --git a/buildenv-debian-9-cross-armv6l.Dockerfile b/buildenv-libvirt-debian-9-cross-armv6l.Dockerfile
similarity index 100%
rename from buildenv-debian-9-cross-armv6l.Dockerfile
rename to buildenv-libvirt-debian-9-cross-armv6l.Dockerfile
diff --git a/buildenv-debian-9-cross-armv7l.Dockerfile b/buildenv-libvirt-debian-9-cross-armv7l.Dockerfile
similarity index 100%
rename from buildenv-debian-9-cross-armv7l.Dockerfile
rename to buildenv-libvirt-debian-9-cross-armv7l.Dockerfile
diff --git a/buildenv-debian-9-cross-mips.Dockerfile b/buildenv-libvirt-debian-9-cross-mips.Dockerfile
similarity index 100%
rename from buildenv-debian-9-cross-mips.Dockerfile
rename to buildenv-libvirt-debian-9-cross-mips.Dockerfile
diff --git a/buildenv-debian-9-cross-mips64el.Dockerfile b/buildenv-libvirt-debian-9-cross-mips64el.Dockerfile
similarity index 100%
rename from buildenv-debian-9-cross-mips64el.Dockerfile
rename to buildenv-libvirt-debian-9-cross-mips64el.Dockerfile
diff --git a/buildenv-debian-9-cross-mipsel.Dockerfile b/buildenv-libvirt-debian-9-cross-mipsel.Dockerfile
similarity index 100%
rename from buildenv-debian-9-cross-mipsel.Dockerfile
rename to buildenv-libvirt-debian-9-cross-mipsel.Dockerfile
diff --git a/buildenv-debian-9-cross-ppc64le.Dockerfile b/buildenv-libvirt-debian-9-cross-ppc64le.Dockerfile
similarity index 100%
rename from buildenv-debian-9-cross-ppc64le.Dockerfile
rename to buildenv-libvirt-debian-9-cross-ppc64le.Dockerfile
diff --git a/buildenv-debian-9-cross-s390x.Dockerfile b/buildenv-libvirt-debian-9-cross-s390x.Dockerfile
similarity index 100%
rename from buildenv-debian-9-cross-s390x.Dockerfile
rename to buildenv-libvirt-debian-9-cross-s390x.Dockerfile
diff --git a/buildenv-debian-9.Dockerfile b/buildenv-libvirt-debian-9.Dockerfile
similarity index 100%
rename from buildenv-debian-9.Dockerfile
rename to buildenv-libvirt-debian-9.Dockerfile
diff --git a/buildenv-debian-sid-cross-aarch64.Dockerfile b/buildenv-libvirt-debian-sid-cross-aarch64.Dockerfile
similarity index 100%
rename from buildenv-debian-sid-cross-aarch64.Dockerfile
rename to buildenv-libvirt-debian-sid-cross-aarch64.Dockerfile
diff --git a/buildenv-debian-sid-cross-armv6l.Dockerfile b/buildenv-libvirt-debian-sid-cross-armv6l.Dockerfile
similarity index 100%
rename from buildenv-debian-sid-cross-armv6l.Dockerfile
rename to buildenv-libvirt-debian-sid-cross-armv6l.Dockerfile
diff --git a/buildenv-debian-sid-cross-armv7l.Dockerfile b/buildenv-libvirt-debian-sid-cross-armv7l.Dockerfile
similarity index 100%
rename from buildenv-debian-sid-cross-armv7l.Dockerfile
rename to buildenv-libvirt-debian-sid-cross-armv7l.Dockerfile
diff --git a/buildenv-debian-sid-cross-i686.Dockerfile b/buildenv-libvirt-debian-sid-cross-i686.Dockerfile
similarity index 100%
rename from buildenv-debian-sid-cross-i686.Dockerfile
rename to buildenv-libvirt-debian-sid-cross-i686.Dockerfile
diff --git a/buildenv-debian-sid-cross-mips.Dockerfile b/buildenv-libvirt-debian-sid-cross-mips.Dockerfile
similarity index 100%
rename from buildenv-debian-sid-cross-mips.Dockerfile
rename to buildenv-libvirt-debian-sid-cross-mips.Dockerfile
diff --git a/buildenv-debian-sid-cross-mips64el.Dockerfile b/buildenv-libvirt-debian-sid-cross-mips64el.Dockerfile
similarity index 100%
rename from buildenv-debian-sid-cross-mips64el.Dockerfile
rename to buildenv-libvirt-debian-sid-cross-mips64el.Dockerfile
diff --git a/buildenv-debian-sid-cross-mipsel.Dockerfile b/buildenv-libvirt-debian-sid-cross-mipsel.Dockerfile
similarity index 100%
rename from buildenv-debian-sid-cross-mipsel.Dockerfile
rename to buildenv-libvirt-debian-sid-cross-mipsel.Dockerfile
diff --git a/buildenv-debian-sid-cross-ppc64le.Dockerfile b/buildenv-libvirt-debian-sid-cross-ppc64le.Dockerfile
similarity index 100%
rename from buildenv-debian-sid-cross-ppc64le.Dockerfile
rename to buildenv-libvirt-debian-sid-cross-ppc64le.Dockerfile
diff --git a/buildenv-debian-sid-cross-s390x.Dockerfile b/buildenv-libvirt-debian-sid-cross-s390x.Dockerfile
similarity index 100%
rename from buildenv-debian-sid-cross-s390x.Dockerfile
rename to buildenv-libvirt-debian-sid-cross-s390x.Dockerfile
diff --git a/buildenv-debian-sid.Dockerfile b/buildenv-libvirt-debian-sid.Dockerfile
similarity index 100%
rename from buildenv-debian-sid.Dockerfile
rename to buildenv-libvirt-debian-sid.Dockerfile
diff --git a/buildenv-fedora-29.Dockerfile b/buildenv-libvirt-fedora-29.Dockerfile
similarity index 100%
rename from buildenv-fedora-29.Dockerfile
rename to buildenv-libvirt-fedora-29.Dockerfile
diff --git a/buildenv-fedora-30.Dockerfile b/buildenv-libvirt-fedora-30.Dockerfile
similarity index 100%
rename from buildenv-fedora-30.Dockerfile
rename to buildenv-libvirt-fedora-30.Dockerfile
diff --git a/buildenv-fedora-rawhide.Dockerfile b/buildenv-libvirt-fedora-rawhide.Dockerfile
similarity index 100%
rename from buildenv-fedora-rawhide.Dockerfile
rename to buildenv-libvirt-fedora-rawhide.Dockerfile
diff --git a/buildenv-ubuntu-16.Dockerfile b/buildenv-libvirt-ubuntu-16.Dockerfile
similarity index 100%
rename from buildenv-ubuntu-16.Dockerfile
rename to buildenv-libvirt-ubuntu-16.Dockerfile
diff --git a/buildenv-ubuntu-18.Dockerfile b/buildenv-libvirt-ubuntu-18.Dockerfile
similarity index 100%
rename from buildenv-ubuntu-18.Dockerfile
rename to buildenv-libvirt-ubuntu-18.Dockerfile
diff --git a/refresh b/refresh
index 3b33c17..20acb5e 100755
--- a/refresh
+++ b/refresh
@@ -31,6 +31,19 @@ class Dockerfile:
     CROSS = "-cross-"
     SUFFIX = ".Dockerfile"
 
+    # PROJECTS is a dictionary of dictionaries.
+    # The key is the project name, as present in the Dockerfile name and
+    # the value is a dictionary containing the subprojects which the
+    # dependencies should be installed together as the key and their value
+    # being whether they support mingw builds or not.
+    # This hack is needed till the moment libvirt-jenkins-ci treats mingw
+    # builds in the very same way as cross-builds are treated.
+    PROJECTS = {
+        "libvirt" : {
+            "libvirt" : True
+        },
+    }
+
     def __init__(self, path):
 
         # Files that don't end with the expected suffix can be safely
@@ -44,30 +57,45 @@ class Dockerfile:
 
         self.path = path
         stem = path.stem[len(Dockerfile.PREFIX):]
+
+        self.projects = []
+
+        for project in Dockerfile.PROJECTS:
+            if stem.rfind(project + "-") >= 0:
+                self.project_name = project
+                stem = stem[len(self.project_name) + 1:]
+                for subproject in Dockerfile.PROJECTS[project]:
+                    self.projects += [subproject]
+                break
+
+        if self.projects == []:
+            raise Exception("File '{}' does not have any matching "
+                            "project.".format(path))
+
         cross = stem.rfind(Dockerfile.CROSS)
 
         if cross >= 0:
-            # If we found CROSS, then everything before it is the name of
-            # the OS and everything after it the name of the architecture
-            # we're targeting for cross-compilation
+            # If we found CROSS, then everything in between the project's
+            # name and the cross is the name of the OS and everything after
+            # it the name of the architecture we're targeting for
+            # cross-compilation
             self.os = stem[:cross]
             self.cross_arch = stem[cross + len(Dockerfile.CROSS):]
         else:
-            # Otherwise the entire stem is the name of the OS and there
-            # is no cross-compilation architecture
+            # Otherwise the name of the OS starts just after the project's
+            # name and there is no cross-compilation architecture
             self.os = stem
             self.cross_arch = None
 
-        self.projects = [
-            "libvirt",
-        ]
-
         # 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":
-            self.projects += [
-                "libvirt+mingw*",
-            ]
+            mingw_projects = []
+            for subproject in self.projects:
+                if Dockerfile.PROJECTS[self.project_name][subproject]:
+                    mingw_projects += [subproject + "+mingw*"]
+
+            self.projects += mingw_projects
 
     def refresh(self, lcitool):
 
-- 
2.21.0


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