PR#724 Merged image-build: add arch name(s) in image config file name

Proposed 24 days ago by qwan
Modified 20 days ago
From forks/qwan/pungi add-arch-to-image-conf-file  into pungi master

Pungi write image config file with name of <format>-<name>.cfg, if there
are two or more image configs present for different arches under the same
variant and with same format & name, the config file can be overwritten,
and result in invalid image conf file.

Example:

image_build = {
'^Server$': [
{
'image-build': {
'format': [('qcow2', 'qcow2'),],
'name': 'fedora-guest-image',
'target': 'guest-fedora-26-image',
'version': '26',
'ksurl': "git://git.example.com/ks.git?fedora#HEAD",
'kickstart': "fedora-26-kvm.ks",
'ksversion': 'f26',
'distro': 'fedora-26',
'disk-size': '10',
'arches': ['x86_64'],
'repo': ["http://example.com/linux/fedora/26/Everything/x86_64/os", ]
}
},
{
'image-build': {
'format': [('qcow2', 'qcow2'),],
'name': 'fedora-guest-image',
'target': 'guest-fedora-26-image',
'version': '26',
'ksurl': "git://git.example.com/ks.git?fedora#HEAD",
'kickstart': "fedora-26-kvm.ks",
'ksversion': 'f26',
'distro': 'fedora-26',
'disk-size': '10',
'arches': ['ppc64le'],
}
},
],
}

In this case, config file "qcow2_guest-fedora-26-image.cfg" will be
created for both x86_64 and ppc64le under the same variant dir, and
there is a high chance it will be over-written while Pungi creating the
koji task. We can add arch name(s) in config filename to avoid that.

file changed

@@ -302,17 +302,23 @@ 

              makedirs(path)

          return path

  

-     def image_build_conf(self, variant, image_name, image_type, create_dir=True):

+     def image_build_conf(self, variant, image_name, image_type, arches=None, create_dir=True):

          """

          @param variant

          @param image-name

          @param image-type (e.g docker)

+         @param arches

          @param create_dir=True

  

          Examples:

              work/image-build/Server/docker_rhel-server-docker.cfg

+             work/image-build/Server/docker_rhel-server-docker_x86_64.cfg

+             work/image-build/Server/docker_rhel-server-docker_x86_64-ppc64le.cfg

          """

-         path = os.path.join(self.image_build_dir(variant), "%s_%s.cfg" % (image_type, image_name))

+         path = os.path.join(self.image_build_dir(variant), "%s_%s" % (image_type, image_name))

+         if arches is not None:

+             path = "%s_%s" % (path, '-'.join(list(arches)))

+         path = "%s.cfg" % path

          return path

  

  
file changed

@@ -120,7 +120,8 @@ 

                      "conf_file": self.compose.paths.work.image_build_conf(

                          image_conf["image-build"]['variant'],

                          image_name=image_conf["image-build"]['name'],

-                         image_type=image_conf["image-build"]['format'].replace(",", "-")

+                         image_type=image_conf["image-build"]['format'].replace(",", "-"),

+                         arches=image_conf["image-build"]['arches'],

                      ),

                      "image_dir": self.compose.paths.compose.image_dir(variant),

                      "relative_image_dir": self.compose.paths.compose.image_dir(
file changed

@@ -73,7 +73,7 @@ 

                      'can_fail': ['x86_64'],

                  }

              },

-             "conf_file": self.topdir + '/work/image-build/Client/docker_Fedora-Docker-Base.cfg',

+             "conf_file": self.topdir + '/work/image-build/Client/docker_Fedora-Docker-Base_amd64.cfg',

              "image_dir": self.topdir + '/compose/Client/%(arch)s/images',

              "relative_image_dir": 'Client/%(arch)s/images',

              "link_type": 'hardlink-or-copy',

@@ -98,7 +98,7 @@

                      'can_fail': ['x86_64'],

                  }

              },

-             "conf_file": self.topdir + '/work/image-build/Server/docker_Fedora-Docker-Base.cfg',

+             "conf_file": self.topdir + '/work/image-build/Server/docker_Fedora-Docker-Base_amd64-x86_64.cfg',

              "image_dir": self.topdir + '/compose/Server/%(arch)s/images',

              "relative_image_dir": 'Server/%(arch)s/images',

              "link_type": 'hardlink-or-copy',

@@ -158,7 +158,7 @@

                      'release': '20151203.t.0',

                  }

              },

-             "conf_file": self.topdir + '/work/image-build/Server/docker_Fedora-Docker-Base.cfg',

+             "conf_file": self.topdir + '/work/image-build/Server/docker_Fedora-Docker-Base_amd64-x86_64.cfg',

              "image_dir": self.topdir + '/compose/Server/%(arch)s/images',

              "relative_image_dir": 'Server/%(arch)s/images',

              "link_type": 'hardlink-or-copy',

@@ -214,7 +214,7 @@

                      'release': '20151203.t.0',

                  }

              },

-             "conf_file": self.topdir + '/work/image-build/Server/docker_Fedora-Docker-Base.cfg',

+             "conf_file": self.topdir + '/work/image-build/Server/docker_Fedora-Docker-Base_amd64-x86_64.cfg',

              "image_dir": self.topdir + '/compose/Server/%(arch)s/images',

              "relative_image_dir": 'Server/%(arch)s/images',

              "link_type": 'hardlink-or-copy',

@@ -311,7 +311,7 @@

                      'distro': 'Fedora-20',

                  }

              },

-             "conf_file": self.topdir + '/work/image-build/Server/docker_Fedora-Docker-Base.cfg',

+             "conf_file": self.topdir + '/work/image-build/Server/docker_Fedora-Docker-Base_x86_64.cfg',

              "image_dir": self.topdir + '/compose/Server/%(arch)s/images',

              "relative_image_dir": 'Server/%(arch)s/images',

              "link_type": 'hardlink-or-copy',

@@ -375,7 +375,7 @@

                      'distro': 'Fedora-20',

                  }

              },

-             "conf_file": self.topdir + '/work/image-build/Server/docker_Fedora-Docker-Base.cfg',

+             "conf_file": self.topdir + '/work/image-build/Server/docker_Fedora-Docker-Base_x86_64.cfg',

              "image_dir": self.topdir + '/compose/Server/%(arch)s/images',

              "relative_image_dir": 'Server/%(arch)s/images',

              "link_type": 'hardlink-or-copy',

@@ -436,7 +436,7 @@

                      'distro': 'Fedora-20',

                  }

              },

-             "conf_file": self.topdir + '/work/image-build/Server/docker_Fedora-Docker-Base.cfg',

+             "conf_file": self.topdir + '/work/image-build/Server/docker_Fedora-Docker-Base_x86_64.cfg',

              "image_dir": self.topdir + '/compose/Server/%(arch)s/images',

              "relative_image_dir": 'Server/%(arch)s/images',

              "link_type": 'hardlink-or-copy',

@@ -648,7 +648,7 @@

                      'can_fail': ['x86_64'],

                  }

              },

-             "conf_file": self.topdir + '/work/image-build/Server-optional/docker_Fedora-Docker-Base.cfg',

+             "conf_file": self.topdir + '/work/image-build/Server-optional/docker_Fedora-Docker-Base_x86_64.cfg',

              "image_dir": self.topdir + '/compose/Server-optional/%(arch)s/images',

              "relative_image_dir": 'Server-optional/%(arch)s/images',

              "link_type": 'hardlink-or-copy',

@@ -708,7 +708,7 @@

                      'can_fail': ['amd64', 'x86_64'],

                  }

              },

-             "conf_file": self.topdir + '/work/image-build/Server/docker_Fedora-Docker-Base.cfg',

+             "conf_file": self.topdir + '/work/image-build/Server/docker_Fedora-Docker-Base_amd64-x86_64.cfg',

              "image_dir": self.topdir + '/compose/Server/%(arch)s/images',

              "relative_image_dir": 'Server/%(arch)s/images',

              "link_type": 'hardlink-or-copy',
20 days ago

rebased

20 days ago

Pull-Request has been merged by lsedlar

  • Jenkins
    0%
    Build failed
    24 days ago
  • Jenkins
    100%
    Build successful
    20 days ago
Changes summary
+8 -2
file changed
+2 -1
file changed
+9 -9
file changed