Update to 1.31.1. Fixes rhbz#2144498

epel9
Kevin Fenzi 2 years ago
parent b595c52dd1
commit 7d7f8b27e1

1
.gitignore vendored

@ -43,3 +43,4 @@ koji-1.4.0.tar.bz2
/koji-1.29.1.tar.bz2
/koji-1.30.0.tar.bz2
/koji-1.30.1.tar.bz2
/koji-1.31.0.tar.bz2

@ -1,160 +0,0 @@
From 7fd19f2239004fcf4e8060a45b75acef255b2457 Mon Sep 17 00:00:00 2001
From: Tomas Kopecek <tkopecek@redhat.com>
Date: Tue, 18 Oct 2022 14:49:59 +0200
Subject: [PATCH 1/6] kiwi: propagate --type option
Related: https://pagure.io/koji/issue/3556
(cherry picked from commit 6083bace39ba891d6b5db5354de356f2704fa4a1)
---
plugins/builder/kiwi.py | 8 +++++---
plugins/cli/kiwi.py | 42 +++++++++++++++++++++++------------------
plugins/hub/kiwi.py | 26 ++++++++++++++++---------
3 files changed, 46 insertions(+), 30 deletions(-)
diff --git a/plugins/builder/kiwi.py b/plugins/builder/kiwi.py
index 42aa7071..7d6f6e7e 100644
--- a/plugins/builder/kiwi.py
+++ b/plugins/builder/kiwi.py
@@ -325,11 +325,11 @@ class KiwiCreateImageTask(BaseBuildTask):
'user_id': self.taskinfo['owner'],
'channel': self.session.getChannel(self.taskinfo['channel_id'],
strict=True)['name'],
- 'scratch': self.opts.get('scratch')
+ 'scratch': self.opts.get('scratch', False)
})
logfile = os.path.join(self.workdir, 'checkout-%s.log' % arch)
self.run_callbacks('preSCMCheckout', scminfo=scm.get_info(),
- build_tag=build_tag, scratch=self.opts.get('scratch'))
+ build_tag=build_tag, scratch=self.opts.get('scratch', False))
scmdir = broot.tmpdir()
koji.ensuredir(scmdir)
scmsrcdir = scm.checkout(scmdir, self.session,
@@ -337,7 +337,7 @@ class KiwiCreateImageTask(BaseBuildTask):
self.run_callbacks("postSCMCheckout",
scminfo=scm.get_info(),
build_tag=build_tag,
- scratch=self.opts.get('scratch'),
+ scratch=self.opts.get('scratch', False),
srcdir=scmsrcdir)
# user repos
@@ -365,6 +365,8 @@ class KiwiCreateImageTask(BaseBuildTask):
cmd = ['kiwi-ng']
if self.opts.get('profile'):
cmd.extend(['--profile', self.opts['profile']])
+ if self.opts.get('type'):
+ cmd.extend(['--type', self.opts['type']])
target_dir = '/builddir/result/image'
cmd.extend([
'--kiwi-file', os.path.basename(desc), # global option for image/system commands
diff --git a/plugins/cli/kiwi.py b/plugins/cli/kiwi.py
index 8786b135..07125d75 100644
--- a/plugins/cli/kiwi.py
+++ b/plugins/cli/kiwi.py
@@ -27,6 +27,7 @@ def handle_kiwi_build(goptions, session, args):
help="Do not display progress of the upload")
parser.add_option("--kiwi-profile", action="store", default=None,
help="Select profile from description file")
+ parser.add_option("--type", help="Override default build type from description")
parser.add_option("--make-prep", action="store_true", default=False,
help="Run 'make prep' in checkout before starting the build")
parser.add_option("--can-fail", action="store", dest="optional_arches",
@@ -46,28 +47,33 @@ def handle_kiwi_build(goptions, session, args):
target, scm, path = args
activate_session(session, goptions)
-
kwargs = {
- 'scratch': options.scratch,
- 'optional_arches': [canonArch(arch)
- for arch in options.optional_arches.split(',')
- if arch],
- 'profile': options.kiwi_profile,
- 'release': options.release,
- 'make_prep': options.make_prep,
+ 'arches': [],
+ 'target': target,
+ 'desc_url': scm,
+ 'desc_path': path,
}
-
- arches = []
+ if options.scratch:
+ kwargs['scratch'] = True
+ if options.optional_arches:
+ kwargs['optional_arches'] = [
+ canonArch(arch)
+ for arch in options.optional_arches.split(',')
+ if arch]
+ if options.kiwi_profile:
+ kwargs['profile'] = options.kiwi_profile,
+ if options.release:
+ kwargs['release'] = options.release
+ if options.make_prep:
+ kwargs['make_prep'] = True
+ if options.type:
+ kwargs['type'] = options.type
if options.arches:
- arches = [canonArch(arch) for arch in options.arches]
+ kwargs['arches'] = [canonArch(arch) for arch in options.arches]
+ if options.repo:
+ kwargs['repos'] = options.repo
- task_id = session.kiwiBuild(
- target=target,
- arches=arches,
- desc_url=scm,
- desc_path=path,
- repos=options.repo,
- **kwargs)
+ task_id = session.kiwiBuild(**kwargs)
if not goptions.quiet:
print("Created task: %d" % task_id)
diff --git a/plugins/hub/kiwi.py b/plugins/hub/kiwi.py
index 79da38a9..17b8e8e4 100644
--- a/plugins/hub/kiwi.py
+++ b/plugins/hub/kiwi.py
@@ -16,7 +16,8 @@ koji.tasks.LEGACY_SIGNATURES['createKiwiImage'] = [
@export
def kiwiBuild(target, arches, desc_url, desc_path, optional_arches=None, profile=None,
- scratch=False, priority=None, make_prep=False, repos=None, release=None):
+ scratch=False, priority=None, make_prep=False, repos=None, release=None,
+ type=None):
context.session.assertPerm('image')
for i in [desc_url, desc_path, profile, release]:
if i is not None:
@@ -42,14 +43,21 @@ def kiwiBuild(target, arches, desc_url, desc_path, optional_arches=None, profile
'only admins may create high-priority tasks')
taskOpts['priority'] = koji.PRIO_DEFAULT + priority
- opts = {
- 'optional_arches': optional_arches,
- 'profile': profile,
- 'scratch': bool(scratch),
- 'release': release,
- 'repos': repos or [],
- 'make_prep': bool(make_prep),
- }
+ opts = {}
+ if scratch:
+ opts['scratch'] = True
+ if profile:
+ opts['profile'] = profile
+ if release:
+ opts['release'] = release
+ if optional_arches:
+ opts['optional_arches'] = optional_arches,
+ if repos:
+ opts['repos'] = repos
+ if make_prep:
+ opts['make_prep'] = True
+ if type:
+ opts['type'] = type
return kojihub.make_task('kiwiBuild',
[target, arches, desc_url, desc_path, opts],
**taskOpts)
--
2.38.1

@ -1,40 +0,0 @@
From 0ccf95b7aa3332585217d5da2ff7b255e9cd4b14 Mon Sep 17 00:00:00 2001
From: Tomas Kopecek <tkopecek@redhat.com>
Date: Fri, 4 Nov 2022 10:06:48 +0100
Subject: [PATCH 2/6] fix additional commas
(cherry picked from commit 066e7427efca7a581cb1a63974dfdfec8194bd70)
---
plugins/cli/kiwi.py | 2 +-
plugins/hub/kiwi.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/plugins/cli/kiwi.py b/plugins/cli/kiwi.py
index 07125d75..6e965c05 100644
--- a/plugins/cli/kiwi.py
+++ b/plugins/cli/kiwi.py
@@ -61,7 +61,7 @@ def handle_kiwi_build(goptions, session, args):
for arch in options.optional_arches.split(',')
if arch]
if options.kiwi_profile:
- kwargs['profile'] = options.kiwi_profile,
+ kwargs['profile'] = options.kiwi_profile
if options.release:
kwargs['release'] = options.release
if options.make_prep:
diff --git a/plugins/hub/kiwi.py b/plugins/hub/kiwi.py
index 17b8e8e4..7b0c2f05 100644
--- a/plugins/hub/kiwi.py
+++ b/plugins/hub/kiwi.py
@@ -51,7 +51,7 @@ def kiwiBuild(target, arches, desc_url, desc_path, optional_arches=None, profile
if release:
opts['release'] = release
if optional_arches:
- opts['optional_arches'] = optional_arches,
+ opts['optional_arches'] = optional_arches
if repos:
opts['repos'] = repos
if make_prep:
--
2.38.1

@ -1,27 +0,0 @@
From 39cfeea12a38df825e264ce3a71489f35d4b95c3 Mon Sep 17 00:00:00 2001
From: Tomas Kopecek <tkopecek@redhat.com>
Date: Mon, 31 Oct 2022 13:09:19 +0100
Subject: [PATCH 3/6] kiwi: don't bind builders's /dev
Related: https://pagure.io/koji/issue/3567
(cherry picked from commit 655cb9797fe85f8dc1244f233da2919abfa1548f)
---
plugins/builder/kiwi.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugins/builder/kiwi.py b/plugins/builder/kiwi.py
index 7d6f6e7e..e220d515 100644
--- a/plugins/builder/kiwi.py
+++ b/plugins/builder/kiwi.py
@@ -307,7 +307,7 @@ class KiwiCreateImageTask(BaseBuildTask):
repo_id=repo_info['id'],
install_group='kiwi-build',
setup_dns=True,
- bind_opts={'dirs': {'/dev': '/dev', }})
+ bind_opts={'dirs': {}})
broot.workdir = self.workdir
# create the mock chroot
--
2.38.1

@ -1,83 +0,0 @@
From a08967bce60d50ec1d27741512dc96f6ed546594 Mon Sep 17 00:00:00 2001
From: Tomas Kopecek <tkopecek@redhat.com>
Date: Fri, 4 Nov 2022 10:13:16 +0100
Subject: [PATCH 4/6] allow to set it by user
(cherry picked from commit 5dcf480a401581442ace9b17e9c2a06241885ae6)
---
plugins/builder/kiwi.py | 6 +++++-
plugins/cli/kiwi.py | 4 ++++
plugins/hub/kiwi.py | 4 +++-
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/plugins/builder/kiwi.py b/plugins/builder/kiwi.py
index e220d515..b70a13a3 100644
--- a/plugins/builder/kiwi.py
+++ b/plugins/builder/kiwi.py
@@ -300,6 +300,10 @@ class KiwiCreateImageTask(BaseBuildTask):
desc_url, desc_path, opts=None):
self.opts = opts
build_tag = target_info['build_tag']
+ if opts.get('bind_dev'):
+ bind_opts = {'dirs': {'/dev': '/dev'}}
+ else:
+ bind_opts = None
broot = BuildRoot(self.session, self.options,
tag=build_tag,
arch=arch,
@@ -307,7 +311,7 @@ class KiwiCreateImageTask(BaseBuildTask):
repo_id=repo_info['id'],
install_group='kiwi-build',
setup_dns=True,
- bind_opts={'dirs': {}})
+ bind_opts=bind_opts)
broot.workdir = self.workdir
# create the mock chroot
diff --git a/plugins/cli/kiwi.py b/plugins/cli/kiwi.py
index 6e965c05..61764efb 100644
--- a/plugins/cli/kiwi.py
+++ b/plugins/cli/kiwi.py
@@ -30,6 +30,9 @@ def handle_kiwi_build(goptions, session, args):
parser.add_option("--type", help="Override default build type from description")
parser.add_option("--make-prep", action="store_true", default=False,
help="Run 'make prep' in checkout before starting the build")
+ parser.add_option("--bind-dev", action="store_true", default=False,
+ help="e.g. images using device-mapper needs /dev mounted in kiwi env, "
+ "while others can fail in such env.")
parser.add_option("--can-fail", action="store", dest="optional_arches",
metavar="ARCH1,ARCH2,...", default="",
help="List of archs which are not blocking for build "
@@ -52,6 +55,7 @@ def handle_kiwi_build(goptions, session, args):
'target': target,
'desc_url': scm,
'desc_path': path,
+ 'bind_dev': options.bind_dev,
}
if options.scratch:
kwargs['scratch'] = True
diff --git a/plugins/hub/kiwi.py b/plugins/hub/kiwi.py
index 7b0c2f05..f83b209d 100644
--- a/plugins/hub/kiwi.py
+++ b/plugins/hub/kiwi.py
@@ -17,7 +17,7 @@ koji.tasks.LEGACY_SIGNATURES['createKiwiImage'] = [
@export
def kiwiBuild(target, arches, desc_url, desc_path, optional_arches=None, profile=None,
scratch=False, priority=None, make_prep=False, repos=None, release=None,
- type=None):
+ type=None, bind_dev=False):
context.session.assertPerm('image')
for i in [desc_url, desc_path, profile, release]:
if i is not None:
@@ -52,6 +52,8 @@ def kiwiBuild(target, arches, desc_url, desc_path, optional_arches=None, profile
opts['release'] = release
if optional_arches:
opts['optional_arches'] = optional_arches
+ if bind_dev:
+ opts['bind_dev'] = bind_dev
if repos:
opts['repos'] = repos
if make_prep:
--
2.38.1

@ -1,38 +0,0 @@
From 3a4286be435f6e734c528ab3a649cfd7d44e1338 Mon Sep 17 00:00:00 2001
From: Tomas Kopecek <tkopecek@redhat.com>
Date: Mon, 17 Oct 2022 12:26:55 +0200
Subject: [PATCH 5/6] fix include path
Related: https://pagure.io/koji/issue/3553
(cherry picked from commit b8b52884b5208dc7ea25881108b7da5eb3d9fc86)
---
plugins/builder/kiwi.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/plugins/builder/kiwi.py b/plugins/builder/kiwi.py
index b70a13a3..4033b520 100644
--- a/plugins/builder/kiwi.py
+++ b/plugins/builder/kiwi.py
@@ -197,16 +197,17 @@ class KiwiCreateImageTask(BaseBuildTask):
for inc_node in image.getElementsByTagName('include'):
path = inc_node.getAttribute('from')
if path.startswith('this://'):
- path = koji.util.joinpath(desc_path, path[7:])
+ path = koji.util.joinpath(os.path.dirname(desc_path), path[7:])
else:
# we want to reject other protocols, e.g. file://, https://
# reachingoutside of repo
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:
+ for node in list(inc.getElementsByTagName('image')[0].childNodes):
if node.nodeName != 'repository':
image.appendChild(node)
+ image.removeChild(inc_node)
# remove remaining old repos
for old_repo in image.getElementsByTagName('repository'):
--
2.38.1

@ -1,33 +0,0 @@
From c3b6e3d0bab224b1bf829c7e16a16a4fdfb1bf7a Mon Sep 17 00:00:00 2001
From: Tomas Kopecek <tkopecek@redhat.com>
Date: Thu, 10 Nov 2022 10:42:30 +0100
Subject: [PATCH 6/6] better error for wrong include xml format
(cherry picked from commit 8b1030f8635ba2688630adf951ac849197c19cd8)
---
plugins/builder/kiwi.py | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/plugins/builder/kiwi.py b/plugins/builder/kiwi.py
index 4033b520..bc216c2e 100644
--- a/plugins/builder/kiwi.py
+++ b/plugins/builder/kiwi.py
@@ -204,9 +204,12 @@ class KiwiCreateImageTask(BaseBuildTask):
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 list(inc.getElementsByTagName('image')[0].childNodes):
- if node.nodeName != 'repository':
- image.appendChild(node)
+ try:
+ for node in list(inc.getElementsByTagName('image')[0].childNodes):
+ if node.nodeName != 'repository':
+ image.appendChild(node)
+ except IndexError:
+ raise koji.GenericError("Included file needs to contain <image> tag.")
image.removeChild(inc_node)
# remove remaining old repos
--
2.38.1

@ -8,23 +8,14 @@
%{?!python3_pkgversion:%global python3_pkgversion 3}
Name: koji
Version: 1.30.1
Release: 3%{?dist}
Version: 1.31.0
Release: 1%{?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
# Backports
Patch0001: 0001-kiwi-propagate-type-option.patch
Patch0002: 0002-fix-additional-commas.patch
Patch0003: 0003-kiwi-don-t-bind-builders-s-dev.patch
Patch0004: 0004-allow-to-set-it-by-user.patch
Patch0005: 0005-fix-include-path.patch
# Proposed upstream
# Not upstreamable
Patch1000: fedora-config.patch
@ -356,6 +347,9 @@ done
%systemd_postun kojira.service
%changelog
* Mon Nov 21 2022 Kevin Fenzi <kevin@scrye.com> - 1.31.0-1
- Update to 1.31.1. Fixes rhbz#2144498
* Sat Nov 05 2022 Igor Raits <ignatenkobrain@fedoraproject.org> - 1.30.1-3
- Update kiwi patchset

@ -1 +1 @@
SHA512 (koji-1.30.1.tar.bz2) = d5b0ca21c8f09a6346273c449f643a93a1edaabea82ea6d19aeba057c1d770c980f28545f42cb6bb2f28e8e20784b7c7c65f4bf2ce4957138f86bbab7925ee4b
SHA512 (koji-1.31.0.tar.bz2) = 8be8e72182f1c33dea7d308708f71a9c6bcfe896348c1ccc640a07a216070cb0951ee8dfc103897239a687dbd54c5544bc29cbb15ca09083852e3aa428f03887

Loading…
Cancel
Save