live_images: Allow custom name prefix for live ISOs.
This commit is contained in:
parent
39c073abf9
commit
44ebf5eedc
@ -464,7 +464,7 @@ class ComposePaths(object):
|
|||||||
makedirs(path)
|
makedirs(path)
|
||||||
return 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:
|
Examples:
|
||||||
compose/Server/x86_64/iso/rhel-7.0-20120127.0-Server-x86_64-dvd1.iso
|
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
|
variant_uid = variant.parent.uid
|
||||||
else:
|
else:
|
||||||
variant_uid = variant.uid
|
variant_uid = variant.uid
|
||||||
|
if not name:
|
||||||
file_name = "%s-%s-%s-%s%s%s" % (compose_id, variant_uid, arch, disc_type, disc_num, suffix)
|
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)
|
result = os.path.join(path, file_name)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
@ -79,20 +79,12 @@ class LiveImagesPhase(PhaseBase):
|
|||||||
if not iso_dir:
|
if not iso_dir:
|
||||||
continue
|
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 = {
|
cmd = {
|
||||||
"name": None,
|
"name": None,
|
||||||
"version": None,
|
"version": None,
|
||||||
"arch": arch,
|
"arch": arch,
|
||||||
"variant": variant,
|
"variant": variant,
|
||||||
"iso_path": iso_path,
|
"iso_path": None,
|
||||||
"build_arch": arch,
|
"build_arch": arch,
|
||||||
"ks_file": ks_file,
|
"ks_file": ks_file,
|
||||||
"specfile": None,
|
"specfile": None,
|
||||||
@ -121,6 +113,23 @@ class LiveImagesPhase(PhaseBase):
|
|||||||
# For other images is scratch always on
|
# For other images is scratch always on
|
||||||
cmd["scratch"] = data[0].get("scratch", False)
|
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)
|
chdir_cmd = "cd %s" % pipes.quote(iso_dir)
|
||||||
cmd["cmd"].append(chdir_cmd)
|
cmd["cmd"].append(chdir_cmd)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user