config: Deprecate release_is_layered option
Fixes: https://pagure.io/pungi/issue/977 Merges: https://pagure.io/pungi/pull-request/1204 Signed-off-by: Haibo Lin <hlin@redhat.com>
This commit is contained in:
parent
4e5f74b78d
commit
ce066707c1
@ -444,7 +444,7 @@ def run_compose(compose, create_latest_link=True, latest_link_status=None):
|
||||
symlink_name = "latest-%s-%s" % (compose.conf["release_short"], compose.conf["release_version"])
|
||||
else:
|
||||
symlink_name = "latest-%s-%s" % (compose.conf["release_short"], ".".join(compose.conf["release_version"].split(".")[:-1]))
|
||||
if compose.conf["release_is_layered"]:
|
||||
if compose.conf.get("base_product_name", ""):
|
||||
symlink_name += "-%s-%s" % (compose.conf["base_product_short"], compose.conf["base_product_version"])
|
||||
symlink = os.path.join(compose.topdir, "..", symlink_name)
|
||||
|
||||
|
@ -67,9 +67,6 @@ Options
|
||||
<http://productmd.readthedocs.io/en/latest/common.html#productmd.common.RELEASE_TYPES>`_
|
||||
in productmd documentation.
|
||||
|
||||
**release_is_layered** = False
|
||||
(*bool*) -- typically False for an operating system, True otherwise
|
||||
|
||||
**release_internal** = False
|
||||
(*bool*) -- whether the compose is meant for public consumption
|
||||
|
||||
@ -116,8 +113,6 @@ Example
|
||||
release_short = "rf"
|
||||
release_version = "23.0"
|
||||
|
||||
release_is_layered = True
|
||||
|
||||
base_product_name = "Fedora"
|
||||
base_product_short = "Fedora"
|
||||
base_product_version = "23"
|
||||
|
@ -541,7 +541,9 @@ def make_schema():
|
||||
"enum": RELEASE_TYPES,
|
||||
"default": "ga",
|
||||
},
|
||||
"release_is_layered": {"type": "boolean"},
|
||||
"release_is_layered": {
|
||||
"deprecated": "remove it. It's layered if there's configuration for base product"
|
||||
},
|
||||
"release_internal": {"type": "boolean", "default": False},
|
||||
"release_discinfo_description": {"type": "string"},
|
||||
|
||||
@ -1280,7 +1282,6 @@ def make_schema():
|
||||
},
|
||||
|
||||
"required": ["release_name", "release_short", "release_version",
|
||||
"release_is_layered",
|
||||
"variants_file",
|
||||
"runroot", "pkgset_source",
|
||||
"gather_method"],
|
||||
@ -1355,14 +1356,28 @@ CONFIG_DEPS = {
|
||||
(lambda val: not val, ["lorax_options", "buildinstall_kickstart"]),
|
||||
),
|
||||
},
|
||||
"release_is_layered": {
|
||||
"base_product_name": {
|
||||
"requires": (
|
||||
(lambda x: x, ["base_product_name", "base_product_short",
|
||||
"base_product_version", "base_product_type"]),
|
||||
(lambda x: x, ["base_product_short", "base_product_version"]),
|
||||
),
|
||||
"conflicts": (
|
||||
(lambda x: not x, ["base_product_name", "base_product_short",
|
||||
"base_product_version", "base_product_type"]),
|
||||
(lambda x: not x, ["base_product_short", "base_product_version"]),
|
||||
),
|
||||
},
|
||||
"base_product_short": {
|
||||
"requires": (
|
||||
(lambda x: x, ["base_product_name", "base_product_version"]),
|
||||
),
|
||||
"conflicts": (
|
||||
(lambda x: not x, ["base_product_name", "base_product_version"]),
|
||||
),
|
||||
},
|
||||
"base_product_version": {
|
||||
"requires": (
|
||||
(lambda x: x, ["base_product_name", "base_product_short"]),
|
||||
),
|
||||
"conflicts": (
|
||||
(lambda x: not x, ["base_product_name", "base_product_short"]),
|
||||
),
|
||||
},
|
||||
"runroot": {
|
||||
|
@ -57,7 +57,7 @@ def get_compose_dir(topdir, conf, compose_type="production", compose_date=None,
|
||||
ci.release.name = conf["release_name"]
|
||||
ci.release.short = conf["release_short"]
|
||||
ci.release.version = conf["release_version"]
|
||||
ci.release.is_layered = bool(conf.get("release_is_layered", False))
|
||||
ci.release.is_layered = True if conf.get("base_product_name", "") else False
|
||||
ci.release.type = conf.get("release_type", "ga").lower()
|
||||
ci.release.internal = bool(conf.get("release_internal", False))
|
||||
if ci.release.is_layered:
|
||||
|
@ -36,7 +36,7 @@ def get_description(compose, variant, arch):
|
||||
result = "%s %s for %s %s" % (variant.release_name, variant.release_version, compose.conf["release_name"], get_major_version(compose.conf["release_version"]))
|
||||
else:
|
||||
result = "%s %s" % (compose.conf["release_name"], compose.conf["release_version"])
|
||||
if compose.conf["release_is_layered"]:
|
||||
if compose.conf.get("base_product_name", ""):
|
||||
result += " for %s %s" % (compose.conf["base_product_name"], compose.conf["base_product_version"])
|
||||
|
||||
result = result % {"variant_name": variant.name, "arch": arch}
|
||||
@ -78,7 +78,7 @@ def compose_to_composeinfo(compose):
|
||||
ci.release.name = compose.conf["release_name"]
|
||||
ci.release.version = compose.conf["release_version"]
|
||||
ci.release.short = compose.conf["release_short"]
|
||||
ci.release.is_layered = compose.conf["release_is_layered"]
|
||||
ci.release.is_layered = True if compose.conf.get("base_product_name", "") else False
|
||||
ci.release.type = compose.conf["release_type"].lower()
|
||||
ci.release.internal = bool(compose.conf["release_internal"])
|
||||
|
||||
@ -225,7 +225,7 @@ def write_tree_info(compose, arch, variant, timestamp=None, bi=None):
|
||||
ti.release.name = compose.conf["release_name"]
|
||||
ti.release.version = compose.conf["release_version"]
|
||||
ti.release.short = compose.conf["release_short"]
|
||||
ti.release.is_layered = compose.conf["release_is_layered"]
|
||||
ti.release.is_layered = True if compose.conf.get("base_product_name", "") else False
|
||||
ti.release.type = compose.conf["release_type"].lower()
|
||||
|
||||
# base product
|
||||
|
@ -54,9 +54,10 @@ class PungiNotifier(object):
|
||||
data.setdefault('release_name', self.compose.conf['release_name'])
|
||||
data.setdefault('release_version', self.compose.conf['release_version'])
|
||||
data.setdefault('release_type', self.compose.conf['release_type'].lower())
|
||||
data.setdefault('release_is_layered', self.compose.conf["release_is_layered"])
|
||||
data.setdefault('release_is_layered', False)
|
||||
|
||||
if self.compose.conf['release_is_layered']:
|
||||
if self.compose.conf.get('base_product_name', ''):
|
||||
data['release_is_layered'] = True
|
||||
data['base_product_name'] = self.compose.conf["base_product_name"]
|
||||
data['base_product_version'] = self.compose.conf["base_product_version"]
|
||||
data['base_product_short'] = self.compose.conf["base_product_short"]
|
||||
|
@ -397,7 +397,7 @@ def get_volid(compose, arch, variant=None, disc_type=False,
|
||||
else:
|
||||
release_short = compose.conf["release_short"]
|
||||
release_version = compose.conf["release_version"]
|
||||
release_is_layered = compose.conf["release_is_layered"]
|
||||
release_is_layered = True if compose.conf.get("base_product_name", "") else False
|
||||
base_product_short = compose.conf.get("base_product_short", "")
|
||||
base_product_version = compose.conf.get("base_product_version", "")
|
||||
variant_uid = variant and variant.uid or None
|
||||
@ -941,4 +941,5 @@ def load_config(file_path):
|
||||
conf._open_file = file_path
|
||||
else:
|
||||
conf.load_from_file(file_path)
|
||||
|
||||
return conf
|
||||
|
@ -2,7 +2,6 @@
|
||||
release_name = "Dummy Product"
|
||||
release_short = "DP"
|
||||
release_version = "1.0"
|
||||
release_is_layered = False
|
||||
release_type = "ga"
|
||||
|
||||
|
||||
|
@ -258,7 +258,6 @@ BASE_CONFIG = dict(
|
||||
release_short='test',
|
||||
release_name='Test',
|
||||
release_version='1.0',
|
||||
release_is_layered=False,
|
||||
variants_file='variants.xml',
|
||||
runroot=False,
|
||||
createrepo_checksum='sha256',
|
||||
|
@ -91,7 +91,6 @@ class TestBuildinstallPhase(PungiTestCase):
|
||||
'release_name': 'Test',
|
||||
'release_short': 't',
|
||||
'release_version': '1',
|
||||
'release_is_layered': False,
|
||||
'buildinstall_method': 'lorax',
|
||||
'disc_types': {'dvd': 'DVD'},
|
||||
})
|
||||
@ -164,7 +163,6 @@ class TestBuildinstallPhase(PungiTestCase):
|
||||
'release_name': 'Test',
|
||||
'release_short': 't',
|
||||
'release_version': '1',
|
||||
'release_is_layered': False,
|
||||
'buildinstall_method': 'lorax'
|
||||
})
|
||||
|
||||
@ -210,7 +208,6 @@ class TestBuildinstallPhase(PungiTestCase):
|
||||
'release_name': 'Test',
|
||||
'release_short': 't',
|
||||
'release_version': '1',
|
||||
'release_is_layered': False,
|
||||
'buildinstall_method': 'buildinstall',
|
||||
'disc_types': {'dvd': 'DVD'},
|
||||
})
|
||||
@ -248,7 +245,6 @@ class TestBuildinstallPhase(PungiTestCase):
|
||||
'release_name': 'Test',
|
||||
'release_short': 't',
|
||||
'release_version': '1',
|
||||
'release_is_layered': False,
|
||||
'buildinstall_method': 'lorax',
|
||||
'lorax_options': [
|
||||
('^.*$', {'*': {}}),
|
||||
@ -339,7 +335,6 @@ class TestBuildinstallPhase(PungiTestCase):
|
||||
'release_name': 'Test',
|
||||
'release_short': 't',
|
||||
'release_version': '1',
|
||||
'release_is_layered': False,
|
||||
'buildinstall_method': 'lorax',
|
||||
'lorax_options': [
|
||||
('^.*$', {
|
||||
@ -417,7 +412,6 @@ class TestBuildinstallPhase(PungiTestCase):
|
||||
'release_name': 'Test',
|
||||
'release_short': 't',
|
||||
'release_version': '1',
|
||||
'release_is_layered': False,
|
||||
'buildinstall_method': 'lorax',
|
||||
'buildinstall_topdir': '/buildinstall_topdir',
|
||||
'translate_paths': [(self.topdir, "http://localhost/")],
|
||||
@ -495,7 +489,6 @@ class TestBuildinstallPhase(PungiTestCase):
|
||||
'release_name': 'Test',
|
||||
'release_short': 't',
|
||||
'release_version': '1',
|
||||
'release_is_layered': False,
|
||||
'buildinstall_method': 'lorax',
|
||||
'lorax_extra_sources': [
|
||||
('^Server$', {
|
||||
|
@ -253,7 +253,6 @@ class ComposeTestCase(unittest.TestCase):
|
||||
release_version='1.0',
|
||||
release_short='test',
|
||||
release_type='ga',
|
||||
release_is_layered=False,
|
||||
release_internal=False,
|
||||
)
|
||||
|
||||
@ -296,7 +295,6 @@ class ComposeTestCase(unittest.TestCase):
|
||||
release_version='1.0',
|
||||
release_short='test',
|
||||
release_type='ga',
|
||||
release_is_layered=False,
|
||||
release_internal=False,
|
||||
tree_arches=['x86_64'],
|
||||
)
|
||||
@ -342,7 +340,6 @@ class ComposeTestCase(unittest.TestCase):
|
||||
release_version='1.0',
|
||||
release_short='test',
|
||||
release_type='ga',
|
||||
release_is_layered=False,
|
||||
release_internal=False,
|
||||
tree_variants=['Server', 'Client', 'Server-Gluster'],
|
||||
)
|
||||
@ -381,7 +378,6 @@ class ComposeTestCase(unittest.TestCase):
|
||||
release_version='1.0',
|
||||
release_short='test',
|
||||
release_type='ga',
|
||||
release_is_layered=False,
|
||||
release_internal=False,
|
||||
tree_variants=['Server', 'Client', 'Server-optional'],
|
||||
tree_arches=['x86_64'],
|
||||
@ -422,7 +418,6 @@ class ComposeTestCase(unittest.TestCase):
|
||||
release_version='1.0',
|
||||
release_short='test',
|
||||
release_type='ga',
|
||||
release_is_layered=False,
|
||||
release_internal=False,
|
||||
tree_variants=['Server', 'Client', 'Server-optional'],
|
||||
tree_arches=['x86_64'],
|
||||
|
@ -75,7 +75,7 @@ class PkgsetConfigTestCase(ConfigTestCase):
|
||||
|
||||
|
||||
class ReleaseConfigTestCase(ConfigTestCase):
|
||||
def test_layered_without_base_product(self):
|
||||
def test_set_release_is_layered(self):
|
||||
cfg = load_config(
|
||||
PKGSET_REPOS,
|
||||
release_is_layered=True
|
||||
@ -83,25 +83,47 @@ class ReleaseConfigTestCase(ConfigTestCase):
|
||||
|
||||
self.assertValidation(
|
||||
cfg,
|
||||
[checks.REQUIRES.format('release_is_layered', 'True', 'base_product_name'),
|
||||
checks.REQUIRES.format('release_is_layered', 'True', 'base_product_short'),
|
||||
checks.REQUIRES.format('release_is_layered', 'True', 'base_product_version')])
|
||||
warnings=[
|
||||
"WARNING: Config option release_is_layered was removed and has no effect; remove it. It's layered if there's configuration for base product."])
|
||||
|
||||
def test_not_layered_with_base_product(self):
|
||||
def test_only_config_base_product_name(self):
|
||||
cfg = load_config(
|
||||
PKGSET_REPOS,
|
||||
base_product_name='Prod',
|
||||
base_product_short='bp',
|
||||
base_product_version='1.0',
|
||||
base_product_type='updates',
|
||||
)
|
||||
|
||||
self.assertValidation(
|
||||
cfg,
|
||||
[checks.CONFLICTS.format('release_is_layered', 'False', 'base_product_name'),
|
||||
checks.CONFLICTS.format('release_is_layered', 'False', 'base_product_short'),
|
||||
checks.CONFLICTS.format('release_is_layered', 'False', 'base_product_type'),
|
||||
checks.CONFLICTS.format('release_is_layered', 'False', 'base_product_version')])
|
||||
[checks.REQUIRES.format('base_product_name', 'Prod', 'base_product_short'),
|
||||
checks.REQUIRES.format('base_product_name', 'Prod', 'base_product_version'),
|
||||
checks.CONFLICTS.format('base_product_short', None, 'base_product_name'),
|
||||
checks.CONFLICTS.format('base_product_version', None, 'base_product_name')])
|
||||
|
||||
def test_only_config_base_product_short(self):
|
||||
cfg = load_config(
|
||||
PKGSET_REPOS,
|
||||
base_product_short='bp',
|
||||
)
|
||||
|
||||
self.assertValidation(
|
||||
cfg,
|
||||
[checks.REQUIRES.format('base_product_short', 'bp', 'base_product_name'),
|
||||
checks.REQUIRES.format('base_product_short', 'bp', 'base_product_version'),
|
||||
checks.CONFLICTS.format('base_product_name', None, 'base_product_short'),
|
||||
checks.CONFLICTS.format('base_product_version', None, 'base_product_short')])
|
||||
|
||||
def test_only_config_base_product_version(self):
|
||||
cfg = load_config(
|
||||
PKGSET_REPOS,
|
||||
base_product_version='1.0',
|
||||
)
|
||||
|
||||
self.assertValidation(
|
||||
cfg,
|
||||
[checks.REQUIRES.format('base_product_version', '1.0', 'base_product_name'),
|
||||
checks.REQUIRES.format('base_product_version', '1.0', 'base_product_short'),
|
||||
checks.CONFLICTS.format('base_product_name', None, 'base_product_version'),
|
||||
checks.CONFLICTS.format('base_product_short', None, 'base_product_version')])
|
||||
|
||||
|
||||
class ImageNameConfigTestCase(ConfigTestCase):
|
||||
|
@ -42,7 +42,6 @@ class CreateisoPhaseTest(helpers.PungiTestCase):
|
||||
compose = helpers.DummyCompose(self.topdir, {
|
||||
'release_short': 'test',
|
||||
'release_version': '1.0',
|
||||
'release_is_layered': False,
|
||||
'createiso_skip': [
|
||||
]
|
||||
})
|
||||
@ -75,7 +74,6 @@ class CreateisoPhaseTest(helpers.PungiTestCase):
|
||||
compose = helpers.DummyCompose(self.topdir, {
|
||||
'release_short': 'test',
|
||||
'release_version': '1.0',
|
||||
'release_is_layered': False,
|
||||
'createiso_skip': [
|
||||
]
|
||||
})
|
||||
@ -137,7 +135,6 @@ class CreateisoPhaseTest(helpers.PungiTestCase):
|
||||
compose = helpers.DummyCompose(self.topdir, {
|
||||
'release_short': 'test',
|
||||
'release_version': '1.0',
|
||||
'release_is_layered': False,
|
||||
'buildinstall_method': 'lorax',
|
||||
'bootable': True,
|
||||
'createiso_skip': []
|
||||
@ -221,7 +218,6 @@ class CreateisoPhaseTest(helpers.PungiTestCase):
|
||||
compose = helpers.DummyCompose(self.topdir, {
|
||||
'release_short': 'test',
|
||||
'release_version': '1.0',
|
||||
'release_is_layered': False,
|
||||
'buildinstall_method': 'lorax',
|
||||
'bootable': True,
|
||||
'createiso_skip': []
|
||||
@ -287,7 +283,6 @@ class CreateisoPhaseTest(helpers.PungiTestCase):
|
||||
compose = helpers.DummyCompose(self.topdir, {
|
||||
'release_short': 'test',
|
||||
'release_version': '1.0',
|
||||
'release_is_layered': False,
|
||||
'buildinstall_method': 'lorax',
|
||||
'bootable': True,
|
||||
'createiso_skip': [],
|
||||
@ -353,7 +348,6 @@ class CreateisoThreadTest(helpers.PungiTestCase):
|
||||
compose = helpers.DummyCompose(self.topdir, {
|
||||
'release_short': 'test',
|
||||
'release_version': '1.0',
|
||||
'release_is_layered': False,
|
||||
'runroot': True,
|
||||
'runroot_tag': 'f25-build',
|
||||
'koji_profile': 'koji',
|
||||
@ -417,7 +411,6 @@ class CreateisoThreadTest(helpers.PungiTestCase):
|
||||
compose = helpers.DummyCompose(self.topdir, {
|
||||
'release_short': 'test',
|
||||
'release_version': '1.0',
|
||||
'release_is_layered': False,
|
||||
'runroot': True,
|
||||
'runroot_tag': 'f25-build',
|
||||
'koji_profile': 'koji',
|
||||
@ -482,7 +475,6 @@ class CreateisoThreadTest(helpers.PungiTestCase):
|
||||
compose = helpers.DummyCompose(self.topdir, {
|
||||
'release_short': 'test',
|
||||
'release_version': '1.0',
|
||||
'release_is_layered': False,
|
||||
'runroot': True,
|
||||
'bootable': True,
|
||||
'buildinstall_method': 'lorax',
|
||||
@ -550,7 +542,6 @@ class CreateisoThreadTest(helpers.PungiTestCase):
|
||||
compose = helpers.DummyCompose(self.topdir, {
|
||||
'release_short': 'test',
|
||||
'release_version': '1.0',
|
||||
'release_is_layered': False,
|
||||
'runroot': True,
|
||||
'runroot_tag': 'f25-build',
|
||||
'koji_profile': 'koji',
|
||||
@ -581,7 +572,6 @@ class CreateisoThreadTest(helpers.PungiTestCase):
|
||||
compose = helpers.DummyCompose(self.topdir, {
|
||||
'release_short': 'test',
|
||||
'release_version': '1.0',
|
||||
'release_is_layered': False,
|
||||
'runroot': True,
|
||||
'runroot_tag': 'f25-build',
|
||||
'koji_profile': 'koji',
|
||||
@ -620,7 +610,6 @@ class CreateisoThreadTest(helpers.PungiTestCase):
|
||||
compose = helpers.DummyCompose(self.topdir, {
|
||||
'release_short': 'test',
|
||||
'release_version': '1.0',
|
||||
'release_is_layered': False,
|
||||
'runroot': True,
|
||||
'runroot_tag': 'f25-build',
|
||||
'koji_profile': 'koji',
|
||||
@ -665,7 +654,6 @@ class CreateisoThreadTest(helpers.PungiTestCase):
|
||||
compose = helpers.DummyCompose(self.topdir, {
|
||||
'release_short': 'test',
|
||||
'release_version': '1.0',
|
||||
'release_is_layered': False,
|
||||
'runroot': False,
|
||||
})
|
||||
cmd = {
|
||||
@ -710,7 +698,6 @@ class CreateisoThreadTest(helpers.PungiTestCase):
|
||||
compose = helpers.DummyCompose(self.topdir, {
|
||||
'release_short': 'test',
|
||||
'release_version': '1.0',
|
||||
'release_is_layered': False,
|
||||
'runroot': False,
|
||||
'failable_deliverables': [
|
||||
('^.*$', {'*': 'iso'})
|
||||
|
@ -25,7 +25,6 @@ class DiscInfoTestCase(helpers.PungiTestCase):
|
||||
compose = helpers.DummyCompose(self.topdir, {
|
||||
'release_name': 'Test',
|
||||
'release_version': '1.0',
|
||||
'release_is_layered': False,
|
||||
})
|
||||
|
||||
metadata.write_discinfo(compose, 'x86_64', compose.variants['Server'])
|
||||
@ -64,7 +63,6 @@ class DiscInfoTestCase(helpers.PungiTestCase):
|
||||
compose = helpers.DummyCompose(self.topdir, {
|
||||
'release_name': 'Test',
|
||||
'release_version': '1.0',
|
||||
'release_is_layered': True,
|
||||
'base_product_name': 'Base',
|
||||
'base_product_version': 42,
|
||||
})
|
||||
|
@ -245,7 +245,6 @@ class TestVolumeIdGenerator(unittest.TestCase):
|
||||
conf = {
|
||||
'release_short': 'rel_short2',
|
||||
'release_version': '6.0',
|
||||
'release_is_layered': False,
|
||||
'image_volid_formats': [format],
|
||||
'image_volid_layered_product_formats': [],
|
||||
'volume_id_substitutions': {},
|
||||
@ -281,7 +280,6 @@ class TestVolumeIdGenerator(unittest.TestCase):
|
||||
conf = {
|
||||
'release_short': 'rel_short2',
|
||||
'release_version': '6.0',
|
||||
'release_is_layered': False,
|
||||
'image_volid_formats': [format],
|
||||
'image_volid_layered_product_formats': [],
|
||||
'volume_id_substitutions': {},
|
||||
@ -310,7 +308,6 @@ class TestVolumeIdGenerator(unittest.TestCase):
|
||||
conf = {
|
||||
'release_short': 'rel_short2',
|
||||
'release_version': '6.0',
|
||||
'release_is_layered': False,
|
||||
'image_volid_formats': [
|
||||
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', # 34 chars
|
||||
'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb', # 33 chars
|
||||
|
Loading…
Reference in New Issue
Block a user