Refresh kiwi-build patches to latest versions

epel9
Neal Gompa 2 years ago
parent c15b855e4e
commit b66aea3c8d

@ -1,6 +1,6 @@
From ec7f9c2f6e26b74e6f41b3fe67998e9c2aa6dec0 Mon Sep 17 00:00:00 2001
From d1d8f512c1f62412333acc983c382d44a18d7240 Mon Sep 17 00:00:00 2001
From: Tomas Kopecek <tkopecek@redhat.com>
Date: Sep 15 2022 07:08:50 +0000
Date: Sep 29 2022 13:40:38 +0000
Subject: kiwi: handle include protocols
@ -27,7 +27,7 @@ index 1a6994a..6654504 100644
============================
diff --git a/plugins/builder/kiwi.py b/plugins/builder/kiwi.py
index 41ef82e..9148fc5 100644
index 41ef82e..ee1216c 100644
--- a/plugins/builder/kiwi.py
+++ b/plugins/builder/kiwi.py
@@ -4,6 +4,7 @@ import xml.dom.minidom
@ -45,9 +45,9 @@ index 41ef82e..9148fc5 100644
+ if path.startswith('this://'):
+ path = koji.util.joinpath(desc_path, path[7:])
+ else:
+ # we want to ignore other protocols, e.g. file://, https://
+ # we want to reject other protocols, e.g. file://, https://
+ # reachingoutside of repo
+ raise ValueError("Unhandled include protocol in include path: {path}.")
+ raise koji.GenericError(f"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:

@ -1,6 +1,6 @@
From a8cbaf8195e8dcea4927cac5dde917592e313421 Mon Sep 17 00:00:00 2001
From 0570e46fb00c4a3c841468f33a8d1f7c352a1fe1 Mon Sep 17 00:00:00 2001
From: Tomas Kopecek <tkopecek@redhat.com>
Date: Sep 13 2022 13:59:14 +0000
Date: Oct 03 2022 09:39:03 +0000
Subject: kiwi: Explicitely use koji-generated description
@ -9,14 +9,94 @@ Related: https://pagure.io/koji/issue/3497
---
diff --git a/plugins/builder/kiwi.py b/plugins/builder/kiwi.py
index 41ef82e..2d2df67 100644
index ee1216c..42aa707 100644
--- a/plugins/builder/kiwi.py
+++ b/plugins/builder/kiwi.py
@@ -365,6 +365,7 @@ class KiwiCreateImageTask(BaseBuildTask):
@@ -1,4 +1,3 @@
-import glob
import os
import xml.dom.minidom
from fnmatch import fnmatch
@@ -13,15 +12,17 @@ class KiwiBuildTask(BuildImageTask):
Methods = ['kiwiBuild']
_taskWeight = 4.0
- def get_nvrp(self, desc_path):
- kiwi_files = glob.glob('%s/*.kiwi' % desc_path)
- if len(kiwi_files) != 1:
- raise koji.GenericError("Repo must contain only one .kiwi file.")
-
- cfg = kiwi_files[0]
-
- newxml = xml.dom.minidom.parse(cfg) # nosec
- image = newxml.getElementsByTagName('image')[0]
+ def get_nvrp(self, cfg):
+ try:
+ newxml = xml.dom.minidom.parse(cfg) # nosec
+ except Exception:
+ raise koji.GenericError(
+ f"Kiwi description {os.path.basename(cfg)} can't be parsed as XML.")
+ try:
+ image = newxml.getElementsByTagName('image')[0]
+ except IndexError:
+ raise koji.GenericError(
+ f"Kiwi description {os.path.basename(cfg)} doesn't contain <image> tag.")
name = image.getAttribute('name')
version = None
@@ -186,13 +187,8 @@ class KiwiCreateImageTask(BaseBuildTask):
_taskWeight = 2.0
def prepareDescription(self, desc_path, name, version, repos, arch):
- kiwi_files = glob.glob('%s/*.kiwi' % desc_path)
- if len(kiwi_files) != 1:
- raise koji.GenericError("Repo must contain only one .kiwi file.")
-
- cfg = kiwi_files[0]
-
- newxml = xml.dom.minidom.parse(cfg) # nosec
+ # XML errors should have already been caught by parent task
+ newxml = xml.dom.minidom.parse(desc_path) # nosec
image = newxml.getElementsByTagName('image')[0]
# apply includes - kiwi can include only top-level nodes, so we can simply
@@ -242,13 +238,13 @@ class KiwiCreateImageTask(BaseBuildTask):
types.append(type.getAttribute('image'))
# write new file
- newcfg = f'{cfg[:-5]}.{arch}.kiwi'
+ newcfg = os.path.splitext(desc_path)[0] + f'.{arch}.kiwi'
with open(newcfg, 'wt') as f:
s = newxml.toprettyxml()
# toprettyxml adds too many whitespaces/newlines
s = '\n'.join([x for x in s.splitlines() if x.strip()])
f.write(s)
- os.unlink(cfg)
+ os.unlink(desc_path)
return newcfg, types
@@ -353,10 +349,11 @@ class KiwiCreateImageTask(BaseBuildTask):
self.logger.debug('BASEURL: %s' % baseurl)
repos.append(baseurl)
+ base_path = os.path.dirname(desc_path)
if opts.get('make_prep'):
cmd = ['make', 'prep']
rv = broot.mock(['--cwd', os.path.join(broot.tmpdir(within=True),
- os.path.basename(scmsrcdir), desc_path),
+ os.path.basename(scmsrcdir), base_path),
'--chroot', '--'] + cmd)
if rv:
raise koji.GenericError("Preparation step failed")
@@ -370,8 +367,9 @@ class KiwiCreateImageTask(BaseBuildTask):
cmd.extend(['--profile', self.opts['profile']])
target_dir = '/builddir/result/image'
cmd.extend([
+ '--kiwi-file', os.path.basename(desc), # global option for image/system commands
'system', 'build',
'--description', os.path.join(os.path.basename(scmsrcdir), desc_path),
+ '--kiwi-file', desc,
- '--description', os.path.join(os.path.basename(scmsrcdir), desc_path),
+ '--description', os.path.join(os.path.basename(scmsrcdir), base_path),
'--target-dir', target_dir,
])
rv = broot.mock(['--cwd', broot.tmpdir(within=True), '--chroot', '--'] + cmd)

@ -9,7 +9,7 @@
Name: koji
Version: 1.30.0
Release: 2%{?dist}
Release: 3%{?dist}
# the included arch lib from yum's rpmUtils is GPLv2+
License: LGPLv2 and GPLv2+
Summary: Build system tools
@ -353,6 +353,9 @@ done
%systemd_postun kojira.service
%changelog
* Mon Oct 03 2022 Neal Gompa <ngompa@fedoraproject.org> - 1.30.0-3
- Refresh kiwi-build patches to latest versions
* Thu Sep 22 2022 Neal Gompa <ngompa@fedoraproject.org> - 1.30.0-2
- Backport fixes for kiwi-build command

Loading…
Cancel
Save