From c15b855e4e075e2d5ffa586c9ed7fc870796393f Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Thu, 22 Sep 2022 09:51:04 -0400 Subject: [PATCH] Backport fixes for kiwi-build command --- 3496.patch | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3498.patch | 23 +++++++++++++++++++++++ koji.spec | 11 ++++++++++- 3 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 3496.patch create mode 100644 3498.patch diff --git a/3496.patch b/3496.patch new file mode 100644 index 0000000..9246192 --- /dev/null +++ b/3496.patch @@ -0,0 +1,54 @@ +From ec7f9c2f6e26b74e6f41b3fe67998e9c2aa6dec0 Mon Sep 17 00:00:00 2001 +From: Tomas Kopecek +Date: Sep 15 2022 07:08:50 +0000 +Subject: kiwi: handle include protocols + + +Related: https://pagure.io/koji/issue/3495 + +--- + +diff --git a/docs/source/plugins.rst b/docs/source/plugins.rst +index 1a6994a..6654504 100644 +--- a/docs/source/plugins.rst ++++ b/docs/source/plugins.rst +@@ -282,6 +282,13 @@ option. Similarly to other image tasks, alternative architecture failures can be + ignored for successful build by ``--can-fail`` option. ``--arch`` can be used to + limit build tag architectures. + ++There are some limitation to used kiwi configuration: ++ ++ * ``include`` node can use only ``this://`` protocol. Other types like ``file://`` ++ or ``https://`` could reach out of the repo preventing reproducible build. ++ * All repositories from description (and included files) are removed and replaced ++ by buildroot repo and other repositories specified by ``--repo`` option. ++ + Driver Update Disks building + ============================ + +diff --git a/plugins/builder/kiwi.py b/plugins/builder/kiwi.py +index 41ef82e..9148fc5 100644 +--- a/plugins/builder/kiwi.py ++++ b/plugins/builder/kiwi.py +@@ -4,6 +4,7 @@ import xml.dom.minidom + from fnmatch import fnmatch + + import koji ++import koji.util + from koji.tasks import ServerExit + from __main__ import BaseBuildTask, BuildImageTask, BuildRoot, SCM + +@@ -199,6 +200,12 @@ class KiwiCreateImageTask(BaseBuildTask): + # doing it recursively) + for inc_node in image.getElementsByTagName('include'): + path = inc_node.getAttribute('from') ++ if path.startswith('this://'): ++ path = koji.util.joinpath(desc_path, path[7:]) ++ else: ++ # we want to ignore other protocols, e.g. file://, https:// ++ # reachingoutside of repo ++ raise ValueError("Unhandled include protocol in include path: {path}.") + inc = xml.dom.minidom.parse(path) # nosec + # every included xml has image root element again + for node in inc.getElementsByTagName('image').childNodes: + diff --git a/3498.patch b/3498.patch new file mode 100644 index 0000000..eb2b4c9 --- /dev/null +++ b/3498.patch @@ -0,0 +1,23 @@ +From a8cbaf8195e8dcea4927cac5dde917592e313421 Mon Sep 17 00:00:00 2001 +From: Tomas Kopecek +Date: Sep 13 2022 13:59:14 +0000 +Subject: kiwi: Explicitely use koji-generated description + + +Related: https://pagure.io/koji/issue/3497 + +--- + +diff --git a/plugins/builder/kiwi.py b/plugins/builder/kiwi.py +index 41ef82e..2d2df67 100644 +--- a/plugins/builder/kiwi.py ++++ b/plugins/builder/kiwi.py +@@ -365,6 +365,7 @@ class KiwiCreateImageTask(BaseBuildTask): + cmd.extend([ + 'system', 'build', + '--description', os.path.join(os.path.basename(scmsrcdir), desc_path), ++ '--kiwi-file', desc, + '--target-dir', target_dir, + ]) + rv = broot.mock(['--cwd', broot.tmpdir(within=True), '--chroot', '--'] + cmd) + diff --git a/koji.spec b/koji.spec index 7e08a4f..5a36a75 100644 --- a/koji.spec +++ b/koji.spec @@ -9,13 +9,19 @@ Name: koji Version: 1.30.0 -Release: 1%{?dist} +Release: 2%{?dist} # the included arch lib from yum's rpmUtils is GPLv2+ License: LGPLv2 and GPLv2+ Summary: Build system tools URL: https://pagure.io/koji/ Source0: https://releases.pagure.org/koji/koji-%{version}.tar.bz2 +# Proposed upstream +## From: https://pagure.io/koji/pull-request/3496 +Patch1: 3496.patch +## From: https://pagure.io/koji/pull-request/3498 +Patch2: 3498.patch + # Not upstreamable Patch100: fedora-config.patch @@ -347,6 +353,9 @@ done %systemd_postun kojira.service %changelog +* Thu Sep 22 2022 Neal Gompa - 1.30.0-2 +- Backport fixes for kiwi-build command + * Mon Aug 29 2022 Kevin Fenzi - 1.30.0-1 - Update to 1.30.0. Fixes rhbz#2122127