config: Deprecate runroot option

Fixes: https://pagure.io/pungi/issue/975
Signed-off-by: Haibo Lin <hlin@redhat.com>
This commit is contained in:
Haibo Lin 2019-06-24 16:18:55 +08:00
parent 920eceaa5a
commit c4ed2bf3b2
9 changed files with 25 additions and 47 deletions

View File

@ -851,10 +851,6 @@ Options
to set up your Koji client profile. In the examples, the profile name is to set up your Koji client profile. In the examples, the profile name is
"koji", which points to Fedora's koji.fedoraproject.org. "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** **runroot_method**
(*str*) -- Runroot method to use. It can further specify the runroot method (*str*) -- Runroot method to use. It can further specify the runroot method
in case the ``runroot`` is set to True. in case the ``runroot`` is set to True.
@ -889,7 +885,6 @@ Example
:: ::
koji_profile = "koji" koji_profile = "koji"
runroot = True
runroot_channel = "runroot" runroot_channel = "runroot"
runroot_tag = "f23-build" runroot_tag = "f23-build"

View File

@ -65,8 +65,8 @@ def is_isohybrid_needed(conf):
to check for it. Additionally, the syslinux package is only available on to check for it. Additionally, the syslinux package is only available on
x86_64 and i386. x86_64 and i386.
""" """
runroot = conf.get('runroot', False) runroot_tag = conf.get('runroot_tag', '')
if runroot and not _will_productimg_run(conf): if runroot_tag and not _will_productimg_run(conf):
return False return False
if platform.machine() not in ('x86_64', 'i686', 'i386'): if platform.machine() not in ('x86_64', 'i686', 'i386'):
print('Not checking for /usr/bin/isohybrid due to current architecture. ' 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): def is_genisoimage_needed(conf):
"""This is only needed locally for productimg and createiso without runroot. """This is only needed locally for productimg and createiso without runroot.
""" """
runroot = conf.get('runroot', False) runroot_tag = conf.get('runroot_tag', '')
if runroot and not _will_productimg_run(conf): if runroot_tag and not _will_productimg_run(conf):
return False return False
return True return True
@ -564,8 +564,7 @@ def make_schema():
}, },
"runroot": { "runroot": {
"type": "boolean", "deprecated": "remove it. Please specify 'runroot_tag' if you want to enable runroot, otherwise run things locally",
"default": False,
}, },
"runroot_method": { "runroot_method": {
"type": "string", "type": "string",
@ -1286,7 +1285,7 @@ def make_schema():
"required": ["release_name", "release_short", "release_version", "required": ["release_name", "release_short", "release_version",
"variants_file", "variants_file",
"runroot", "pkgset_source", "pkgset_source",
"gather_method"], "gather_method"],
"additionalProperties": False, "additionalProperties": False,
} }
@ -1383,14 +1382,6 @@ CONFIG_DEPS = {
(lambda x: not x, ["base_product_name", "base_product_short"]), (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": { "product_id": {
"conflicts": [ "conflicts": [
(lambda x: not x, ['product_id_allow_missing']), (lambda x: not x, ['product_id_allow_missing']),

View File

@ -193,7 +193,6 @@ class CreateIsoThread(WorkerThread):
if "mount" in cmd: if "mount" in cmd:
mounts.append(cmd["mount"]) mounts.append(cmd["mount"])
runroot = compose.conf["runroot"]
bootable = cmd['bootable'] bootable = cmd['bootable']
log_file = compose.paths.log.log_file( log_file = compose.paths.log.log_file(
arch, "createiso-%s" % os.path.basename(cmd["iso_path"])) arch, "createiso-%s" % os.path.basename(cmd["iso_path"]))
@ -203,7 +202,7 @@ class CreateIsoThread(WorkerThread):
self.pool.log_info("[BEGIN] %s" % msg) self.pool.log_info("[BEGIN] %s" % msg)
try: try:
run_createiso_command(runroot, num, compose, bootable, arch, run_createiso_command(num, compose, bootable, arch,
cmd['cmd'], mounts, log_file) cmd['cmd'], mounts, log_file)
except Exception: except Exception:
self.fail(compose, cmd, variant, arch) self.fail(compose, cmd, variant, arch)
@ -267,7 +266,7 @@ def add_iso_to_metadata(
return img 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): log_file, with_jigdo=True):
packages = ["coreutils", "genisoimage", "isomd5sum"] packages = ["coreutils", "genisoimage", "isomd5sum"]
if with_jigdo and compose.conf['create_jigdo']: if with_jigdo and compose.conf['create_jigdo']:

View File

@ -120,7 +120,7 @@ class ExtraIsosThread(WorkerThread):
with open(script_file, 'w') as f: with open(script_file, 'w') as f:
createiso.write_script(opts, 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], ['bash', script_file], [compose.topdir],
log_file=compose.paths.log.log_file( log_file=compose.paths.log.log_file(
arch, "extraiso-%s" % os.path.basename(iso_path)), arch, "extraiso-%s" % os.path.basename(iso_path)),

View File

@ -11,7 +11,7 @@ variants_file = "dummy-variants.xml"
# KOJI SETTINGS # KOJI SETTINGS
runroot = False runroot_tag = ''
# PKGSET # PKGSET

View File

@ -259,7 +259,6 @@ BASE_CONFIG = dict(
release_name='Test', release_name='Test',
release_version='1.0', release_version='1.0',
variants_file='variants.xml', variants_file='variants.xml',
runroot=False,
createrepo_checksum='sha256', createrepo_checksum='sha256',
gather_method='deps', gather_method='deps',
) )

View File

@ -63,7 +63,7 @@ class CheckDependenciesTestCase(unittest.TestCase):
conf = { conf = {
'bootable': True, 'bootable': True,
'productimg': False, 'productimg': False,
'runroot': True, 'runroot_tag': 'dummy_tag',
} }
with mock.patch('sys.stdout', new_callable=StringIO) as out: 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): def test_isohybrid_not_required_on_not_bootable(self):
conf = { conf = {
'bootable': False, 'bootable': False,
'runroot': True, 'runroot_tag': 'dummy_tag',
} }
with mock.patch('sys.stdout', new_callable=StringIO) as out: with mock.patch('sys.stdout', new_callable=StringIO) as out:
@ -92,7 +92,7 @@ class CheckDependenciesTestCase(unittest.TestCase):
conf = { conf = {
'bootable': True, 'bootable': True,
'productimg': True, 'productimg': True,
'runroot': True, 'runroot_tag': 'dummy_tag',
} }
with mock.patch('sys.stdout', new_callable=StringIO) as out: 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): def test_isohybrid_not_needed_in_runroot(self):
conf = { conf = {
'runroot': True, 'runroot_tag': 'dummy_tag',
} }
with mock.patch('sys.stdout', new_callable=StringIO) as out: 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): def test_genisoimg_not_needed_in_runroot(self):
conf = { conf = {
'runroot': True, 'runroot_tag': 'dummy_tag',
} }
with mock.patch('sys.stdout', new_callable=StringIO) as out: 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): def test_genisoimg_needed_for_productimg(self):
conf = { conf = {
'runroot': True, 'runroot_tag': 'dummy_tag',
'productimg': True, 'productimg': True,
'bootable': True, 'bootable': True,
} }

View File

@ -145,7 +145,7 @@ class ImageNameConfigTestCase(ConfigTestCase):
class RunrootConfigTestCase(ConfigTestCase): class RunrootConfigTestCase(ConfigTestCase):
def test_runroot_without_deps(self): def test_set_runroot_true(self):
cfg = load_config( cfg = load_config(
PKGSET_REPOS, PKGSET_REPOS,
runroot=True, runroot=True,
@ -153,23 +153,17 @@ class RunrootConfigTestCase(ConfigTestCase):
self.assertValidation( self.assertValidation(
cfg, cfg,
[checks.REQUIRES.format('runroot', 'True', 'koji_profile'), 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."])
checks.REQUIRES.format('runroot', 'True', 'runroot_tag'),
checks.REQUIRES.format('runroot', 'True', 'runroot_channel')])
def test_koji_settings_without_runroot(self): def test_set_runroot_false(self):
cfg = load_config( cfg = load_config(
PKGSET_REPOS, PKGSET_REPOS,
runroot=False, runroot=False,
koji_profile='koji',
runroot_tag='f25',
runroot_channel='compose',
) )
self.assertValidation( self.assertValidation(
cfg, cfg,
[checks.CONFLICTS.format('runroot', 'False', 'runroot_tag'), 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."])
checks.CONFLICTS.format('runroot', 'False', 'runroot_channel')])
class BuildinstallConfigTestCase(ConfigTestCase): class BuildinstallConfigTestCase(ConfigTestCase):

View File

@ -149,7 +149,7 @@ class ExtraIsosThreadTest(helpers.PungiTestCase):
) )
self.assertEqual( self.assertEqual(
rcc.call_args_list, 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')], ['bash', os.path.join(self.topdir, 'work/x86_64/tmp-Server/extraiso-my.iso.sh')],
[self.topdir], [self.topdir],
log_file=os.path.join(self.topdir, 'logs/x86_64/extraiso-my.iso.x86_64.log'), 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( self.assertEqual(
rcc.call_args_list, 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')], ['bash', os.path.join(self.topdir, 'work/x86_64/tmp-Server/extraiso-my.iso.sh')],
[self.topdir], [self.topdir],
log_file=os.path.join(self.topdir, 'logs/x86_64/extraiso-my.iso.x86_64.log'), 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( self.assertEqual(
rcc.call_args_list, 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")], ["bash", os.path.join(self.topdir, "work/x86_64/tmp-Server/extraiso-my.iso.sh")],
[self.topdir], [self.topdir],
log_file=os.path.join(self.topdir, "logs/x86_64/extraiso-my.iso.x86_64.log"), 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( self.assertEqual(
rcc.call_args_list, 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')], ['bash', os.path.join(self.topdir, 'work/x86_64/tmp-Server/extraiso-my.iso.sh')],
[self.topdir], [self.topdir],
log_file=os.path.join(self.topdir, 'logs/x86_64/extraiso-my.iso.x86_64.log'), 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( self.assertEqual(
rcc.call_args_list, 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')], ['bash', os.path.join(self.topdir, 'work/src/tmp-Server/extraiso-my.iso.sh')],
[self.topdir], [self.topdir],
log_file=os.path.join(self.topdir, 'logs/src/extraiso-my.iso.src.log'), log_file=os.path.join(self.topdir, 'logs/src/extraiso-my.iso.src.log'),