From 794d151bef1419277c71c780789042b32a929a3f Mon Sep 17 00:00:00 2001 From: Haibo Lin Date: Jan 03 2020 11:42:38 +0000 Subject: Remove productimg phase JIRA: COMPOSE-4004 Signed-off-by: Haibo Lin --- diff --git a/doc/_static/phases.png b/doc/_static/phases.png index bca203e..d5e4ceb 100644 Binary files a/doc/_static/phases.png and b/doc/_static/phases.png differ diff --git a/doc/_static/phases.svg b/doc/_static/phases.svg index 7bbc5e1..5f10e8c 100644 --- a/doc/_static/phases.svg +++ b/doc/_static/phases.svg @@ -1,6 +1,4 @@ - - + inkscape:export-filename="/home/lsedlar/repos/pungi/doc/_static/phases.png" + sodipodi:docname="phases.svg" + inkscape:version="1.0beta2 (2b71d25, 2019-12-03)" + version="1.1" + id="svg2" + viewBox="0 0 771.66458 221.50019" + height="221.50018" + width="771.66455"> + fit-margin-left="0" + fit-margin-top="0" + inkscape:guide-bbox="true" + showguides="true" + inkscape:document-rotation="0" + units="px" + inkscape:window-maximized="1" + inkscape:window-y="23" + inkscape:window-x="0" + inkscape:window-height="1035" + inkscape:window-width="1920" + showgrid="false" + inkscape:current-layer="layer1" + inkscape:document-units="px" + inkscape:cy="97.894202" + inkscape:cx="396.63448" + inkscape:zoom="1.169022" + inkscape:pageshadow="2" + inkscape:pageopacity="1" + borderopacity="1.0" + bordercolor="#666666" + pagecolor="#ffffff" + id="base" /> + refY="0" + refX="0" + id="Arrow1Lend" + style="overflow:visible" + inkscape:isstock="true"> + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1" + transform="matrix(-0.8,0,0,-0.8,-10,0)" + inkscape:connector-curvature="0" /> image/svg+xml - + + id="layer1" + transform="matrix(1.066667,0,0,1.066667,-2.473231,-910.85239)"> + id="g3411" + transform="translate(71.99326,-80.817124)"> + x="953.49097" + height="49.214859" + width="26.295755" + id="rect3340" + style="fill:#8ae234;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> Pkgset + x="51.554729" + id="tspan3362" + sodipodi:role="line">Pkgset + id="g3446" + transform="translate(-22.545013,-80.817124)"> + id="rect3338-1" + width="26.295755" + height="115.80065" + x="953.49097" + y="554.10059" /> ImageChecksum + sodipodi:role="line" + x="556.95709" + y="971.54041">ImageChecksum + id="g3398" + transform="translate(101.37893,-80.817124)"> + id="rect3400" + width="26.295755" + height="46.01757" + x="953.49097" + y="553.98242" /> Test + x="557.61566" + id="tspan3398" + sodipodi:role="line">Test + x="873.01788" + height="39.669899" + width="26.295755" + id="rect3336" + style="fill:#fce94f;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> Init + x="6.2600794" + id="tspan3358" + sodipodi:role="line">Init - - - Productimg - + id="path3642" + inkscape:connector-curvature="0" /> + width="26.295755" + height="231.47725" + x="873.01788" + y="103.46365" + transform="matrix(0,1,1,0,0,0)" /> Buildinstall + x="105.76799" + y="891.06732" + style="font-size:13.1479px;line-height:1.25">Buildinstall + width="26.295755" + height="54.197887" + x="905.2099" + y="103.28194" + transform="matrix(0,1,1,0,0,0)" /> Gather + x="106.1384" + y="923.25934" + style="font-size:13.1479px;line-height:1.25">Gather + x="905.2099" + height="72.729973" + width="26.295755" + id="rect3346" + style="fill:#ad7fa8;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> ExtraFiles + x="165.23042" + y="923.25934" + style="font-size:13.1479px;line-height:1.25">ExtraFiles + width="26.295755" + height="78.636055" + x="905.2099" + y="241.10229" + transform="matrix(0,1,1,0,0,0)" /> Createrepo + x="243.95874" + y="921.86945" + style="font-size:13.1479px;line-height:1.25">Createrepo + transform="translate(-150.564,114.11662)" + id="g3408"> + width="26.295755" + height="53.653927" + x="823.54675" + y="254.60153" + transform="matrix(0,1,1,0,0,0)" /> OSTree + sodipodi:role="line" + id="tspan3406" + style="font-size:13.1479px;line-height:1.25">OSTree + id="g288" + transform="translate(-328.39105,-85.517823)"> + id="g3653" + transform="translate(0.56706579)"> + x="1022.637" + height="101.85102" + width="26.295755" + id="rect3428" + style="fill:#fcaf3e;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> OSTreeInstaller + x="492.642" + sodipodi:role="line" + id="tspan283">OSTreeInstaller - - + + + Createiso - - - - Createiso + + + + LiveImages - - - - LiveImages + + + + ImageBuild - - - - ImageBuild + + + + LiveMedia - - - - LiveMedia + + + + OSBS - - - - OSBS + + + + ExtraIsos + style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + xml:space="preserve">ExtraIsos + diff --git a/doc/configuration.rst b/doc/configuration.rst index 2ce9216..5da0656 100644 --- a/doc/configuration.rst +++ b/doc/configuration.rst @@ -1046,44 +1046,6 @@ in the ``os/`` directory and media. The checksums generated are determined by } -Productimg Settings -=================== -Product images are placed on installation media and provide additional branding -and Anaconda changes specific to product variants. - -Options -------- - -**productimg** = False - (*bool*) -- create product images; requires buildinstall_method option - -**productimg_install_class** - (:ref:`scm_dict `, *str*) -- reference to install class **file** - -**productimg_po_files** - (:ref:`scm_dict `, *str*) -- reference to a **directory** with - po files for install class translations - - -Example -------- -:: - - productimg = True - productimg_install_class = { - "scm": "git", - "repo": "http://git.example.com/productimg.git", - "branch": None, - "file": "fedora23/%(variant_id)s.py", - } - productimg_po_files = { - "scm": "git", - "repo": "http://git.example.com/productimg.git", - "branch": None, - "dir": "po", - } - - CreateISO Settings ================== diff --git a/doc/phases.rst b/doc/phases.rst index 6b04932..3307482 100644 --- a/doc/phases.rst +++ b/doc/phases.rst @@ -78,12 +78,6 @@ compose fails in a later stage, the commit will not be reverted. Implementation wise, this phase runs ``rpm-ostree`` command in Koji runroot (to allow running on different arches). -Productimg ----------- - -Creates ``product.img`` files for customizing the bootable media created in -``buildinstall`` phase. - Createiso --------- diff --git a/pungi/checks.py b/pungi/checks.py index 775aaf1..ba94c47 100644 --- a/pungi/checks.py +++ b/pungi/checks.py @@ -52,22 +52,18 @@ from productmd.composeinfo import COMPOSE_TYPES from . import util -def _will_productimg_run(conf): - return conf.get('productimg', False) and conf.get('buildinstall_method', '') - - def is_jigdo_needed(conf): return conf.get('create_jigdo', True) def is_isohybrid_needed(conf): - """The isohybrid command is needed locally only for productimg phase and + """The isohybrid command is needed locally only for createiso phase without runroot. If that is not going to run, we don't need to check for it. Additionally, the syslinux package is only available on x86_64 and i386. """ runroot_tag = conf.get('runroot_tag', '') - if runroot_tag and not _will_productimg_run(conf): + if runroot_tag: return False if platform.machine() not in ('x86_64', 'i686', 'i386'): print('Not checking for /usr/bin/isohybrid due to current architecture. ' @@ -77,10 +73,10 @@ def is_isohybrid_needed(conf): def is_genisoimage_needed(conf): - """This is only needed locally for productimg and createiso without runroot. + """This is only needed locally for createiso without runroot. """ runroot_tag = conf.get('runroot_tag', '') - if runroot_tag and not _will_productimg_run(conf): + if runroot_tag: return False return True @@ -98,7 +94,6 @@ tools = [ ("isomd5sum", "/usr/bin/checkisomd5", None), ("jigdo", "/usr/bin/jigdo-lite", is_jigdo_needed), ("genisoimage", "/usr/bin/genisoimage", is_genisoimage_needed), - ("gettext", "/usr/bin/msgfmt", _will_productimg_run), ("syslinux", "/usr/bin/isohybrid", is_isohybrid_needed), # createrepo, modifyrepo and mergerepo are not needed by default, only when # createrepo_c is not configured @@ -1269,11 +1264,8 @@ def make_schema(): "signing_key_password_file": {"type": "string"}, "signing_command": {"type": "string"}, "productimg": { - "type": "boolean", - "default": False + "deprecated": "remove it. Productimg phase has been removed" }, - "productimg_install_class": {"$ref": "#/definitions/str_or_scm_dict"}, - "productimg_po_files": {"$ref": "#/definitions/str_or_scm_dict"}, "iso_size": { "anyOf": [ {"type": "string"}, @@ -1396,13 +1388,6 @@ def get_num_cpus(): # encountered and its value satisfies the lambda, an error is reported for each # missing (for requires) option in the list. CONFIG_DEPS = { - "productimg": { - "requires": ( - (lambda x: bool(x), ["productimg_install_class"]), - (lambda x: bool(x), ["productimg_po_files"]), - ), - }, - "buildinstall_method": { "conflicts": ( (lambda val: val == "buildinstall", ["lorax_options"]), diff --git a/pungi/metadata.py b/pungi/metadata.py index 2bdae80..0b15d2b 100644 --- a/pungi/metadata.py +++ b/pungi/metadata.py @@ -332,14 +332,6 @@ def write_tree_info(compose, arch, variant, timestamp=None, bi=None): ti.images.images[platform][image] = path ti.checksums.add(path, createrepo_checksum, root_dir=os_tree) - # add product.img to images-$arch - product_img = os.path.join(os_tree, "images", "product.img") - product_img_relpath = relative_path(product_img, os_tree.rstrip("/") + "/") - if os.path.isfile(product_img): - for platform in ti.images.images: - ti.images.images[platform]["product.img"] = product_img_relpath - ti.checksums.add(product_img_relpath, createrepo_checksum, root_dir=os_tree) - path = os.path.join(compose.paths.compose.os_tree(arch=arch, variant=variant), ".treeinfo") compose.log_info("Writing treeinfo: %s" % path) ti.dump(path) diff --git a/pungi/paths.py b/pungi/paths.py index ab39b87..192d94a 100644 --- a/pungi/paths.py +++ b/pungi/paths.py @@ -324,16 +324,6 @@ class WorkPaths(object): path = os.path.join(path, file_name) return path - def product_img(self, variant, create_dir=True): - """ - Examples: - work/global/product-Server.img - """ - file_name = "product-%s.img" % variant - path = self.topdir(arch="global", create_dir=create_dir) - path = os.path.join(path, file_name) - return path - def iso_dir(self, arch, filename, create_dir=True): """ Examples: diff --git a/pungi/phases/__init__.py b/pungi/phases/__init__.py index 0ed3e56..d71947b 100644 --- a/pungi/phases/__init__.py +++ b/pungi/phases/__init__.py @@ -21,7 +21,6 @@ from .weaver import WeaverPhase # noqa from .pkgset import PkgsetPhase # noqa from .gather import GatherPhase # noqa from .createrepo import CreaterepoPhase # noqa -from .product_img import ProductimgPhase # noqa from .buildinstall import BuildinstallPhase # noqa from .extra_files import ExtraFilesPhase # noqa from .createiso import CreateisoPhase # noqa diff --git a/pungi/phases/product_img.py b/pungi/phases/product_img.py deleted file mode 100644 index fb29706..0000000 --- a/pungi/phases/product_img.py +++ /dev/null @@ -1,276 +0,0 @@ -# -*- coding: utf-8 -*- - - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Library General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, see . - - -""" -Expected product.img paths -========================== - -RHEL 6 ------- -installclasses/$variant.py -locale/$lang/LC_MESSAGES/comps.mo - -RHEL 7 ------- -run/install/product/installclasses/$variant.py -run/install/product/locale/$lang/LC_MESSAGES/comps.mo - -Compatibility symlinks ----------------------- -installclasses -> run/install/product/installclasses -locale -> run/install/product/locale -run/install/product/pyanaconda/installclasses -> ../installclasses -""" - - -import os -import fnmatch -import shutil -from six.moves import shlex_quote - -from kobo.shortcuts import run - -from pungi.arch import split_name_arch -from pungi.util import makedirs, pkg_is_rpm -from pungi.phases.base import PhaseBase -from pungi.wrappers import iso -from pungi.wrappers.scm import get_file_from_scm, get_dir_from_scm - - -class ProductimgPhase(PhaseBase): - """PRODUCTIMG""" - name = "productimg" - - def __init__(self, compose, pkgset_phase): - PhaseBase.__init__(self, compose) - # pkgset_phase provides package_sets and path_prefix - self.pkgset_phase = pkgset_phase - - def skip(self): - if PhaseBase.skip(self): - return True - if not self.compose.conf["productimg"]: - msg = "Config option 'productimg' not set. Skipping creating product images." - self.compose.log_debug(msg) - return True - if not self.compose.conf["buildinstall_method"]: - msg = "Not a bootable product. Skipping creating product images." - self.compose.log_debug(msg) - return True - return False - - def run(self): - # create PRODUCT.IMG - for variant in self.compose.get_variants(): - if variant.type != "variant" or variant.is_empty: - continue - create_product_img(self.compose, "global", variant) - - # copy PRODUCT.IMG - for arch in self.compose.get_arches(): - for variant in self.compose.get_variants(arch=arch): - if variant.type != "variant" or variant.is_empty: - continue - image = self.compose.paths.work.product_img(variant) - os_tree = self.compose.paths.compose.os_tree(arch, variant) - target_dir = os.path.join(os_tree, "images") - target_path = os.path.join(target_dir, "product.img") - if not os.path.isfile(target_path): - makedirs(target_dir) - shutil.copy2(image, target_path) - - for arch in self.compose.get_arches(): - for variant in self.compose.get_variants(arch=arch): - if variant.type != "variant" or variant.is_empty: - continue - rebuild_boot_iso(self.compose, arch, variant, self.pkgset_phase.package_sets) - - -def create_product_img(compose, arch, variant): - # product.img is noarch (at least on rhel6 and rhel7) - arch = "global" - - msg = "Creating product.img (arch: %s, variant: %s)" % (arch, variant) - image = compose.paths.work.product_img(variant) - if os.path.exists(image): - compose.log_warning("[SKIP ] %s" % msg) - return - - compose.log_info("[BEGIN] %s" % msg) - - product_tmp = compose.mkdtemp(prefix="product_img_") - install_class = compose.conf["productimg_install_class"].copy() - install_class["file"] = install_class["file"] % {"variant_id": variant.id.lower()} - install_dir = os.path.join(product_tmp, "installclasses") - makedirs(install_dir) - get_file_from_scm(install_class, target_path=install_dir) - - po_files = compose.conf["productimg_po_files"] - po_tmp = compose.mkdtemp(prefix="pofiles_") - get_dir_from_scm(po_files, po_tmp, compose=compose) - for po_file in os.listdir(po_tmp): - if not po_file.endswith(".po"): - continue - lang = po_file[:-3] - target_dir = os.path.join(product_tmp, "locale", lang, "LC_MESSAGES") - makedirs(target_dir) - run(["msgfmt", "--output-file", os.path.join(target_dir, "comps.mo"), os.path.join(po_tmp, po_file)]) - - shutil.rmtree(po_tmp) - - ret, __ = run(["which", "guestmount"], can_fail=True) - guestmount_available = not bool(ret) # return code 0 means that guestmount is available - - mount_tmp = compose.mkdtemp(prefix="product_img_mount_") - cmds = [ - # allocate image - "dd if=/dev/zero of=%s bs=1k count=5760" % shlex_quote(image), - # create file system - "mke2fs -F %s" % shlex_quote(image), - # use guestmount to mount the image, which doesn't require root privileges - # LIBGUESTFS_BACKEND=direct: running qemu directly without libvirt - "LIBGUESTFS_BACKEND=direct guestmount -a %s -m /dev/sda %s" % (shlex_quote(image), shlex_quote(mount_tmp)) if guestmount_available - else "mount -o loop %s %s" % (shlex_quote(image), shlex_quote(mount_tmp)), - "mkdir -p %s/run/install/product" % shlex_quote(mount_tmp), - "cp -rp %s/* %s/run/install/product/" % (shlex_quote(product_tmp), shlex_quote(mount_tmp)), - "mkdir -p %s/run/install/product/pyanaconda" % shlex_quote(mount_tmp), - # compat symlink: installclasses -> run/install/product/installclasses - "ln -s run/install/product/installclasses %s" % shlex_quote(mount_tmp), - # compat symlink: locale -> run/install/product/locale - "ln -s run/install/product/locale %s" % shlex_quote(mount_tmp), - # compat symlink: run/install/product/pyanaconda/installclasses -> ../installclasses - "ln -s ../installclasses %s/run/install/product/pyanaconda/installclasses" % shlex_quote(mount_tmp), - "fusermount -u %s" % shlex_quote(mount_tmp) if guestmount_available - else "umount %s" % shlex_quote(mount_tmp), - # tweak last mount path written in the image - "tune2fs -M /run/install/product %s" % shlex_quote(image), - ] - run(" && ".join(cmds)) - shutil.rmtree(mount_tmp) - - shutil.rmtree(product_tmp) - - compose.log_info("[DONE ] %s" % msg) - - -def rebuild_boot_iso(compose, arch, variant, package_sets): - os_tree = compose.paths.compose.os_tree(arch, variant) - buildinstall_dir = compose.paths.work.buildinstall_dir(arch) - boot_iso = os.path.join(os_tree, "images", "boot.iso") - product_img = compose.paths.work.product_img(variant) - buildinstall_boot_iso = os.path.join(buildinstall_dir, "images", "boot.iso") - buildinstall_method = compose.conf["buildinstall_method"] - log_file = compose.paths.log.log_file(arch, "rebuild_boot_iso-%s.%s" % (variant, arch)) - - msg = "Rebuilding boot.iso (arch: %s, variant: %s)" % (arch, variant) - - if not os.path.isfile(boot_iso): - # nothing to do - compose.log_warning("[SKIP ] %s" % msg) - return - - compose.log_info("[BEGIN] %s" % msg) - - # read the original volume id - volume_id = iso.get_volume_id(boot_iso) - - # remove the original boot.iso (created during buildinstall) from the os dir - os.remove(boot_iso) - - tmp_dir = compose.mkdtemp(prefix="boot_iso_") - mount_dir = compose.mkdtemp(prefix="boot_iso_mount_") - - cmd = "mount -o loop %s %s" % (shlex_quote(buildinstall_boot_iso), shlex_quote(mount_dir)) - run(cmd, logfile=log_file, show_cmd=True) - - images_dir = os.path.join(tmp_dir, "images") - os.makedirs(images_dir) - shutil.copy2(product_img, os.path.join(images_dir, "product.img")) - - if os.path.isfile(os.path.join(mount_dir, "isolinux", "isolinux.bin")): - os.makedirs(os.path.join(tmp_dir, "isolinux")) - shutil.copy2(os.path.join(mount_dir, "isolinux", "isolinux.bin"), os.path.join(tmp_dir, "isolinux")) - - graft_points = iso.get_graft_points([mount_dir, tmp_dir]) - graft_points_path = os.path.join(compose.paths.work.topdir(arch=arch), "boot-%s.%s.iso-graft-points" % (variant, arch)) - iso.write_graft_points(graft_points_path, graft_points, exclude=["*/TRANS.TBL", "*/boot.cat"]) - - mkisofs_kwargs = {} - boot_files = None - if buildinstall_method == "lorax": - # TODO: $arch instead of ppc - mkisofs_kwargs["boot_args"] = iso.get_boot_options(arch, "/usr/share/lorax/config_files/ppc") - elif buildinstall_method == "buildinstall": - boot_files = explode_anaconda(compose, arch, variant, package_sets) - mkisofs_kwargs["boot_args"] = iso.get_boot_options(arch, boot_files) - - # ppc(64) doesn't seem to support utf-8 - if arch in ("ppc", "ppc64"): - mkisofs_kwargs["input_charset"] = None - - mkisofs_cmd = iso.get_mkisofs_cmd(boot_iso, None, volid=volume_id, exclude=["./lost+found"], graft_points=graft_points_path, **mkisofs_kwargs) - run(mkisofs_cmd, logfile=log_file, show_cmd=True) - - cmd = "umount %s" % shlex_quote(mount_dir) - run(cmd, logfile=log_file, show_cmd=True) - - if arch == "x86_64": - isohybrid_cmd = "isohybrid --uefi %s" % shlex_quote(boot_iso) - run(isohybrid_cmd, logfile=log_file, show_cmd=True) - elif arch == "i386": - isohybrid_cmd = "isohybrid %s" % shlex_quote(boot_iso) - run(isohybrid_cmd, logfile=log_file, show_cmd=True) - - # implant MD5SUM to iso - isomd5sum_cmd = iso.get_implantisomd5_cmd(boot_iso, compose.supported) - isomd5sum_cmd = " ".join([shlex_quote(i) for i in isomd5sum_cmd]) - run(isomd5sum_cmd, logfile=log_file, show_cmd=True) - - if boot_files: - shutil.rmtree(boot_files) - shutil.rmtree(tmp_dir) - shutil.rmtree(mount_dir) - - compose.log_info("[DONE ] %s" % msg) - - -def explode_anaconda(compose, arch, variant, package_sets): - tmp_dir = compose.mkdtemp(prefix="anaconda_") - scm_dict = { - "scm": "rpm", - "repo": "anaconda.%s" % arch, - "file": [ - "/usr/lib/anaconda-runtime/boot/*", - ] - } - # if scm is "rpm" and repo contains a package name, find the package(s) in package set - if scm_dict["scm"] == "rpm" and not (scm_dict["repo"].startswith("/") or "://" in scm_dict["repo"]): - rpms = [] - for pkgset in package_sets: - for pkgset_file in pkgset[arch]: - pkg_obj = pkgset[arch][pkgset_file] - if not pkg_is_rpm(pkg_obj): - continue - pkg_name, pkg_arch = split_name_arch(scm_dict["repo"]) - if fnmatch.fnmatch(pkg_obj.name, pkg_name) and (pkg_arch is None or pkg_arch == pkg_obj.arch): - compose.log_critical("%s %s %s" % (pkg_obj.name, pkg_name, pkg_arch)) - rpms.append(pkg_obj.file_path) - scm_dict["repo"] = rpms - - if not rpms: - return None - get_file_from_scm(scm_dict, tmp_dir, logger=compose._logger) - return tmp_dir diff --git a/pungi/scripts/config_validate.py b/pungi/scripts/config_validate.py index 6880098..0fa5768 100644 --- a/pungi/scripts/config_validate.py +++ b/pungi/scripts/config_validate.py @@ -115,7 +115,6 @@ def run(config, topdir, has_old, offline, defined_variables): pungi.phases.CreaterepoPhase(compose), pungi.phases.OstreeInstallerPhase(compose, buildinstall_phase), pungi.phases.OSTreePhase(compose), - pungi.phases.ProductimgPhase(compose, pkgset_phase), pungi.phases.CreateisoPhase(compose, buildinstall_phase), pungi.phases.ExtraIsosPhase(compose), pungi.phases.LiveImagesPhase(compose), diff --git a/pungi/scripts/pungi_koji.py b/pungi/scripts/pungi_koji.py index 48cbc25..565ad67 100644 --- a/pungi/scripts/pungi_koji.py +++ b/pungi/scripts/pungi_koji.py @@ -35,6 +35,8 @@ COMPOSE = None def main(): global COMPOSE + PHASES_NAMES_MODIFIED = PHASES_NAMES + ['productimg'] + parser = argparse.ArgumentParser() group = parser.add_mutually_exclusive_group(required=True) group.add_argument( @@ -79,7 +81,7 @@ def main(): parser.add_argument( "--skip-phase", metavar="PHASE", - choices=PHASES_NAMES, + choices=PHASES_NAMES_MODIFIED, action="append", default=[], help="skip a compose phase", @@ -87,7 +89,7 @@ def main(): parser.add_argument( "--just-phase", metavar="PHASE", - choices=PHASES_NAMES, + choices=PHASES_NAMES_MODIFIED, action="append", default=[], help="run only a specified compose phase", @@ -224,6 +226,16 @@ def main(): if not pungi.checks.check_skip_phases(logger, opts.skip_phase): sys.exit(1) errors, warnings = pungi.checks.validate(conf) + + # TODO: workaround for config files containing skip_phase = productimg + # Remove when all config files are up to date + if 'productimg' in opts.skip_phase or 'productimg' in opts.just_phase: + print('WARNING: productimg phase has been removed, please remove it from --skip-phase or --just-phase option', file=sys.stderr) + for err in errors[:]: + if "'productimg' is not one of" in err: + errors.remove(err) + print("WARNING: %s" % err, file=sys.stderr) + if not opts.quiet: for warning in warnings: print(warning, file=sys.stderr) @@ -291,7 +303,6 @@ def run_compose(compose, create_latest_link=True, latest_link_status=None): createrepo_phase = pungi.phases.CreaterepoPhase(compose, pkgset_phase) ostree_installer_phase = pungi.phases.OstreeInstallerPhase(compose, buildinstall_phase, pkgset_phase) ostree_phase = pungi.phases.OSTreePhase(compose, pkgset_phase) - productimg_phase = pungi.phases.ProductimgPhase(compose, pkgset_phase) createiso_phase = pungi.phases.CreateisoPhase(compose, buildinstall_phase) extra_isos_phase = pungi.phases.ExtraIsosPhase(compose) liveimages_phase = pungi.phases.LiveImagesPhase(compose) @@ -303,7 +314,7 @@ def run_compose(compose, create_latest_link=True, latest_link_status=None): # check if all config options are set for phase in (init_phase, pkgset_phase, createrepo_phase, - buildinstall_phase, productimg_phase, gather_phase, + buildinstall_phase, gather_phase, extrafiles_phase, createiso_phase, liveimages_phase, livemedia_phase, image_build_phase, image_checksum_phase, test_phase, ostree_phase, ostree_installer_phase, @@ -374,9 +385,6 @@ def run_compose(compose, create_latest_link=True, latest_link_status=None): essentials_phase.start() essentials_phase.stop() - productimg_phase.start() - productimg_phase.stop() - # write treeinfo before ISOs are created for variant in compose.get_variants(): for arch in variant.arches + ["src"]: diff --git a/tests/test_checks.py b/tests/test_checks.py index 024553e..1e1cbe3 100644 --- a/tests/test_checks.py +++ b/tests/test_checks.py @@ -89,8 +89,7 @@ class CheckDependenciesTestCase(unittest.TestCase): def test_isohybrid_not_required_on_arm(self): conf = { 'buildinstall_method': 'lorax', - 'productimg': True, - 'runroot_tag': 'dummy_tag', + 'runroot_tag': '', } with mock.patch('sys.stdout', new_callable=StringIO) as out: @@ -129,21 +128,6 @@ class CheckDependenciesTestCase(unittest.TestCase): self.assertEqual('', out.getvalue()) self.assertTrue(result) - def test_genisoimg_needed_for_productimg(self): - conf = { - 'runroot_tag': 'dummy_tag', - 'productimg': True, - 'buildinstall_method': 'lorax', - } - - with mock.patch('sys.stdout', new_callable=StringIO) as out: - with mock.patch('os.path.exists') as exists: - exists.side_effect = self.dont_find(['/usr/bin/genisoimage']) - result = checks.check(conf) - - self.assertIn('genisoimage', out.getvalue()) - self.assertFalse(result) - def test_requires_modifyrepo(self): with mock.patch('sys.stdout', new_callable=StringIO) as out: with mock.patch('os.path.exists') as exists: