diff --git a/pungi/paths.py b/pungi/paths.py index f00f22cf..f32debf1 100644 --- a/pungi/paths.py +++ b/pungi/paths.py @@ -302,17 +302,23 @@ class WorkPaths(object): 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 diff --git a/pungi/phases/image_build.py b/pungi/phases/image_build.py index 31350ec0..cbaffc9a 100644 --- a/pungi/phases/image_build.py +++ b/pungi/phases/image_build.py @@ -120,7 +120,8 @@ class ImageBuildPhase(base.PhaseLoggerMixin, base.ImageConfigMixin, base.ConfigG "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( diff --git a/tests/test_imagebuildphase.py b/tests/test_imagebuildphase.py index 07fa15ad..ef6b130f 100644 --- a/tests/test_imagebuildphase.py +++ b/tests/test_imagebuildphase.py @@ -73,7 +73,7 @@ class TestImageBuildPhase(PungiTestCase): '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 @@ class TestImageBuildPhase(PungiTestCase): '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 @@ class TestImageBuildPhase(PungiTestCase): '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 @@ class TestImageBuildPhase(PungiTestCase): '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 @@ class TestImageBuildPhase(PungiTestCase): '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 @@ class TestImageBuildPhase(PungiTestCase): '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 @@ class TestImageBuildPhase(PungiTestCase): '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 @@ class TestImageBuildPhase(PungiTestCase): '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 @@ class TestImageBuildPhase(PungiTestCase): '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',