LU-2195 Change path to sources and iso when generating repositories

- We should add the images to the compose if they will be used only as netinstall image.
  E.g. *-boot.iso.
- And we shouldn't add if the images will be modified in phase `extra_isos`.
  E.g. *-minimal.iso

Change-Id: I9095cfd87414ecca46b1213553589731c82dd2e2
This commit is contained in:
soksanichenko 2021-02-12 13:48:40 +02:00
parent b3a8c3f28a
commit 2e48c9a56f
4 changed files with 36 additions and 8 deletions

View File

@ -17,6 +17,7 @@ BuildRequires: python3-productmd >= 1.23
BuildRequires: python3-kobo-rpmlib >= 0.18.0 BuildRequires: python3-kobo-rpmlib >= 0.18.0
BuildRequires: createrepo_c BuildRequires: createrepo_c
BuildRequires: python3-lxml BuildRequires: python3-lxml
BuildRequires: python3-ddt
BuildRequires: python3-kickstart BuildRequires: python3-kickstart
BuildRequires: python3-rpm BuildRequires: python3-rpm
BuildRequires: python3-dnf BuildRequires: python3-dnf

View File

@ -773,6 +773,14 @@ def make_schema():
"type": "string", "type": "string",
"enum": ["lorax", "buildinstall"], "enum": ["lorax", "buildinstall"],
}, },
# In phase `buildinstall` we should add to compose only the
# images that will be used only as netinstall
"netinstall_variants": {
"$ref": "#/definitions/list_of_strings",
"default": [
"BaseOS",
],
},
"buildinstall_topdir": {"type": "string"}, "buildinstall_topdir": {"type": "string"},
"buildinstall_kickstart": {"$ref": "#/definitions/str_or_scm_dict"}, "buildinstall_kickstart": {"$ref": "#/definitions/str_or_scm_dict"},
"buildinstall_use_guestmount": {"type": "boolean", "default": True}, "buildinstall_use_guestmount": {"type": "boolean", "default": True},

View File

@ -518,7 +518,14 @@ def link_boot_iso(compose, arch, variant, can_fail):
img.volume_id = iso.get_volume_id(new_boot_iso_path) img.volume_id = iso.get_volume_id(new_boot_iso_path)
except RuntimeError: except RuntimeError:
pass pass
compose.im.add(variant.uid, arch, img) # In this phase we should add to compose only the images that
# will be used only as netinstall.
# On this step lorax generates environment
# for creating isos and create them.
# On step `extra_isos` we overwrite the not needed iso `boot Minimal` by
# new iso. It already contains necessary packages from incldued variants.
if variant.uid in compose.conf['netinstall_variants']:
compose.im.add(variant.uid, arch, img)
compose.log_info("[DONE ] %s" % msg) compose.log_info("[DONE ] %s" % msg)

View File

@ -1,15 +1,15 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
try: try:
import unittest2 as unittest import unittest2 as unittest
except ImportError: except ImportError:
import unittest import unittest
import mock from unittest import mock
import six import six
from copy import copy from copy import copy
from six.moves import StringIO from six.moves import StringIO
from ddt import ddt, data
import os import os
@ -2000,6 +2000,7 @@ class BuildinstallThreadTestCase(PungiTestCase):
self.assertEqual(ret, None) self.assertEqual(ret, None)
@ddt
class TestSymlinkIso(PungiTestCase): class TestSymlinkIso(PungiTestCase):
def setUp(self): def setUp(self):
super(TestSymlinkIso, self).setUp() super(TestSymlinkIso, self).setUp()
@ -2015,8 +2016,13 @@ class TestSymlinkIso(PungiTestCase):
@mock.patch("pungi.phases.buildinstall.get_file_size") @mock.patch("pungi.phases.buildinstall.get_file_size")
@mock.patch("pungi.phases.buildinstall.iso") @mock.patch("pungi.phases.buildinstall.iso")
@mock.patch("pungi.phases.buildinstall.run") @mock.patch("pungi.phases.buildinstall.run")
def test_hardlink(self, run, iso, get_file_size, get_mtime, ImageCls): @data(['Server'], ['BaseOS'])
self.compose.conf = {"buildinstall_symlink": False, "disc_types": {}} def test_hardlink(self, netinstall_variants, run, iso, get_file_size, get_mtime, ImageCls):
self.compose.conf = {
"buildinstall_symlink": False,
"disc_types": {},
"netinstall_variants": netinstall_variants,
}
get_file_size.return_value = 1024 get_file_size.return_value = 1024
get_mtime.return_value = 13579 get_mtime.return_value = 13579
@ -2066,9 +2072,14 @@ class TestSymlinkIso(PungiTestCase):
self.assertEqual(image.bootable, True) self.assertEqual(image.bootable, True)
self.assertEqual(image.implant_md5, iso.get_implanted_md5.return_value) self.assertEqual(image.implant_md5, iso.get_implanted_md5.return_value)
self.assertEqual(image.can_fail, False) self.assertEqual(image.can_fail, False)
self.assertEqual( if 'Server' in netinstall_variants:
self.compose.im.add.mock_calls, [mock.call("Server", "x86_64", image)] self.assertEqual(
) self.compose.im.add.mock_calls, [mock.call("Server", "x86_64", image)]
)
else:
self.assertEqual(
self.compose.im.add.mock_calls, []
)
@mock.patch("pungi.phases.buildinstall.Image") @mock.patch("pungi.phases.buildinstall.Image")
@mock.patch("pungi.phases.buildinstall.get_mtime") @mock.patch("pungi.phases.buildinstall.get_mtime")
@ -2081,6 +2092,7 @@ class TestSymlinkIso(PungiTestCase):
self.compose.conf = { self.compose.conf = {
"buildinstall_symlink": False, "buildinstall_symlink": False,
"disc_types": {"boot": "netinst"}, "disc_types": {"boot": "netinst"},
"netinstall_variants": ['Server'],
} }
get_file_size.return_value = 1024 get_file_size.return_value = 1024
get_mtime.return_value = 13579 get_mtime.return_value = 13579