diff --git a/pungi/paths.py b/pungi/paths.py index 42ae3ef8..a8157a4a 100644 --- a/pungi/paths.py +++ b/pungi/paths.py @@ -464,7 +464,7 @@ class ComposePaths(object): makedirs(path) return path - def iso_path(self, arch, variant, disc_type="dvd", disc_num=1, suffix=".iso", symlink_to=None, create_dir=True, relative=False): + def iso_path(self, arch, variant, disc_type="dvd", disc_num=1, suffix=".iso", symlink_to=None, create_dir=True, relative=False, name=None): """ Examples: compose/Server/x86_64/iso/rhel-7.0-20120127.0-Server-x86_64-dvd1.iso @@ -489,7 +489,10 @@ class ComposePaths(object): variant_uid = variant.parent.uid else: variant_uid = variant.uid - file_name = "%s-%s-%s-%s%s%s" % (compose_id, variant_uid, arch, disc_type, disc_num, suffix) + if not name: + file_name = "%s-%s-%s-%s%s%s" % (compose_id, variant_uid, arch, disc_type, disc_num, suffix) + else: + file_name = "%s-%s-%s-%s%s%s" % (name, variant_uid, arch, disc_type, disc_num, suffix) result = os.path.join(path, file_name) return result diff --git a/pungi/phases/live_images.py b/pungi/phases/live_images.py index d19a416e..3b61ee12 100644 --- a/pungi/phases/live_images.py +++ b/pungi/phases/live_images.py @@ -79,20 +79,12 @@ class LiveImagesPhase(PhaseBase): if not iso_dir: continue - # XXX: hardcoded disc_type and disc_num - iso_path = self.compose.paths.compose.iso_path(arch, variant, disc_type="live", disc_num=None, symlink_to=symlink_isos_to) - if os.path.isfile(iso_path): - self.compose.log_warning("Skipping creating live image, it already exists: %s" % iso_path) - continue - - iso_name = os.path.basename(iso_path) - cmd = { "name": None, "version": None, "arch": arch, "variant": variant, - "iso_path": iso_path, + "iso_path": None, "build_arch": arch, "ks_file": ks_file, "specfile": None, @@ -121,6 +113,23 @@ class LiveImagesPhase(PhaseBase): # For other images is scratch always on cmd["scratch"] = data[0].get("scratch", False) + # Custom name (prefix) + custom_iso_name = None + if cmd["name"]: + custom_iso_name = cmd["name"] + if cmd["version"]: + custom_iso_name += "-%s" % cmd["version"] + + # XXX: hardcoded disc_type and disc_num + iso_path = self.compose.paths.compose.iso_path(arch, variant, disc_type="live", disc_num=None, symlink_to=symlink_isos_to, name=custom_iso_name) + if os.path.isfile(iso_path): + self.compose.log_warning("Skipping creating live image, it already exists: %s" % iso_path) + continue + cmd["iso_path"] = iso_path + iso_name = os.path.basename(iso_path) + + # Additional commands + chdir_cmd = "cd %s" % pipes.quote(iso_dir) cmd["cmd"].append(chdir_cmd)