From aab2fc4519f8ec07e4b14591c9d189c0186180d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Thu, 27 Sep 2018 14:50:47 +0200 Subject: [PATCH] extra_iso: Add list of variants to metadata MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The main variant is already available, this patch adds information about additional variants that are included in the image. JIRA: COMPOSE-2917 Signed-off-by: Lubomír Sedlář --- pungi/phases/createiso.py | 13 +++++++++++-- pungi/phases/extra_isos.py | 7 ++++++- tests/test_extra_isos_phase.py | 6 +++--- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/pungi/phases/createiso.py b/pungi/phases/createiso.py index 6c48b30e..369ce9f3 100644 --- a/pungi/phases/createiso.py +++ b/pungi/phases/createiso.py @@ -227,7 +227,14 @@ class CreateIsoThread(WorkerThread): def add_iso_to_metadata( - compose, variant, arch, iso_path, bootable, disc_num, disc_count, unified=False + compose, + variant, + arch, + iso_path, + bootable, + disc_num=1, + disc_count=1, + additional_variants=None, ): img = Image(compose.im) img.path = iso_path.replace(compose.paths.compose.topdir(), '').lstrip('/') @@ -242,7 +249,9 @@ def add_iso_to_metadata( img.bootable = bootable img.subvariant = variant.uid img.implant_md5 = iso.get_implanted_md5(iso_path, logger=compose._logger) - img.unified = unified + if additional_variants: + img.unified = True + img.additional_variants = additional_variants setattr(img, 'can_fail', compose.can_fail(variant, arch, 'iso')) setattr(img, 'deliverable', 'iso') try: diff --git a/pungi/phases/extra_isos.py b/pungi/phases/extra_isos.py index a379b6e7..a9d2d5f4 100644 --- a/pungi/phases/extra_isos.py +++ b/pungi/phases/extra_isos.py @@ -113,7 +113,12 @@ class ExtraIsosThread(WorkerThread): with_jigdo=False) add_iso_to_metadata( - compose, variant, arch, iso_path, bootable, 1, 1, unified=True + compose, + variant, + arch, + iso_path, + bootable, + additional_variants=config["include_variants"], ) self.pool.log_info("[DONE ] %s" % msg) diff --git a/tests/test_extra_isos_phase.py b/tests/test_extra_isos_phase.py index c8a35e6e..df6a14c4 100644 --- a/tests/test_extra_isos_phase.py +++ b/tests/test_extra_isos_phase.py @@ -147,7 +147,7 @@ class ExtraIsosThreadTest(helpers.PungiTestCase): aitm.call_args_list, [mock.call(compose, server, 'x86_64', os.path.join(self.topdir, 'compose/Server/x86_64/iso/my.iso'), - True, 1, 1, unified=True)] + True, additional_variants=["Client"])] ) def test_binary_image_custom_naming(self, aitm, rcc, gef, gic, gfn, gvi): @@ -188,7 +188,7 @@ class ExtraIsosThreadTest(helpers.PungiTestCase): aitm.call_args_list, [mock.call(compose, server, 'x86_64', os.path.join(self.topdir, 'compose/Server/x86_64/iso/my.iso'), - False, 1, 1, unified=True)] + False, additional_variants=["Client"])] ) def test_source_is_not_bootable(self, aitm, rcc, gef, gic, gfn, gvi): @@ -230,7 +230,7 @@ class ExtraIsosThreadTest(helpers.PungiTestCase): aitm.call_args_list, [mock.call(compose, server, 'src', os.path.join(self.topdir, 'compose/Server/source/iso/my.iso'), - False, 1, 1, unified=True)] + False, additional_variants=["Client"])] ) def test_failable_failed(self, aitm, rcc, gef, gic, gfn, gvi):