From c4ed2bf3b2bb434e120c282be3ec10877ef4b51d Mon Sep 17 00:00:00 2001 From: Haibo Lin Date: Mon, 24 Jun 2019 16:18:55 +0800 Subject: [PATCH] config: Deprecate runroot option Fixes: https://pagure.io/pungi/issue/975 Signed-off-by: Haibo Lin --- doc/configuration.rst | 5 ----- pungi/checks.py | 21 ++++++--------------- pungi/phases/createiso.py | 5 ++--- pungi/phases/extra_isos.py | 2 +- tests/data/dummy-pungi.conf | 2 +- tests/helpers.py | 1 - tests/test_checks.py | 12 ++++++------ tests/test_config.py | 14 ++++---------- tests/test_extra_isos_phase.py | 10 +++++----- 9 files changed, 25 insertions(+), 47 deletions(-) diff --git a/doc/configuration.rst b/doc/configuration.rst index d9633c31..115a05e1 100644 --- a/doc/configuration.rst +++ b/doc/configuration.rst @@ -851,10 +851,6 @@ Options to set up your Koji client profile. In the examples, the profile name is "koji", which points to Fedora's koji.fedoraproject.org. -**runroot** [mandatory] - (*bool*) -- run some tasks such as buildinstall or createiso in koji build root (True) or locally (False). - There might also be other runroot methods available. These can be chosen by ``runroot_method`` option. - **runroot_method** (*str*) -- Runroot method to use. It can further specify the runroot method in case the ``runroot`` is set to True. @@ -889,7 +885,6 @@ Example :: koji_profile = "koji" - runroot = True runroot_channel = "runroot" runroot_tag = "f23-build" diff --git a/pungi/checks.py b/pungi/checks.py index e4d8dad1..9c4c8a95 100644 --- a/pungi/checks.py +++ b/pungi/checks.py @@ -65,8 +65,8 @@ def is_isohybrid_needed(conf): to check for it. Additionally, the syslinux package is only available on x86_64 and i386. """ - runroot = conf.get('runroot', False) - if runroot and not _will_productimg_run(conf): + runroot_tag = conf.get('runroot_tag', '') + if runroot_tag and not _will_productimg_run(conf): return False if platform.machine() not in ('x86_64', 'i686', 'i386'): print('Not checking for /usr/bin/isohybrid due to current architecture. ' @@ -78,8 +78,8 @@ def is_isohybrid_needed(conf): def is_genisoimage_needed(conf): """This is only needed locally for productimg and createiso without runroot. """ - runroot = conf.get('runroot', False) - if runroot and not _will_productimg_run(conf): + runroot_tag = conf.get('runroot_tag', '') + if runroot_tag and not _will_productimg_run(conf): return False return True @@ -564,8 +564,7 @@ def make_schema(): }, "runroot": { - "type": "boolean", - "default": False, + "deprecated": "remove it. Please specify 'runroot_tag' if you want to enable runroot, otherwise run things locally", }, "runroot_method": { "type": "string", @@ -1286,7 +1285,7 @@ def make_schema(): "required": ["release_name", "release_short", "release_version", "variants_file", - "runroot", "pkgset_source", + "pkgset_source", "gather_method"], "additionalProperties": False, } @@ -1383,14 +1382,6 @@ CONFIG_DEPS = { (lambda x: not x, ["base_product_name", "base_product_short"]), ), }, - "runroot": { - "requires": ( - (lambda x: x, ["koji_profile", "runroot_tag", "runroot_channel"]), - ), - "conflicts": ( - (lambda x: not x, ["runroot_tag", "runroot_channel", "runroot_weights"]), - ), - }, "product_id": { "conflicts": [ (lambda x: not x, ['product_id_allow_missing']), diff --git a/pungi/phases/createiso.py b/pungi/phases/createiso.py index d3127553..5599dc8f 100644 --- a/pungi/phases/createiso.py +++ b/pungi/phases/createiso.py @@ -193,7 +193,6 @@ class CreateIsoThread(WorkerThread): if "mount" in cmd: mounts.append(cmd["mount"]) - runroot = compose.conf["runroot"] bootable = cmd['bootable'] log_file = compose.paths.log.log_file( arch, "createiso-%s" % os.path.basename(cmd["iso_path"])) @@ -203,7 +202,7 @@ class CreateIsoThread(WorkerThread): self.pool.log_info("[BEGIN] %s" % msg) try: - run_createiso_command(runroot, num, compose, bootable, arch, + run_createiso_command(num, compose, bootable, arch, cmd['cmd'], mounts, log_file) except Exception: self.fail(compose, cmd, variant, arch) @@ -267,7 +266,7 @@ def add_iso_to_metadata( return img -def run_createiso_command(runroot, num, compose, bootable, arch, cmd, mounts, +def run_createiso_command(num, compose, bootable, arch, cmd, mounts, log_file, with_jigdo=True): packages = ["coreutils", "genisoimage", "isomd5sum"] if with_jigdo and compose.conf['create_jigdo']: diff --git a/pungi/phases/extra_isos.py b/pungi/phases/extra_isos.py index a960f28c..99229398 100644 --- a/pungi/phases/extra_isos.py +++ b/pungi/phases/extra_isos.py @@ -120,7 +120,7 @@ class ExtraIsosThread(WorkerThread): with open(script_file, 'w') as f: createiso.write_script(opts, f) - run_createiso_command(compose.conf["runroot"], self.num, compose, bootable, arch, + run_createiso_command(self.num, compose, bootable, arch, ['bash', script_file], [compose.topdir], log_file=compose.paths.log.log_file( arch, "extraiso-%s" % os.path.basename(iso_path)), diff --git a/tests/data/dummy-pungi.conf b/tests/data/dummy-pungi.conf index 418a8c03..b941be8c 100644 --- a/tests/data/dummy-pungi.conf +++ b/tests/data/dummy-pungi.conf @@ -11,7 +11,7 @@ variants_file = "dummy-variants.xml" # KOJI SETTINGS -runroot = False +runroot_tag = '' # PKGSET diff --git a/tests/helpers.py b/tests/helpers.py index 1bf77fd5..0998634e 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -259,7 +259,6 @@ BASE_CONFIG = dict( release_name='Test', release_version='1.0', variants_file='variants.xml', - runroot=False, createrepo_checksum='sha256', gather_method='deps', ) diff --git a/tests/test_checks.py b/tests/test_checks.py index a46e7b96..3fc33881 100644 --- a/tests/test_checks.py +++ b/tests/test_checks.py @@ -63,7 +63,7 @@ class CheckDependenciesTestCase(unittest.TestCase): conf = { 'bootable': True, 'productimg': False, - 'runroot': True, + 'runroot_tag': 'dummy_tag', } with mock.patch('sys.stdout', new_callable=StringIO) as out: @@ -77,7 +77,7 @@ class CheckDependenciesTestCase(unittest.TestCase): def test_isohybrid_not_required_on_not_bootable(self): conf = { 'bootable': False, - 'runroot': True, + 'runroot_tag': 'dummy_tag', } with mock.patch('sys.stdout', new_callable=StringIO) as out: @@ -92,7 +92,7 @@ class CheckDependenciesTestCase(unittest.TestCase): conf = { 'bootable': True, 'productimg': True, - 'runroot': True, + 'runroot_tag': 'dummy_tag', } with mock.patch('sys.stdout', new_callable=StringIO) as out: @@ -107,7 +107,7 @@ class CheckDependenciesTestCase(unittest.TestCase): def test_isohybrid_not_needed_in_runroot(self): conf = { - 'runroot': True, + 'runroot_tag': 'dummy_tag', } with mock.patch('sys.stdout', new_callable=StringIO) as out: @@ -120,7 +120,7 @@ class CheckDependenciesTestCase(unittest.TestCase): def test_genisoimg_not_needed_in_runroot(self): conf = { - 'runroot': True, + 'runroot_tag': 'dummy_tag', } with mock.patch('sys.stdout', new_callable=StringIO) as out: @@ -133,7 +133,7 @@ class CheckDependenciesTestCase(unittest.TestCase): def test_genisoimg_needed_for_productimg(self): conf = { - 'runroot': True, + 'runroot_tag': 'dummy_tag', 'productimg': True, 'bootable': True, } diff --git a/tests/test_config.py b/tests/test_config.py index e64a4e6c..4fbe6420 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -145,7 +145,7 @@ class ImageNameConfigTestCase(ConfigTestCase): class RunrootConfigTestCase(ConfigTestCase): - def test_runroot_without_deps(self): + def test_set_runroot_true(self): cfg = load_config( PKGSET_REPOS, runroot=True, @@ -153,23 +153,17 @@ class RunrootConfigTestCase(ConfigTestCase): self.assertValidation( cfg, - [checks.REQUIRES.format('runroot', 'True', 'koji_profile'), - checks.REQUIRES.format('runroot', 'True', 'runroot_tag'), - checks.REQUIRES.format('runroot', 'True', 'runroot_channel')]) + warnings=["WARNING: Config option runroot was removed and has no effect; remove it. Please specify 'runroot_tag' if you want to enable runroot, otherwise run things locally."]) - def test_koji_settings_without_runroot(self): + def test_set_runroot_false(self): cfg = load_config( PKGSET_REPOS, runroot=False, - koji_profile='koji', - runroot_tag='f25', - runroot_channel='compose', ) self.assertValidation( cfg, - [checks.CONFLICTS.format('runroot', 'False', 'runroot_tag'), - checks.CONFLICTS.format('runroot', 'False', 'runroot_channel')]) + warnings=["WARNING: Config option runroot was removed and has no effect; remove it. Please specify 'runroot_tag' if you want to enable runroot, otherwise run things locally."]) class BuildinstallConfigTestCase(ConfigTestCase): diff --git a/tests/test_extra_isos_phase.py b/tests/test_extra_isos_phase.py index a19499ef..09efed1a 100644 --- a/tests/test_extra_isos_phase.py +++ b/tests/test_extra_isos_phase.py @@ -149,7 +149,7 @@ class ExtraIsosThreadTest(helpers.PungiTestCase): ) self.assertEqual( rcc.call_args_list, - [mock.call(False, 1, compose, True, 'x86_64', + [mock.call(1, compose, True, 'x86_64', ['bash', os.path.join(self.topdir, 'work/x86_64/tmp-Server/extraiso-my.iso.sh')], [self.topdir], log_file=os.path.join(self.topdir, 'logs/x86_64/extraiso-my.iso.x86_64.log'), @@ -205,7 +205,7 @@ class ExtraIsosThreadTest(helpers.PungiTestCase): ) self.assertEqual( rcc.call_args_list, - [mock.call(False, 1, compose, True, 'x86_64', + [mock.call(1, compose, True, 'x86_64', ['bash', os.path.join(self.topdir, 'work/x86_64/tmp-Server/extraiso-my.iso.sh')], [self.topdir], log_file=os.path.join(self.topdir, 'logs/x86_64/extraiso-my.iso.x86_64.log'), @@ -261,7 +261,7 @@ class ExtraIsosThreadTest(helpers.PungiTestCase): ) self.assertEqual( rcc.call_args_list, - [mock.call(False, 1, compose, True, "x86_64", + [mock.call(1, compose, True, "x86_64", ["bash", os.path.join(self.topdir, "work/x86_64/tmp-Server/extraiso-my.iso.sh")], [self.topdir], log_file=os.path.join(self.topdir, "logs/x86_64/extraiso-my.iso.x86_64.log"), @@ -316,7 +316,7 @@ class ExtraIsosThreadTest(helpers.PungiTestCase): ) self.assertEqual( rcc.call_args_list, - [mock.call(False, 1, compose, False, 'x86_64', + [mock.call(1, compose, False, 'x86_64', ['bash', os.path.join(self.topdir, 'work/x86_64/tmp-Server/extraiso-my.iso.sh')], [self.topdir], log_file=os.path.join(self.topdir, 'logs/x86_64/extraiso-my.iso.x86_64.log'), @@ -371,7 +371,7 @@ class ExtraIsosThreadTest(helpers.PungiTestCase): ) self.assertEqual( rcc.call_args_list, - [mock.call(False, 1, compose, False, 'src', + [mock.call(1, compose, False, 'src', ['bash', os.path.join(self.topdir, 'work/src/tmp-Server/extraiso-my.iso.sh')], [self.topdir], log_file=os.path.join(self.topdir, 'logs/src/extraiso-my.iso.src.log'),