From e80879a4fe6ad175b4963115d93a48cf8457d86a Mon Sep 17 00:00:00 2001 From: Daniel Mach Date: Jul 22 2015 12:27:56 +0000 Subject: [PATCH 1/3] Add armhfp arch tests. --- diff --git a/tests/test_arch.py b/tests/test_arch.py index fec405d..c38d6de 100755 --- a/tests/test_arch.py +++ b/tests/test_arch.py @@ -36,12 +36,23 @@ class TestArch(unittest.TestCase): arches = get_valid_arches("x86_64", add_src=True) self.assertEqual(arches, ['x86_64', 'athlon', 'i686', 'i586', 'i486', 'i386', 'noarch', 'src']) + def test_armhfp(self): + arches = get_valid_arches("armhfp") + self.assertEqual(arches, ['armv7hnl', 'armv7hl', 'armv6hl', 'noarch']) + + arches = get_valid_arches("armhfp", multilib=False) + self.assertEqual(arches, ['armv7hnl', 'armv7hl', 'armv6hl', 'noarch']) + + arches = get_valid_arches("armhfp", add_src=True) + self.assertEqual(arches, ['armv7hnl', 'armv7hl', 'armv6hl', 'noarch', 'src']) + def test_get_compatible_arches(self): self.assertEqual(get_compatible_arches("noarch"), ["noarch"]) self.assertEqual(get_compatible_arches("i386"), get_valid_arches("i386")) self.assertEqual(get_compatible_arches("i586"), get_valid_arches("i386")) self.assertEqual(get_compatible_arches("x86_64"), get_valid_arches("x86_64", multilib=False)) self.assertEqual(get_compatible_arches("ppc64p7"), get_valid_arches("ppc64", multilib=False)) + self.assertEqual(get_compatible_arches("armhfp"), get_valid_arches("armv7hnl", multilib=False)) def test_is_valid_arch(self): self.assertEqual(is_valid_arch("i386"), True) @@ -50,6 +61,7 @@ class TestArch(unittest.TestCase): self.assertEqual(is_valid_arch("src"), True) self.assertEqual(is_valid_arch("nosrc"), True) self.assertEqual(is_valid_arch("foo"), False) + self.assertEqual(is_valid_arch("armhfp"), False) def test_split_name_arch(self): self.assertEqual(split_name_arch("package"), ("package", None)) From 63338a968962735691d80abab707b9b809fcd5e7 Mon Sep 17 00:00:00 2001 From: Daniel Mach Date: Jul 22 2015 16:57:39 +0000 Subject: [PATCH 2/3] Fix and document productimg phase. --- diff --git a/doc/configuration.rst b/doc/configuration.rst index a4c12af..75218b6 100644 --- a/doc/configuration.rst +++ b/doc/configuration.rst @@ -399,3 +399,40 @@ Example ], }), ] + + +Productimg Settings +=================== +Product images are placed on installation media and provide additional branding +and Anaconda changes specific to product variants. + +Options +------- + +**productimg** = False + (*bool*) -- create product images; requires bootable=True + +**productimg_install_class** + (*scm_dict*, *str*) -- reference to install class **file** + +**productimg_po_files** + (*scm_dict*, *str*) -- reference to a **directory** with po files for install class translations + + +Example +------- +:: + + productimg = True + productimg_install_class = { + "scm": "git", + "repo": "http://git.example.com/productimg.git", + "branch": None, + "file": "fedora23/%(variant_id)s.py", + } + productimg_po_files = { + "scm": "git", + "repo": "http://git.example.com/productimg.git", + "branch": None, + "dir": "po", + } diff --git a/pungi/phases/product_img.py b/pungi/phases/product_img.py index 4792b6f..fd08981 100644 --- a/pungi/phases/product_img.py +++ b/pungi/phases/product_img.py @@ -58,9 +58,22 @@ class ProductimgPhase(PhaseBase): config_options = ( { - "name": "bootable", + "name": "productimg", "expected_types": [bool], - "expected_values": [True], + "requires": ( + (lambda x: bool(x) is True, ["productimg_install_class"]), + (lambda x: bool(x) is True, ["productimg_po_files"]), + ), + }, + { + "name": "productimg_install_class", + "expected_types": [dict], + "optional": True, + }, + { + "name": "productimg_po_files", + "expected_types": [dict], + "optional": True, }, ) @@ -72,7 +85,11 @@ class ProductimgPhase(PhaseBase): def skip(self): if PhaseBase.skip(self): return True - if not self.compose.conf.get("bootable"): + if not self.compose.conf.get("productimg", False): + msg = "Config option 'productimg' not set. Skipping creating product images." + self.compose.log_debug(msg) + return True + if not self.compose.conf.get("bootable", False): msg = "Not a bootable product. Skipping creating product images." self.compose.log_debug(msg) return True @@ -118,13 +135,13 @@ def create_product_img(compose, arch, variant): compose.log_info("[BEGIN] %s" % msg) product_tmp = tempfile.mkdtemp(prefix="product_img_") - install_class = compose.conf["install_class"].copy() + install_class = compose.conf["productimg_install_class"].copy() install_class["file"] = install_class["file"] % {"variant_id": variant.id.lower()} install_dir = os.path.join(product_tmp, "installclasses") makedirs(install_dir) get_file_from_scm(install_class, target_path=install_dir, logger=None) - po_files = compose.conf["po_files"] + po_files = compose.conf["productimg_po_files"] po_tmp = tempfile.mkdtemp(prefix="pofiles_") get_dir_from_scm(po_files, po_tmp, logger=compose._logger) for po_file in os.listdir(po_tmp): From b85307c6837d2cfd6b63b4bc4998c9d35b717c70 Mon Sep 17 00:00:00 2001 From: Daniel Mach Date: Jul 22 2015 17:00:36 +0000 Subject: [PATCH 3/3] Fix buildinstall for armhfp. armhfp is not a valid RPM arch, it's only a tree arch or basearch. Lorax requires valid RPM arch as --buildarch. --- diff --git a/pungi/phases/buildinstall.py b/pungi/phases/buildinstall.py index d7c79ad..783ba60 100644 --- a/pungi/phases/buildinstall.py +++ b/pungi/phases/buildinstall.py @@ -28,6 +28,7 @@ from kobo.threads import ThreadPool, WorkerThread from kobo.shortcuts import run, read_checksum_file, relative_path from productmd.images import Image +from pungi.arch import get_valid_arches from pungi.util import get_buildroot_rpms, get_volid from pungi.wrappers.lorax import LoraxWrapper from pungi.wrappers.kojiwrapper import KojiWrapper @@ -90,11 +91,12 @@ class BuildinstallPhase(PhaseBase): repo_baseurl = self.compose.paths.work.arch_repo(arch) output_dir = self.compose.paths.work.buildinstall_dir(arch) volid = get_volid(self.compose, arch) + buildarch = get_valid_arches(arch)[0] if buildinstall_method == "lorax": - cmd = lorax.get_lorax_cmd(product, version, release, repo_baseurl, output_dir, is_final=self.compose.supported, buildarch=arch, volid=volid, nomacboot=True, noupgrade=noupgrade) + cmd = lorax.get_lorax_cmd(product, version, release, repo_baseurl, output_dir, is_final=self.compose.supported, buildarch=buildarch, volid=volid, nomacboot=True, noupgrade=noupgrade) elif buildinstall_method == "buildinstall": - cmd = lorax.get_buildinstall_cmd(product, version, release, repo_baseurl, output_dir, is_final=self.compose.supported, buildarch=arch, volid=volid) + cmd = lorax.get_buildinstall_cmd(product, version, release, repo_baseurl, output_dir, is_final=self.compose.supported, buildarch=buildarch, volid=volid) else: raise ValueError("Unsupported buildinstall method: %s" % buildinstall_method) self.pool.add(BuildinstallThread(self.pool))