| |
@@ -79,20 +79,17 @@
|
| |
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,
|
| |
+ "wrapped_rpms_path": iso_dir,
|
| |
"build_arch": arch,
|
| |
"ks_file": ks_file,
|
| |
+ "specfile": None,
|
| |
+ "scratch": False,
|
| |
"cmd": [],
|
| |
"label": "", # currently not used
|
| |
}
|
| |
@@ -105,6 +102,35 @@
|
| |
data = get_arch_variant_data(self.compose.conf, "live_images", arch, variant)
|
| |
cmd["repos"].extend(data[0].get("additional_repos", []))
|
| |
|
| |
+ # Explicit name and version
|
| |
+ cmd["name"] = data[0].get("name", None)
|
| |
+ cmd["version"] = data[0].get("version", None)
|
| |
+
|
| |
+ # Specfile (for images wrapped in rpm)
|
| |
+ cmd["specfile"] = data[0].get("specfile", None)
|
| |
+
|
| |
+ # Scratch (only taken in consideration if specfile specified)
|
| |
+ # For images wrapped in rpm is scratch disabled by default
|
| |
+ # 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)
|
| |
|
| |
@@ -142,40 +168,45 @@
|
| |
def process(self, item, num):
|
| |
compose, cmd = item
|
| |
|
| |
- runroot = compose.conf.get("runroot", False)
|
| |
log_file = compose.paths.log.log_file(cmd["arch"], "createiso-%s" % os.path.basename(cmd["iso_path"]))
|
| |
|
| |
msg = "Creating ISO (arch: %s, variant: %s): %s" % (cmd["arch"], cmd["variant"], os.path.basename(cmd["iso_path"]))
|
| |
self.pool.log_info("[BEGIN] %s" % msg)
|
| |
|
| |
- if runroot:
|
| |
- # run in a koji build root
|
| |
-
|
| |
- koji_wrapper = KojiWrapper(compose.conf["koji_profile"])
|
| |
- name, version = compose.compose_id.rsplit("-", 1)
|
| |
- target = compose.conf["live_target"]
|
| |
- koji_cmd = koji_wrapper.get_create_image_cmd(name, version, target, cmd["build_arch"], cmd["ks_file"], cmd["repos"], image_type="live", wait=True, archive=False)
|
| |
-
|
| |
- # avoid race conditions?
|
| |
- # Kerberos authentication failed: Permission denied in replay cache code (-1765328215)
|
| |
- time.sleep(num * 3)
|
| |
-
|
| |
- output = koji_wrapper.run_create_image_cmd(koji_cmd, log_file=log_file)
|
| |
- if output["retcode"] != 0:
|
| |
- self.fail(compose, cmd)
|
| |
- raise RuntimeError("LiveImage task failed: %s. See %s for more details." % (output["task_id"], log_file))
|
| |
-
|
| |
- # copy finished image to isos/
|
| |
- image_path = koji_wrapper.get_image_path(output["task_id"])
|
| |
- # TODO: assert len == 1
|
| |
- image_path = image_path[0]
|
| |
- shutil.copy2(image_path, cmd["iso_path"])
|
| |
-
|
| |
- # write checksum and manifest
|
| |
- run(cmd["cmd"])
|
| |
-
|
| |
- else:
|
| |
- raise RuntimeError("NOT IMPLEMENTED")
|
| |
+ koji_wrapper = KojiWrapper()
|
| |
+ name, version = compose.compose_id.rsplit("-", 1)
|
| |
+ name = cmd["name"] or name
|
| |
+ version = cmd["version"] or version
|
| |
+ archive = False
|
| |
+ if cmd["specfile"] and not cmd["scratch"]:
|
| |
+ # Non scratch build are allowed only for rpm wrapped images
|
| |
+ archive = True
|
| |
+ target = compose.conf.get("live_target", "rhel-7.0-candidate") # compatability for hardcoded target
|
| |
+ koji_cmd = koji_wrapper.get_create_image_cmd(name, version, target, cmd["build_arch"], cmd["ks_file"], cmd["repos"], image_type="live", wait=True, archive=archive, specfile=cmd["specfile"])
|
| |
+
|
| |
+ # avoid race conditions?
|
| |
+ # Kerberos authentication failed: Permission denied in replay cache code (-1765328215)
|
| |
+ time.sleep(num * 3)
|
| |
+
|
| |
+ output = koji_wrapper.run_create_image_cmd(koji_cmd, log_file=log_file)
|
| |
+ if output["retcode"] != 0:
|
| |
+ self.fail(compose, cmd)
|
| |
+ raise RuntimeError("LiveImage task failed: %s. See %s for more details." % (output["task_id"], log_file))
|
| |
+
|
| |
+ # copy finished image to isos/
|
| |
+ image_path = koji_wrapper.get_image_path(output["task_id"])
|
| |
+ # TODO: assert len == 1
|
| |
+ image_path = image_path[0]
|
| |
+ shutil.copy2(image_path, cmd["iso_path"])
|
| |
+
|
| |
+ # copy finished rpm to isos/ (if rpm wrapped ISO was built)
|
| |
+ if cmd["specfile"]:
|
| |
+ rpm_paths = koji.get_wrapped_rpm_path(output["task_id"])
|
| |
+ for rpm_path in rpm_paths:
|
| |
+ shutil.copy2(rpm_path, cmd["wrapped_rpms_path"])
|
| |
+
|
| |
+ # write checksum and manifest
|
| |
+ run(cmd["cmd"])
|
| |
|
| |
self.pool.log_info("[DONE ] %s" % msg)
|
| |
|
| |
@@ -187,8 +218,8 @@
|
| |
scm_dict = data[0]["kickstart"]
|
| |
|
| |
if isinstance(scm_dict, dict):
|
| |
+ file_name = os.path.basename(os.path.basename(scm_dict["file"]))
|
| |
if scm_dict["scm"] == "file":
|
| |
- file_name = os.path.basename(os.path.basename(scm_dict["file"]))
|
| |
scm_dict["file"] = os.path.join(compose.config_dir, os.path.basename(scm_dict["file"]))
|
| |
else:
|
| |
file_name = os.path.basename(os.path.basename(scm_dict))
|
| |