From b513c8cd0041c259aaadc40e3dba015ad9fa5d07 Mon Sep 17 00:00:00 2001 From: Aditya Bisoi Date: Oct 18 2023 06:38:14 +0000 Subject: Drop buildinstall method JIRA: RHELCMP-12388 Signed-off-by: Aditya Bisoi --- diff --git a/TODO b/TODO index b75bc23..318566d 100644 --- a/TODO +++ b/TODO @@ -47,7 +47,6 @@ Split Pungi into smaller well-defined tools * create install images * lorax - * buildinstall * create isos * isos diff --git a/doc/configuration.rst b/doc/configuration.rst index 238dc0b..8caca1f 100644 --- a/doc/configuration.rst +++ b/doc/configuration.rst @@ -642,7 +642,7 @@ Options ------- **buildinstall_method** - (*str*) -- "lorax" (f16+, rhel7+) or "buildinstall" (older releases) + (*str*) -- "lorax" (f16+, rhel7+) **lorax_options** (*list*) -- special options passed on to *lorax*. diff --git a/doc/phases.rst b/doc/phases.rst index 7ae5bcd..7119e7f 100644 --- a/doc/phases.rst +++ b/doc/phases.rst @@ -30,17 +30,14 @@ packages to architectures. Buildinstall ------------ -Spawns a bunch of threads, each of which runs either ``lorax`` or -``buildinstall`` command (the latter coming from ``anaconda`` package). The +Spawns a bunch of threads, each of which runs the ``lorax`` command. The commands create ``boot.iso`` and other boot configuration files. The image is finally linked into the ``compose/`` directory as netinstall media. The created images are also needed for creating live media or other images in later phases. -With ``lorax`` this phase runs one task per variant.arch combination. For -``buildinstall`` command there is only one task per architecture and -``product.img`` should be used to customize the results. +With ``lorax`` this phase runs one task per variant.arch combination. Gather ------ diff --git a/pungi/checks.py b/pungi/checks.py index 88692dd..093046b 100644 --- a/pungi/checks.py +++ b/pungi/checks.py @@ -812,7 +812,7 @@ def make_schema(): "buildinstall_allow_reuse": {"type": "boolean", "default": False}, "buildinstall_method": { "type": "string", - "enum": ["lorax", "buildinstall"], + "enum": ["lorax"], }, "buildinstall_topdir": {"type": "string"}, "buildinstall_kickstart": {"$ref": "#/definitions/str_or_scm_dict"}, @@ -1497,7 +1497,6 @@ def get_num_cpus(): CONFIG_DEPS = { "buildinstall_method": { "conflicts": ( - (lambda val: val == "buildinstall", ["lorax_options"]), (lambda val: not val, ["lorax_options", "buildinstall_kickstart"]), ), }, diff --git a/pungi/createiso.py b/pungi/createiso.py index 954b640..26f7a64 100644 --- a/pungi/createiso.py +++ b/pungi/createiso.py @@ -67,10 +67,6 @@ def make_image(f, opts): os.path.join("$TEMPLATE", "config_files/ppc"), hfs_compat=opts.hfs_compat, ) - elif opts.buildinstall_method == "buildinstall": - mkisofs_kwargs["boot_args"] = iso.get_boot_options( - opts.arch, "/usr/lib/anaconda-runtime/boot" - ) # ppc(64) doesn't seem to support utf-8 if opts.arch in ("ppc", "ppc64", "ppc64le"): diff --git a/pungi/phases/buildinstall.py b/pungi/phases/buildinstall.py index 354c47a..5c6b69d 100644 --- a/pungi/phases/buildinstall.py +++ b/pungi/phases/buildinstall.py @@ -219,10 +219,6 @@ class BuildinstallPhase(PhaseBase): return repos def run(self): - lorax = LoraxWrapper() - product = self.compose.conf["release_name"] - version = self.compose.conf["release_version"] - release = self.compose.conf["release_version"] disc_type = self.compose.conf["disc_types"].get("dvd", "dvd") # Prepare kickstart file for final images. @@ -275,23 +271,6 @@ class BuildinstallPhase(PhaseBase): ), ) ) - elif self.buildinstall_method == "buildinstall": - volid = get_volid(self.compose, arch, disc_type=disc_type) - commands.append( - ( - None, - lorax.get_buildinstall_cmd( - product, - version, - release, - repo_baseurls, - output_dir, - is_final=self.compose.supported, - buildarch=arch, - volid=volid, - ), - ) - ) else: raise ValueError( "Unsupported buildinstall method: %s" % self.buildinstall_method @@ -827,8 +806,6 @@ class BuildinstallThread(WorkerThread): if buildinstall_method == "lorax": packages += ["lorax"] chown_paths.append(_get_log_dir(compose, variant, arch)) - elif buildinstall_method == "buildinstall": - packages += ["anaconda"] packages += get_arch_variant_data( compose.conf, "buildinstall_packages", arch, variant ) diff --git a/pungi/phases/createiso.py b/pungi/phases/createiso.py index 775c19e..8890d84 100644 --- a/pungi/phases/createiso.py +++ b/pungi/phases/createiso.py @@ -546,7 +546,6 @@ def run_createiso_command(num, compose, bootable, arch, cmd, mounts, log_file): if bootable: extra_packages = { "lorax": ["lorax", "which"], - "buildinstall": ["anaconda"], } packages.extend(extra_packages[compose.conf["buildinstall_method"]]) diff --git a/pungi/wrappers/lorax.py b/pungi/wrappers/lorax.py index 6e164c6..5cba4d1 100644 --- a/pungi/wrappers/lorax.py +++ b/pungi/wrappers/lorax.py @@ -109,55 +109,3 @@ class LoraxWrapper(object): # TODO: workdir return cmd - - def get_buildinstall_cmd( - self, - product, - version, - release, - repo_baseurl, - output_dir, - variant=None, - bugurl=None, - nomacboot=False, - noupgrade=False, - is_final=False, - buildarch=None, - volid=None, - brand=None, - ): - # RHEL 6 compatibility - # Usage: buildinstall [--debug] --version --brand --product --release --final [--output outputdir] [--discs ] # noqa: E501 - - brand = brand or "redhat" - # HACK: ignore provided release - release = "%s %s" % (brand, version) - bugurl = bugurl or "https://bugzilla.redhat.com" - - cmd = ["/usr/lib/anaconda-runtime/buildinstall"] - - cmd.append("--debug") - - cmd.extend(["--version", version]) - cmd.extend(["--brand", brand]) - cmd.extend(["--product", product]) - cmd.extend(["--release", release]) - - if is_final: - cmd.append("--final") - - if buildarch: - cmd.extend(["--buildarch", buildarch]) - - if bugurl: - cmd.extend(["--bugurl", bugurl]) - - output_dir = os.path.abspath(output_dir) - cmd.extend(["--output", output_dir]) - - for i in force_list(repo_baseurl): - if "://" not in i: - i = "file://%s" % os.path.abspath(i) - cmd.append(i) - - return cmd diff --git a/tests/test_buildinstall.py b/tests/test_buildinstall.py index 32224a8..8acc83e 100644 --- a/tests/test_buildinstall.py +++ b/tests/test_buildinstall.py @@ -473,70 +473,6 @@ class TestBuildinstallPhase(PungiTestCase): ], ) - @mock.patch("pungi.phases.buildinstall.ThreadPool") - @mock.patch("pungi.phases.buildinstall.LoraxWrapper") - @mock.patch("pungi.phases.buildinstall.get_volid") - def test_starts_threads_for_each_cmd_with_buildinstall( - self, get_volid, loraxCls, poolCls - ): - compose = BuildInstallCompose( - self.topdir, - { - "bootable": True, - "release_name": "Test", - "release_short": "t", - "release_version": "1", - "buildinstall_method": "buildinstall", - "disc_types": {"dvd": "DVD"}, - }, - ) - - get_volid.return_value = "vol_id" - - phase = BuildinstallPhase(compose, self._make_pkgset_phase(["p1"])) - - phase.run() - - # Two items added for processing in total. - pool = poolCls.return_value - self.assertEqual(2, len(pool.queue_put.mock_calls)) - - # Obtained correct lorax commands. - six.assertCountEqual( - self, - loraxCls.return_value.get_buildinstall_cmd.mock_calls, - [ - mock.call( - "Test", - "1", - "1", - [self.topdir + "/work/x86_64/repo/p1"], - self.topdir + "/work/x86_64/buildinstall", - buildarch="x86_64", - is_final=True, - volid="vol_id", - ), - mock.call( - "Test", - "1", - "1", - [self.topdir + "/work/amd64/repo/p1"], - self.topdir + "/work/amd64/buildinstall", - buildarch="amd64", - is_final=True, - volid="vol_id", - ), - ], - ) - six.assertCountEqual( - self, - get_volid.mock_calls, - [ - mock.call(compose, "x86_64", disc_type="DVD"), - mock.call(compose, "amd64", disc_type="DVD"), - ], - ) - @mock.patch("pungi.phases.buildinstall.get_file") @mock.patch("pungi.phases.buildinstall.ThreadPool") @mock.patch("pungi.phases.buildinstall.LoraxWrapper") @@ -1400,142 +1336,6 @@ class BuildinstallThreadTestCase(PungiTestCase): ], ) - @mock.patch("pungi.phases.buildinstall.link_boot_iso") - @mock.patch("pungi.phases.buildinstall.tweak_buildinstall") - @mock.patch("pungi.wrappers.kojiwrapper.KojiWrapper") - @mock.patch("pungi.wrappers.kojiwrapper.get_buildroot_rpms") - @mock.patch("pungi.phases.buildinstall.run") - def test_buildinstall_thread_with_buildinstall_in_runroot( - self, run, get_buildroot_rpms, KojiWrapperMock, mock_tweak, mock_link - ): - compose = BuildInstallCompose( - self.topdir, - { - "buildinstall_method": "buildinstall", - "runroot_tag": "rrt", - "koji_profile": "koji", - "koji_cache": "/tmp", - }, - ) - - get_buildroot_rpms.return_value = ["bash", "zsh"] - - get_runroot_cmd = KojiWrapperMock.return_value.get_runroot_cmd - - run_runroot_cmd = KojiWrapperMock.return_value.run_runroot_cmd - run_runroot_cmd.return_value = { - "output": "Foo bar baz", - "retcode": 0, - "task_id": 1234, - } - - t = BuildinstallThread(self.pool) - - with mock.patch("time.sleep"): - pkgset_phase = self._make_pkgset_phase(["p1"]) - t.process((compose, "amd64", None, self.cmd, pkgset_phase), 0) - - destdir = os.path.join(self.topdir, "work/amd64/buildinstall") - self.assertEqual( - get_runroot_cmd.mock_calls, - [ - mock.call( - "rrt", - "amd64", - self.cmd, - channel=None, - use_shell=True, - packages=["anaconda"], - mounts=[self.topdir], - weight=None, - chown_paths=[destdir], - ) - ], - ) - self.assertEqual( - run_runroot_cmd.mock_calls, - [ - mock.call( - get_runroot_cmd.return_value, - log_file=self.topdir + "/logs/amd64/buildinstall.amd64.log", - ) - ], - ) - with open(self.topdir + "/logs/amd64/buildinstall-RPMs.amd64.log") as f: - rpms = f.read().strip().split("\n") - six.assertCountEqual(self, rpms, ["bash", "zsh"]) - six.assertCountEqual(self, self.pool.finished_tasks, [(None, "amd64")]) - six.assertCountEqual( - self, - mock_tweak.call_args_list, - [ - mock.call( - compose, - destdir, - os.path.join(self.topdir, "compose", var, "amd64/os"), - "amd64", - var, - "", - "dummy-volid", - self.pool.kickstart_file, - ) - for var in ["Client", "Server"] - ], - ) - six.assertCountEqual( - self, - mock_link.call_args_list, - [ - mock.call(compose, "amd64", compose.variants["Client"], False), - mock.call(compose, "amd64", compose.variants["Server"], False), - ], - ) - - @mock.patch("pungi.wrappers.kojiwrapper.KojiWrapper") - @mock.patch("pungi.wrappers.kojiwrapper.get_buildroot_rpms") - @mock.patch("pungi.phases.buildinstall.run") - def test_buildinstall_fail_exit_code( - self, run, get_buildroot_rpms, KojiWrapperMock - ): - compose = BuildInstallCompose( - self.topdir, - { - "buildinstall_method": "buildinstall", - "runroot_tag": "rrt", - "koji_profile": "koji", - "koji_cache": "/tmp", - "failable_deliverables": [("^.+$", {"*": ["buildinstall"]})], - }, - ) - - get_buildroot_rpms.return_value = ["bash", "zsh"] - - run_runroot_cmd = KojiWrapperMock.return_value.run_runroot_cmd - run_runroot_cmd.return_value = { - "output": "Foo bar baz", - "retcode": 1, - "task_id": 1234, - } - - t = BuildinstallThread(self.pool) - - with mock.patch("time.sleep"): - pkgset_phase = self._make_pkgset_phase(["p1"]) - t.process((compose, "x86_64", None, self.cmd, pkgset_phase), 0) - - compose._logger.error.assert_has_calls( - [ - mock.call( - "[FAIL] Buildinstall (variant None, arch x86_64) failed, but going on anyway." # noqa: E501 - ), - mock.call( - "Runroot task failed: 1234. See %s/logs/x86_64/buildinstall.x86_64.log for more details." # noqa: E501 - % self.topdir - ), - ] - ) - self.assertEqual(self.pool.finished_tasks, set()) - @mock.patch("pungi.wrappers.kojiwrapper.KojiWrapper") @mock.patch("pungi.wrappers.kojiwrapper.get_buildroot_rpms") @mock.patch("pungi.phases.buildinstall.run") diff --git a/tests/test_config.py b/tests/test_config.py index 4b7103a..6de64ef 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -223,22 +223,6 @@ class BuildinstallConfigTestCase(ConfigTestCase): self.assertValidation(cfg, []) - def test_buildinstall_with_lorax_options(self): - cfg = load_config( - PKGSET_REPOS, - buildinstall_method="buildinstall", - lorax_options=[("^Server$", {})], - ) - - self.assertValidation( - cfg, - [ - checks.CONFLICTS.format( - "buildinstall_method", "buildinstall", "lorax_options" - ) - ], - ) - def test_lorax_with_lorax_options(self): cfg = load_config(PKGSET_REPOS, buildinstall_method="lorax", lorax_options=[]) diff --git a/tests/test_createiso_script.py b/tests/test_createiso_script.py index 25cb8f8..3c62e15 100644 --- a/tests/test_createiso_script.py +++ b/tests/test_createiso_script.py @@ -267,58 +267,6 @@ class CreateIsoScriptTest(helpers.PungiTestCase): ] ) - def test_bootable_run_buildinstall(self): - createiso.write_script( - createiso.CreateIsoOpts( - output_dir=self.outdir, - iso_name="DP-1.0-20160405.t.3-ppc64.iso", - volid="DP-1.0-20160405.t.3", - graft_points="graft-list", - arch="ppc64", - buildinstall_method="buildinstall", - ), - self.out, - ) - - self.assertScript( - [ - " ".join( - [ - "/usr/bin/genisoimage", - "-untranslated-filenames", - "-volid", - "DP-1.0-20160405.t.3", - "-J", - "-joliet-long", - "-rational-rock", - "-translation-table", - "-x", - "./lost+found", - "-part", - "-hfs", - "-r", - "-l", - "-sysid", - "PPC", - "-no-desktop", - "-allow-multidot", - "-chrp-boot", - "-map", - "/usr/lib/anaconda-runtime/boot/mapping", - "-hfs-bless", - "/ppc/mac", - "-o", - "DP-1.0-20160405.t.3-ppc64.iso", - "-graft-points", - "-path-list", - "graft-list", - ] - ), - " ".join(["/usr/bin/implantisomd5", "DP-1.0-20160405.t.3-ppc64.iso"]), - "isoinfo -R -f -i DP-1.0-20160405.t.3-ppc64.iso | grep -v '/TRANS.TBL$' | sort >> DP-1.0-20160405.t.3-ppc64.iso.manifest", # noqa: E501 - ] - ) - @mock.patch("sys.stderr") @mock.patch("kobo.shortcuts.run") def test_run_with_jigdo_bad_args(self, run, stderr):