Update to 1.35.0. Fixes rhbz#2312848 Update to 1.35.0. Fixes rhbz#2312848 Update to 1.35.0. Fixes rhbz#2312848 Update to 1.35.0. Fixes rhbz#2312848 Update to 1.35.0. Fixes rhbz#2312848 Update to 1.35.0. Fixes rhbz#2312848 Update to 1.35.0. Fixes rhbz#2312848 Update to 1.35.0. Fixes rhbz#2312848 Update to 1.35.0. Fixes rhbz#2312848 Update to 1.35.0. Fixes rhbz#2312848 Update to 1.35.0. Fixes rhbz#2312848 Update to 1.35.0. Fixes rhbz#2312848epel9
parent
1fa1abdca0
commit
4b0c627b7c
@ -1,29 +0,0 @@
|
|||||||
From 3e0b8103d26d4430de391635e699c0035bc39d36 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Adam Williamson <awilliam@redhat.com>
|
|
||||||
Date: Thu, 22 Aug 2024 09:44:50 -0700
|
|
||||||
Subject: [PATCH] Fix a typo in the kiwi image type attribute override patch
|
|
||||||
|
|
||||||
This colon was duplicated, which is syntactically invalid and
|
|
||||||
prevents the file from loading at all.
|
|
||||||
|
|
||||||
Signed-off-by: Adam Williamson <awilliam@redhat.com>
|
|
||||||
---
|
|
||||||
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 1b4a9481..369071ef 100644
|
|
||||||
--- a/plugins/builder/kiwi.py
|
|
||||||
+++ b/plugins/builder/kiwi.py
|
|
||||||
@@ -389,7 +389,7 @@ class KiwiCreateImageTask(BaseBuildTask):
|
|
||||||
'--description', os.path.join(os.path.basename(scmsrcdir), base_path),
|
|
||||||
'--target-dir', target_dir,
|
|
||||||
])
|
|
||||||
- for typeattr in self.opts.get('type_attr', [])::
|
|
||||||
+ for typeattr in self.opts.get('type_attr', []):
|
|
||||||
cmd.extend(['--set-type-attr', typeattr])
|
|
||||||
rv = broot.mock(['--cwd', broot.tmpdir(within=True), '--chroot', '--'] + cmd)
|
|
||||||
if rv:
|
|
||||||
--
|
|
||||||
2.46.0
|
|
||||||
|
|
@ -1,82 +0,0 @@
|
|||||||
From b22449c553b344fd3a1ee7cb49c769754ddfa347 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Neal Gompa <ngompa@velocitylimitless.com>
|
|
||||||
Date: Sun, 11 Aug 2024 14:42:31 -0400
|
|
||||||
Subject: [PATCH 1/2] kiwi: Add support for overriding image type attributes
|
|
||||||
|
|
||||||
This allows setting things like the volume and application IDs
|
|
||||||
for ISO builds.
|
|
||||||
---
|
|
||||||
plugins/builder/kiwi.py | 2 ++
|
|
||||||
plugins/cli/kiwi.py | 5 +++++
|
|
||||||
plugins/hub/kiwi.py | 6 +++++-
|
|
||||||
3 files changed, 12 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/plugins/builder/kiwi.py b/plugins/builder/kiwi.py
|
|
||||||
index a9d63cf0..99737f7c 100644
|
|
||||||
--- a/plugins/builder/kiwi.py
|
|
||||||
+++ b/plugins/builder/kiwi.py
|
|
||||||
@@ -389,6 +389,8 @@ class KiwiCreateImageTask(BaseBuildTask):
|
|
||||||
'--description', os.path.join(os.path.basename(scmsrcdir), base_path),
|
|
||||||
'--target-dir', target_dir,
|
|
||||||
])
|
|
||||||
+ for typeattr in self.opts.get('type_attr', [])::
|
|
||||||
+ cmd.extend(['--set-type-attr', typeattr])
|
|
||||||
rv = broot.mock(['--cwd', broot.tmpdir(within=True), '--chroot', '--'] + cmd)
|
|
||||||
if rv:
|
|
||||||
raise koji.GenericError("Kiwi failed")
|
|
||||||
diff --git a/plugins/cli/kiwi.py b/plugins/cli/kiwi.py
|
|
||||||
index 6e965c05..7e3e9771 100644
|
|
||||||
--- a/plugins/cli/kiwi.py
|
|
||||||
+++ b/plugins/cli/kiwi.py
|
|
||||||
@@ -28,6 +28,9 @@ def handle_kiwi_build(goptions, session, args):
|
|
||||||
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("--type-attr", action="append", default=[],
|
|
||||||
+ help="Override default attributes for the build type from description. "
|
|
||||||
+ "May be used multiple times.")
|
|
||||||
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",
|
|
||||||
@@ -68,6 +71,8 @@ def handle_kiwi_build(goptions, session, args):
|
|
||||||
kwargs['make_prep'] = True
|
|
||||||
if options.type:
|
|
||||||
kwargs['type'] = options.type
|
|
||||||
+ if options.type_attr:
|
|
||||||
+ kwargs['type_attr'] = options.type_attr
|
|
||||||
if options.arches:
|
|
||||||
kwargs['arches'] = [canonArch(arch) for arch in options.arches]
|
|
||||||
if options.repo:
|
|
||||||
diff --git a/plugins/hub/kiwi.py b/plugins/hub/kiwi.py
|
|
||||||
index 7b0c2f05..852cbad1 100644
|
|
||||||
--- a/plugins/hub/kiwi.py
|
|
||||||
+++ b/plugins/hub/kiwi.py
|
|
||||||
@@ -17,13 +17,15 @@ 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, type_attr=None):
|
|
||||||
context.session.assertPerm('image')
|
|
||||||
for i in [desc_url, desc_path, profile, release]:
|
|
||||||
if i is not None:
|
|
||||||
kojihub.convert_value(i, cast=str, check_only=True)
|
|
||||||
if repos:
|
|
||||||
kojihub.convert_value(repos, cast=list, check_only=True)
|
|
||||||
+ if type_attr:
|
|
||||||
+ kojihub.convert_value(type_attr, cast=list, check_only=True)
|
|
||||||
kojihub.get_build_target(target, strict=True)
|
|
||||||
if isinstance(arches, list):
|
|
||||||
arches = " ".join(arches)
|
|
||||||
@@ -58,6 +60,8 @@ def kiwiBuild(target, arches, desc_url, desc_path, optional_arches=None, profile
|
|
||||||
opts['make_prep'] = True
|
|
||||||
if type:
|
|
||||||
opts['type'] = type
|
|
||||||
+ if type_attr:
|
|
||||||
+ opts['type_attr'] = type_attr
|
|
||||||
return kojihub.make_task('kiwiBuild',
|
|
||||||
[target, arches, desc_url, desc_path, opts],
|
|
||||||
**taskOpts)
|
|
||||||
--
|
|
||||||
2.46.0
|
|
||||||
|
|
@ -1,39 +0,0 @@
|
|||||||
From 694ac4148301ef1efb69fbef0072190e1671a356 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Neal Gompa <neal@gompa.dev>
|
|
||||||
Date: Wed, 20 Mar 2024 12:45:17 -0400
|
|
||||||
Subject: [PATCH 1/6] kiwi: Only add buildroot repo if user repositories are
|
|
||||||
not defined
|
|
||||||
|
|
||||||
In general, we assume that if the user is specifying repositories,
|
|
||||||
the built-in one should not be used.
|
|
||||||
---
|
|
||||||
plugins/builder/kiwi.py | 13 +++++++------
|
|
||||||
1 file changed, 7 insertions(+), 6 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/plugins/builder/kiwi.py b/plugins/builder/kiwi.py
|
|
||||||
index 369071ef..d5d4fbdc 100644
|
|
||||||
--- a/plugins/builder/kiwi.py
|
|
||||||
+++ b/plugins/builder/kiwi.py
|
|
||||||
@@ -351,12 +351,13 @@ class KiwiCreateImageTask(BaseBuildTask):
|
|
||||||
|
|
||||||
# user repos
|
|
||||||
repos = self.opts.get('repos', [])
|
|
||||||
- # buildroot repo
|
|
||||||
- path_info = koji.PathInfo(topdir=self.options.topurl)
|
|
||||||
- repopath = path_info.repo(repo_info['id'], target_info['build_tag_name'])
|
|
||||||
- baseurl = '%s/%s' % (repopath, arch)
|
|
||||||
- self.logger.debug('BASEURL: %s' % baseurl)
|
|
||||||
- repos.append(baseurl)
|
|
||||||
+ # buildroot repo if user repos not defined
|
|
||||||
+ if repos == []:
|
|
||||||
+ path_info = koji.PathInfo(topdir=self.options.topurl)
|
|
||||||
+ repopath = path_info.repo(repo_info['id'], target_info['build_tag_name'])
|
|
||||||
+ baseurl = '%s/%s' % (repopath, arch)
|
|
||||||
+ self.logger.debug('BASEURL: %s' % baseurl)
|
|
||||||
+ repos.append(baseurl)
|
|
||||||
|
|
||||||
base_path = os.path.dirname(desc_path)
|
|
||||||
if opts.get('make_prep'):
|
|
||||||
--
|
|
||||||
2.46.0
|
|
||||||
|
|
@ -1,83 +0,0 @@
|
|||||||
From 06840501bd7b52ee38a7a0c337cadfbf4512fc5d Mon Sep 17 00:00:00 2001
|
|
||||||
From: Neal Gompa <ngompa@velocitylimitless.com>
|
|
||||||
Date: Sun, 11 Aug 2024 15:11:51 -0400
|
|
||||||
Subject: [PATCH 2/2] kiwi: Add support for overriding kiwi image file name
|
|
||||||
format
|
|
||||||
|
|
||||||
In order to be able to support workflows where the exact structure
|
|
||||||
of the image filenames matter (e.g. for Linux distribution artifacts),
|
|
||||||
support optionally overriding the image file name structure.
|
|
||||||
---
|
|
||||||
plugins/builder/kiwi.py | 2 ++
|
|
||||||
plugins/cli/kiwi.py | 3 +++
|
|
||||||
plugins/hub/kiwi.py | 6 +++++-
|
|
||||||
3 files changed, 10 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/plugins/builder/kiwi.py b/plugins/builder/kiwi.py
|
|
||||||
index 99737f7c..1b4a9481 100644
|
|
||||||
--- a/plugins/builder/kiwi.py
|
|
||||||
+++ b/plugins/builder/kiwi.py
|
|
||||||
@@ -408,6 +408,8 @@ class KiwiCreateImageTask(BaseBuildTask):
|
|
||||||
'--target-dir', target_dir,
|
|
||||||
'--bundle-dir', bundle_dir,
|
|
||||||
'--id', release]
|
|
||||||
+ if self.opts.get('result_bundle_name_format'):
|
|
||||||
+ cmd.extend(['--bundle-format', self.opts['result_bundle_name_format']])
|
|
||||||
rv = broot.mock(['--cwd', broot.tmpdir(within=True), '--chroot', '--'] + cmd)
|
|
||||||
if rv:
|
|
||||||
raise koji.GenericError("Kiwi failed")
|
|
||||||
diff --git a/plugins/cli/kiwi.py b/plugins/cli/kiwi.py
|
|
||||||
index 7e3e9771..f0172575 100644
|
|
||||||
--- a/plugins/cli/kiwi.py
|
|
||||||
+++ b/plugins/cli/kiwi.py
|
|
||||||
@@ -31,6 +31,7 @@ def handle_kiwi_build(goptions, session, args):
|
|
||||||
parser.add_option("--type-attr", action="append", default=[],
|
|
||||||
help="Override default attributes for the build type from description. "
|
|
||||||
"May be used multiple times.")
|
|
||||||
+ parser.add_option("--result-bundle-name-format", help="Override default bundle name format")
|
|
||||||
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",
|
|
||||||
@@ -73,6 +74,8 @@ def handle_kiwi_build(goptions, session, args):
|
|
||||||
kwargs['type'] = options.type
|
|
||||||
if options.type_attr:
|
|
||||||
kwargs['type_attr'] = options.type_attr
|
|
||||||
+ if options.result_bundle_name_format:
|
|
||||||
+ kwargs['result_bundle_name_format'] = options.result_bundle_name_format
|
|
||||||
if options.arches:
|
|
||||||
kwargs['arches'] = [canonArch(arch) for arch in options.arches]
|
|
||||||
if options.repo:
|
|
||||||
diff --git a/plugins/hub/kiwi.py b/plugins/hub/kiwi.py
|
|
||||||
index 852cbad1..15f352cc 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_attr=None):
|
|
||||||
+ type=None, type_attr=None, result_bundle_name_format=None):
|
|
||||||
context.session.assertPerm('image')
|
|
||||||
for i in [desc_url, desc_path, profile, release]:
|
|
||||||
if i is not None:
|
|
||||||
@@ -26,6 +26,8 @@ def kiwiBuild(target, arches, desc_url, desc_path, optional_arches=None, profile
|
|
||||||
kojihub.convert_value(repos, cast=list, check_only=True)
|
|
||||||
if type_attr:
|
|
||||||
kojihub.convert_value(type_attr, cast=list, check_only=True)
|
|
||||||
+ if result_bundle_name_format:
|
|
||||||
+ kojihub.convert_value(result_bundle_name_format, cast=str, check_only=True)
|
|
||||||
kojihub.get_build_target(target, strict=True)
|
|
||||||
if isinstance(arches, list):
|
|
||||||
arches = " ".join(arches)
|
|
||||||
@@ -62,6 +64,8 @@ def kiwiBuild(target, arches, desc_url, desc_path, optional_arches=None, profile
|
|
||||||
opts['type'] = type
|
|
||||||
if type_attr:
|
|
||||||
opts['type_attr'] = type_attr
|
|
||||||
+ if result_bundle_name_format:
|
|
||||||
+ opts['result_bundle_name_format'] = result_bundle_name_format
|
|
||||||
return kojihub.make_task('kiwiBuild',
|
|
||||||
[target, arches, desc_url, desc_path, opts],
|
|
||||||
**taskOpts)
|
|
||||||
--
|
|
||||||
2.46.0
|
|
||||||
|
|
@ -1,75 +0,0 @@
|
|||||||
From b13d481d56059fd51a8f9109d0d64d3f11fcbccc Mon Sep 17 00:00:00 2001
|
|
||||||
From: Tomas Kopecek <tkopecek@redhat.com>
|
|
||||||
Date: Mon, 25 Mar 2024 11:33:41 +0100
|
|
||||||
Subject: [PATCH 2/6] kiwi: option for not using buildroot repo
|
|
||||||
|
|
||||||
Related: https://pagure.io/koji/issue/4062
|
|
||||||
---
|
|
||||||
plugins/builder/kiwi.py | 3 +--
|
|
||||||
plugins/cli/kiwi.py | 6 ++++++
|
|
||||||
plugins/hub/kiwi.py | 4 +++-
|
|
||||||
3 files changed, 10 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/plugins/builder/kiwi.py b/plugins/builder/kiwi.py
|
|
||||||
index d5d4fbdc..a878ad56 100644
|
|
||||||
--- a/plugins/builder/kiwi.py
|
|
||||||
+++ b/plugins/builder/kiwi.py
|
|
||||||
@@ -351,8 +351,7 @@ class KiwiCreateImageTask(BaseBuildTask):
|
|
||||||
|
|
||||||
# user repos
|
|
||||||
repos = self.opts.get('repos', [])
|
|
||||||
- # buildroot repo if user repos not defined
|
|
||||||
- if repos == []:
|
|
||||||
+ if self.opts.get('use_buildroot_repo', True):
|
|
||||||
path_info = koji.PathInfo(topdir=self.options.topurl)
|
|
||||||
repopath = path_info.repo(repo_info['id'], target_info['build_tag_name'])
|
|
||||||
baseurl = '%s/%s' % (repopath, arch)
|
|
||||||
diff --git a/plugins/cli/kiwi.py b/plugins/cli/kiwi.py
|
|
||||||
index f0172575..6611df73 100644
|
|
||||||
--- a/plugins/cli/kiwi.py
|
|
||||||
+++ b/plugins/cli/kiwi.py
|
|
||||||
@@ -34,6 +34,10 @@ def handle_kiwi_build(goptions, session, args):
|
|
||||||
parser.add_option("--result-bundle-name-format", help="Override default bundle name format")
|
|
||||||
parser.add_option("--make-prep", action="store_true", default=False,
|
|
||||||
help="Run 'make prep' in checkout before starting the build")
|
|
||||||
+ parser.add_option("--no-buildroot-repo", action="store_false",
|
|
||||||
+ dest="use_buildroot_repo", default=True,
|
|
||||||
+ help="Don't add buildroot repo to installation sources, "
|
|
||||||
+ "use only those provided by --repo option.")
|
|
||||||
parser.add_option("--can-fail", action="store", dest="optional_arches",
|
|
||||||
metavar="ARCH1,ARCH2,...", default="",
|
|
||||||
help="List of archs which are not blocking for build "
|
|
||||||
@@ -80,6 +84,8 @@ def handle_kiwi_build(goptions, session, args):
|
|
||||||
kwargs['arches'] = [canonArch(arch) for arch in options.arches]
|
|
||||||
if options.repo:
|
|
||||||
kwargs['repos'] = options.repo
|
|
||||||
+ if not options.use_buildroot_repo:
|
|
||||||
+ kwargs['use_buildroot_repo'] = False
|
|
||||||
|
|
||||||
task_id = session.kiwiBuild(**kwargs)
|
|
||||||
|
|
||||||
diff --git a/plugins/hub/kiwi.py b/plugins/hub/kiwi.py
|
|
||||||
index 15f352cc..cd03ab42 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_attr=None, result_bundle_name_format=None):
|
|
||||||
+ type=None, type_attr=None, result_bundle_name_format=None, use_buildroot_repo=True):
|
|
||||||
context.session.assertPerm('image')
|
|
||||||
for i in [desc_url, desc_path, profile, release]:
|
|
||||||
if i is not None:
|
|
||||||
@@ -62,6 +62,8 @@ def kiwiBuild(target, arches, desc_url, desc_path, optional_arches=None, profile
|
|
||||||
opts['make_prep'] = True
|
|
||||||
if type:
|
|
||||||
opts['type'] = type
|
|
||||||
+ if not use_buildroot_repo:
|
|
||||||
+ opts['use_buildroot_repo'] = False
|
|
||||||
if type_attr:
|
|
||||||
opts['type_attr'] = type_attr
|
|
||||||
if result_bundle_name_format:
|
|
||||||
--
|
|
||||||
2.46.0
|
|
||||||
|
|
@ -1,72 +0,0 @@
|
|||||||
From dd594826f21a5b6b493ffd360745dc3b4af5c978 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Tomas Kopecek <tkopecek@redhat.com>
|
|
||||||
Date: Thu, 9 May 2024 12:04:33 +0200
|
|
||||||
Subject: [PATCH 3/6] Don't use buildroot repo by default
|
|
||||||
|
|
||||||
---
|
|
||||||
plugins/builder/kiwi.py | 2 +-
|
|
||||||
plugins/cli/kiwi.py | 12 ++++++------
|
|
||||||
plugins/hub/kiwi.py | 4 ++--
|
|
||||||
3 files changed, 9 insertions(+), 9 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/plugins/builder/kiwi.py b/plugins/builder/kiwi.py
|
|
||||||
index a878ad56..2ac5cb3b 100644
|
|
||||||
--- a/plugins/builder/kiwi.py
|
|
||||||
+++ b/plugins/builder/kiwi.py
|
|
||||||
@@ -351,7 +351,7 @@ class KiwiCreateImageTask(BaseBuildTask):
|
|
||||||
|
|
||||||
# user repos
|
|
||||||
repos = self.opts.get('repos', [])
|
|
||||||
- if self.opts.get('use_buildroot_repo', True):
|
|
||||||
+ if self.opts.get('use_buildroot_repo', False):
|
|
||||||
path_info = koji.PathInfo(topdir=self.options.topurl)
|
|
||||||
repopath = path_info.repo(repo_info['id'], target_info['build_tag_name'])
|
|
||||||
baseurl = '%s/%s' % (repopath, arch)
|
|
||||||
diff --git a/plugins/cli/kiwi.py b/plugins/cli/kiwi.py
|
|
||||||
index 6611df73..840e7539 100644
|
|
||||||
--- a/plugins/cli/kiwi.py
|
|
||||||
+++ b/plugins/cli/kiwi.py
|
|
||||||
@@ -34,10 +34,10 @@ def handle_kiwi_build(goptions, session, args):
|
|
||||||
parser.add_option("--result-bundle-name-format", help="Override default bundle name format")
|
|
||||||
parser.add_option("--make-prep", action="store_true", default=False,
|
|
||||||
help="Run 'make prep' in checkout before starting the build")
|
|
||||||
- parser.add_option("--no-buildroot-repo", action="store_false",
|
|
||||||
- dest="use_buildroot_repo", default=True,
|
|
||||||
- help="Don't add buildroot repo to installation sources, "
|
|
||||||
- "use only those provided by --repo option.")
|
|
||||||
+ parser.add_option("--buildroot-repo", action="store_false",
|
|
||||||
+ dest="use_buildroot_repo", default=False,
|
|
||||||
+ help="Add buildroot repo to installation sources. This is off by default, "
|
|
||||||
+ "but uf there is no --repo used, it will be turned on automatically.")
|
|
||||||
parser.add_option("--can-fail", action="store", dest="optional_arches",
|
|
||||||
metavar="ARCH1,ARCH2,...", default="",
|
|
||||||
help="List of archs which are not blocking for build "
|
|
||||||
@@ -84,8 +84,8 @@ def handle_kiwi_build(goptions, session, args):
|
|
||||||
kwargs['arches'] = [canonArch(arch) for arch in options.arches]
|
|
||||||
if options.repo:
|
|
||||||
kwargs['repos'] = options.repo
|
|
||||||
- if not options.use_buildroot_repo:
|
|
||||||
- kwargs['use_buildroot_repo'] = False
|
|
||||||
+ if options.use_buildroot_repo or not options.repo:
|
|
||||||
+ kwargs['use_buildroot_repo'] = True
|
|
||||||
|
|
||||||
task_id = session.kiwiBuild(**kwargs)
|
|
||||||
|
|
||||||
diff --git a/plugins/hub/kiwi.py b/plugins/hub/kiwi.py
|
|
||||||
index cd03ab42..81852e52 100644
|
|
||||||
--- a/plugins/hub/kiwi.py
|
|
||||||
+++ b/plugins/hub/kiwi.py
|
|
||||||
@@ -62,8 +62,8 @@ def kiwiBuild(target, arches, desc_url, desc_path, optional_arches=None, profile
|
|
||||||
opts['make_prep'] = True
|
|
||||||
if type:
|
|
||||||
opts['type'] = type
|
|
||||||
- if not use_buildroot_repo:
|
|
||||||
- opts['use_buildroot_repo'] = False
|
|
||||||
+ if use_buildroot_repo:
|
|
||||||
+ opts['use_buildroot_repo'] = True
|
|
||||||
if type_attr:
|
|
||||||
opts['type_attr'] = type_attr
|
|
||||||
if result_bundle_name_format:
|
|
||||||
--
|
|
||||||
2.46.0
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
|||||||
From 810836944ad9aaf28c935e14db4405b96201ed55 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Tomas Kopecek <tkopecek@redhat.com>
|
|
||||||
Date: Mon, 13 May 2024 11:02:53 +0200
|
|
||||||
Subject: [PATCH 4/6] version check + typo fixes
|
|
||||||
|
|
||||||
---
|
|
||||||
plugins/cli/kiwi.py | 14 +++++++++++---
|
|
||||||
1 file changed, 11 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/plugins/cli/kiwi.py b/plugins/cli/kiwi.py
|
|
||||||
index 840e7539..8f8addaf 100644
|
|
||||||
--- a/plugins/cli/kiwi.py
|
|
||||||
+++ b/plugins/cli/kiwi.py
|
|
||||||
@@ -7,6 +7,7 @@ from koji_cli.lib import (
|
|
||||||
_running_in_bg,
|
|
||||||
activate_session,
|
|
||||||
watch_tasks,
|
|
||||||
+ warn,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@@ -34,10 +35,10 @@ def handle_kiwi_build(goptions, session, args):
|
|
||||||
parser.add_option("--result-bundle-name-format", help="Override default bundle name format")
|
|
||||||
parser.add_option("--make-prep", action="store_true", default=False,
|
|
||||||
help="Run 'make prep' in checkout before starting the build")
|
|
||||||
- parser.add_option("--buildroot-repo", action="store_false",
|
|
||||||
+ parser.add_option("--buildroot-repo", action="store_true",
|
|
||||||
dest="use_buildroot_repo", default=False,
|
|
||||||
help="Add buildroot repo to installation sources. This is off by default, "
|
|
||||||
- "but uf there is no --repo used, it will be turned on automatically.")
|
|
||||||
+ "but if there is no --repo used, it will be turned on automatically.")
|
|
||||||
parser.add_option("--can-fail", action="store", dest="optional_arches",
|
|
||||||
metavar="ARCH1,ARCH2,...", default="",
|
|
||||||
help="List of archs which are not blocking for build "
|
|
||||||
@@ -85,7 +86,14 @@ def handle_kiwi_build(goptions, session, args):
|
|
||||||
if options.repo:
|
|
||||||
kwargs['repos'] = options.repo
|
|
||||||
if options.use_buildroot_repo or not options.repo:
|
|
||||||
- kwargs['use_buildroot_repo'] = True
|
|
||||||
+ if not options.repo:
|
|
||||||
+ warn("no repos given, using buildroot repo")
|
|
||||||
+ if session.hub_version >= (1, 35, 0):
|
|
||||||
+ # for older plugin versions it is the default behaviour
|
|
||||||
+ # and option doesn't exist
|
|
||||||
+ kwargs['use_buildroot_repo'] = True
|
|
||||||
+ if session.hub_version < (1, 35, 0):
|
|
||||||
+ warn("hub version is < 1.35, buildroot repo is always used in addition to specified repos")
|
|
||||||
|
|
||||||
task_id = session.kiwiBuild(**kwargs)
|
|
||||||
|
|
||||||
--
|
|
||||||
2.46.0
|
|
||||||
|
|
@ -1,38 +0,0 @@
|
|||||||
From 0e43634af51842f92da3911899d0d10f4b544a51 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Tomas Kopecek <tkopecek@redhat.com>
|
|
||||||
Date: Wed, 15 May 2024 09:26:36 +0200
|
|
||||||
Subject: [PATCH 5/6] improve warnings for older hub
|
|
||||||
|
|
||||||
---
|
|
||||||
plugins/cli/kiwi.py | 13 ++++++-------
|
|
||||||
1 file changed, 6 insertions(+), 7 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/plugins/cli/kiwi.py b/plugins/cli/kiwi.py
|
|
||||||
index 8f8addaf..02958373 100644
|
|
||||||
--- a/plugins/cli/kiwi.py
|
|
||||||
+++ b/plugins/cli/kiwi.py
|
|
||||||
@@ -85,15 +85,14 @@ def handle_kiwi_build(goptions, session, args):
|
|
||||||
kwargs['arches'] = [canonArch(arch) for arch in options.arches]
|
|
||||||
if options.repo:
|
|
||||||
kwargs['repos'] = options.repo
|
|
||||||
- if options.use_buildroot_repo or not options.repo:
|
|
||||||
- if not options.repo:
|
|
||||||
- warn("no repos given, using buildroot repo")
|
|
||||||
- if session.hub_version >= (1, 35, 0):
|
|
||||||
- # for older plugin versions it is the default behaviour
|
|
||||||
- # and option doesn't exist
|
|
||||||
- kwargs['use_buildroot_repo'] = True
|
|
||||||
+
|
|
||||||
if session.hub_version < (1, 35, 0):
|
|
||||||
warn("hub version is < 1.35, buildroot repo is always used in addition to specified repos")
|
|
||||||
+ elif options.use_buildroot_repo:
|
|
||||||
+ kwargs['use_buildroot_repo'] = True
|
|
||||||
+ elif not options.repo:
|
|
||||||
+ warn("no repos given, using buildroot repo")
|
|
||||||
+ kwargs['use_buildroot_repo'] = True
|
|
||||||
|
|
||||||
task_id = session.kiwiBuild(**kwargs)
|
|
||||||
|
|
||||||
--
|
|
||||||
2.46.0
|
|
||||||
|
|
@ -1,146 +0,0 @@
|
|||||||
From a5dd7950434e4ff8dc37d77803f23dcb480aaa4b Mon Sep 17 00:00:00 2001
|
|
||||||
From: Neal Gompa <ngompa@velocitylimitless.com>
|
|
||||||
Date: Mon, 26 Aug 2024 10:02:43 -0400
|
|
||||||
Subject: [PATCH 6/6] kiwi: Add support for overriding version and releasever
|
|
||||||
|
|
||||||
This allows for kiwi descriptions that are compatible across
|
|
||||||
multiple targets to be easily used without needless modifications.
|
|
||||||
|
|
||||||
Additionally, it allows for custom values when preparing milestone
|
|
||||||
releases without needlessly modifying the descriptions.
|
|
||||||
---
|
|
||||||
plugins/builder/kiwi.py | 15 +++++++++++----
|
|
||||||
plugins/cli/kiwi.py | 6 ++++++
|
|
||||||
plugins/hub/kiwi.py | 9 +++++++--
|
|
||||||
3 files changed, 24 insertions(+), 6 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/plugins/builder/kiwi.py b/plugins/builder/kiwi.py
|
|
||||||
index 2ac5cb3b..f222dec1 100644
|
|
||||||
--- a/plugins/builder/kiwi.py
|
|
||||||
+++ b/plugins/builder/kiwi.py
|
|
||||||
@@ -103,6 +103,8 @@ class KiwiBuildTask(BuildImageTask):
|
|
||||||
name = "%s-%s" % (name, opts.get('profile', default_profile))
|
|
||||||
|
|
||||||
bld_info = {}
|
|
||||||
+ if opts.get('version'):
|
|
||||||
+ version = opts['version']
|
|
||||||
if opts.get('release'):
|
|
||||||
release = opts['release']
|
|
||||||
else:
|
|
||||||
@@ -188,7 +190,7 @@ class KiwiCreateImageTask(BaseBuildTask):
|
|
||||||
Methods = ['createKiwiImage']
|
|
||||||
_taskWeight = 2.0
|
|
||||||
|
|
||||||
- def prepareDescription(self, desc_path, name, version, repos, arch):
|
|
||||||
+ def prepareDescription(self, desc_path, name, version, repos, repo_releasever, arch):
|
|
||||||
# XML errors should have already been caught by parent task
|
|
||||||
newxml = xml.dom.minidom.parse(desc_path) # nosec
|
|
||||||
image = newxml.getElementsByTagName('image')[0]
|
|
||||||
@@ -229,11 +231,15 @@ class KiwiCreateImageTask(BaseBuildTask):
|
|
||||||
|
|
||||||
image.setAttribute('name', name)
|
|
||||||
preferences = image.getElementsByTagName('preferences')[0]
|
|
||||||
+
|
|
||||||
+ # Handle version and release-version
|
|
||||||
+ preferences.getElementsByTagName('version')[0].childNodes[0].data = version
|
|
||||||
try:
|
|
||||||
- preferences.getElementsByTagName('release-version')[0].childNodes[0].data = version
|
|
||||||
+ preferences.getElementsByTagName('release-version')[0].childNodes[0].data \
|
|
||||||
+ = repo_releasever
|
|
||||||
except IndexError:
|
|
||||||
releasever_node = newxml.createElement('release-version')
|
|
||||||
- text = newxml.createTextNode(version)
|
|
||||||
+ text = newxml.createTextNode(repo_releasever)
|
|
||||||
releasever_node.appendChild(text)
|
|
||||||
preferences.appendChild(releasever_node)
|
|
||||||
|
|
||||||
@@ -357,6 +363,7 @@ class KiwiCreateImageTask(BaseBuildTask):
|
|
||||||
baseurl = '%s/%s' % (repopath, arch)
|
|
||||||
self.logger.debug('BASEURL: %s' % baseurl)
|
|
||||||
repos.append(baseurl)
|
|
||||||
+ repo_releasever = self.opts.get('repo_releasever', version)
|
|
||||||
|
|
||||||
base_path = os.path.dirname(desc_path)
|
|
||||||
if opts.get('make_prep'):
|
|
||||||
@@ -368,7 +375,7 @@ class KiwiCreateImageTask(BaseBuildTask):
|
|
||||||
raise koji.GenericError("Preparation step failed")
|
|
||||||
|
|
||||||
path = os.path.join(scmsrcdir, desc_path)
|
|
||||||
- desc, types = self.prepareDescription(path, name, version, repos, arch)
|
|
||||||
+ desc, types = self.prepareDescription(path, name, version, repos, repo_releasever, arch)
|
|
||||||
self.uploadFile(desc)
|
|
||||||
|
|
||||||
target_dir = '/builddir/result/image'
|
|
||||||
diff --git a/plugins/cli/kiwi.py b/plugins/cli/kiwi.py
|
|
||||||
index 02958373..9d177ac9 100644
|
|
||||||
--- a/plugins/cli/kiwi.py
|
|
||||||
+++ b/plugins/cli/kiwi.py
|
|
||||||
@@ -19,11 +19,13 @@ def handle_kiwi_build(goptions, session, args):
|
|
||||||
parser = OptionParser(usage=usage)
|
|
||||||
parser.add_option("--scratch", action="store_true", default=False,
|
|
||||||
help="Perform a scratch build")
|
|
||||||
+ parser.add_option("--version", help="Override default version of the output image")
|
|
||||||
parser.add_option("--release", help="Release of the output image")
|
|
||||||
parser.add_option("--repo", action="append",
|
|
||||||
help="Specify a repo that will override the repo used to install "
|
|
||||||
"RPMs in the image. May be used multiple times. The "
|
|
||||||
"build tag repo associated with the target is the default.")
|
|
||||||
+ parser.add_option("--repo-releasever", help="Override default releasever of the output image")
|
|
||||||
parser.add_option("--noprogress", action="store_true",
|
|
||||||
help="Do not display progress of the upload")
|
|
||||||
parser.add_option("--kiwi-profile", action="store", default=None,
|
|
||||||
@@ -71,6 +73,8 @@ def handle_kiwi_build(goptions, session, args):
|
|
||||||
if arch]
|
|
||||||
if options.kiwi_profile:
|
|
||||||
kwargs['profile'] = options.kiwi_profile
|
|
||||||
+ if options.version:
|
|
||||||
+ kwargs['version'] = options.version
|
|
||||||
if options.release:
|
|
||||||
kwargs['release'] = options.release
|
|
||||||
if options.make_prep:
|
|
||||||
@@ -85,6 +89,8 @@ def handle_kiwi_build(goptions, session, args):
|
|
||||||
kwargs['arches'] = [canonArch(arch) for arch in options.arches]
|
|
||||||
if options.repo:
|
|
||||||
kwargs['repos'] = options.repo
|
|
||||||
+ if options.repo_releasever:
|
|
||||||
+ kwargs['repo_releasever'] = options.repo_releasever
|
|
||||||
|
|
||||||
if session.hub_version < (1, 35, 0):
|
|
||||||
warn("hub version is < 1.35, buildroot repo is always used in addition to specified repos")
|
|
||||||
diff --git a/plugins/hub/kiwi.py b/plugins/hub/kiwi.py
|
|
||||||
index 81852e52..4aeb1048 100644
|
|
||||||
--- a/plugins/hub/kiwi.py
|
|
||||||
+++ b/plugins/hub/kiwi.py
|
|
||||||
@@ -17,9 +17,10 @@ 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_attr=None, result_bundle_name_format=None, use_buildroot_repo=True):
|
|
||||||
+ type=None, type_attr=None, result_bundle_name_format=None, use_buildroot_repo=True,
|
|
||||||
+ version=None, repo_releasever=None):
|
|
||||||
context.session.assertPerm('image')
|
|
||||||
- for i in [desc_url, desc_path, profile, release]:
|
|
||||||
+ for i in [desc_url, desc_path, profile, version, release, repo_releasever]:
|
|
||||||
if i is not None:
|
|
||||||
kojihub.convert_value(i, cast=str, check_only=True)
|
|
||||||
if repos:
|
|
||||||
@@ -52,12 +53,16 @@ def kiwiBuild(target, arches, desc_url, desc_path, optional_arches=None, profile
|
|
||||||
opts['scratch'] = True
|
|
||||||
if profile:
|
|
||||||
opts['profile'] = profile
|
|
||||||
+ if version:
|
|
||||||
+ opts['version'] = version
|
|
||||||
if release:
|
|
||||||
opts['release'] = release
|
|
||||||
if optional_arches:
|
|
||||||
opts['optional_arches'] = optional_arches
|
|
||||||
if repos:
|
|
||||||
opts['repos'] = repos
|
|
||||||
+ if repo_releasever:
|
|
||||||
+ opts['repo_releasever'] = repo_releasever
|
|
||||||
if make_prep:
|
|
||||||
opts['make_prep'] = True
|
|
||||||
if type:
|
|
||||||
--
|
|
||||||
2.46.0
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
|||||||
From 0251961929a45ccae1d635b7e85a9d8826baf72d Mon Sep 17 00:00:00 2001
|
|
||||||
From: Tomas Kopecek <tkopecek@redhat.com>
|
|
||||||
Date: Feb 07 2024 13:45:08 +0000
|
|
||||||
Subject: PR#3989: Oz: don't hardcode the image size unit as 'G'
|
|
||||||
|
|
||||||
|
|
||||||
Merges #3989
|
|
||||||
https://pagure.io/koji/pull-request/3989
|
|
||||||
|
|
||||||
Fixes: #3993
|
|
||||||
https://pagure.io/koji/issue/3993
|
|
||||||
Oz: don't hardcode the image size unit as 'G'
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
diff --git a/builder/kojid b/builder/kojid
|
|
||||||
index fe35e47..b4536dd 100755
|
|
||||||
--- a/builder/kojid
|
|
||||||
+++ b/builder/kojid
|
|
||||||
@@ -4101,7 +4101,7 @@ class OzImageTask(BaseTaskHandler):
|
|
||||||
template += """</os>
|
|
||||||
<description>%s OS</description>
|
|
||||||
<disk>
|
|
||||||
- <size>%sG</size>
|
|
||||||
+ <size>%s</size>
|
|
||||||
</disk>
|
|
||||||
</template>
|
|
||||||
""" % (name, self.opts.get('disk_size')) # noqa: E501
|
|
||||||
|
|
@ -1,229 +0,0 @@
|
|||||||
From 1d515927aeb3e3c052fc9208ca71133d9d097fc0 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Tomas Kopecek <tkopecek@redhat.com>
|
|
||||||
Date: Thu, 13 Apr 2023 11:12:40 +0200
|
|
||||||
Subject: [PATCH] scmpolicy plugin
|
|
||||||
|
|
||||||
---
|
|
||||||
docs/source/defining_hub_policies.rst | 10 +++-
|
|
||||||
docs/source/plugins.rst | 30 ++++++++++-
|
|
||||||
koji/policy.py | 53 +++++++++++++++++++-
|
|
||||||
plugins/builder/scmpolicy.py | 72 +++++++++++++++++++++++++++
|
|
||||||
4 files changed, 162 insertions(+), 3 deletions(-)
|
|
||||||
create mode 100644 plugins/builder/scmpolicy.py
|
|
||||||
|
|
||||||
diff --git a/docs/source/defining_hub_policies.rst b/docs/source/defining_hub_policies.rst
|
|
||||||
index a0b67eed..8f9cf2cd 100644
|
|
||||||
--- a/docs/source/defining_hub_policies.rst
|
|
||||||
+++ b/docs/source/defining_hub_policies.rst
|
|
||||||
@@ -341,5 +341,13 @@ Available tests
|
|
||||||
* the user matched is the user performing the action
|
|
||||||
|
|
||||||
``match``
|
|
||||||
- * matches a field in the data against glob patterns
|
|
||||||
+ * matches a field in the data against glob patterns
|
|
||||||
* true if any pattern matches
|
|
||||||
+
|
|
||||||
+``match_any``
|
|
||||||
+ * matches a field (of list/tuple/set type) in the data against glob patterns
|
|
||||||
+ * true if any field item matches all patterns
|
|
||||||
+
|
|
||||||
+``match_all``
|
|
||||||
+ * matches a field (of list/tuple/set type) in the data against glob patterns
|
|
||||||
+ * true if all field items match any pattern
|
|
||||||
diff --git a/docs/source/plugins.rst b/docs/source/plugins.rst
|
|
||||||
index c370709a..d5b2d13f 100644
|
|
||||||
--- a/docs/source/plugins.rst
|
|
||||||
+++ b/docs/source/plugins.rst
|
|
||||||
@@ -223,7 +223,7 @@ The ``[message]`` section sets parameters for how messages are formed.
|
|
||||||
Currently only one field is understood:
|
|
||||||
|
|
||||||
* ``extra_limit`` -- the maximum allowed size for ``build.extra`` fields that
|
|
||||||
- appear in messages. If the ``build.extra`` field is longer (in terms of
|
|
||||||
+ appear in messages. If the ``build.extra`` field is longer (in terms of
|
|
||||||
json-encoded length), then it will be omitted. The default value is ``0``
|
|
||||||
which means no limit.
|
|
||||||
|
|
||||||
@@ -441,3 +441,31 @@ For example:
|
|
||||||
For each RPM in the tag, Koji will use the first signed copy that it finds. In other words,
|
|
||||||
Koji will try the first key (`45719a39`), and if Koji does not have the first key's signature
|
|
||||||
for that RPM, then it will try the second key (`9867c58f`), third key (`38ab71f4`), and so on.
|
|
||||||
+
|
|
||||||
+Scm Policies
|
|
||||||
+============
|
|
||||||
+
|
|
||||||
+Basic filtering of allowed scms normally happens via standard
|
|
||||||
+``build_from_scm`` hub policy. Nevertheless, some relevant information can be
|
|
||||||
+only gathered after cloning the repo. Typical case is that admin would like to
|
|
||||||
+build content only from some set of allowed branches. If user specify the
|
|
||||||
+commit via hash, we don't have that information in moment of task creation.
|
|
||||||
+Just after cloning we can check existing branches and if the given commit is on
|
|
||||||
+some of the relevant ones. For this purpose there is special
|
|
||||||
+``postSCMCheckout`` plugin ``scmpolicy``.
|
|
||||||
+
|
|
||||||
+Installation happens only on builder via editing ``/etc/kojid.conf`` by adding
|
|
||||||
+``plugin = scmpolicy`` there. Plugin itself is not configured but uses hub
|
|
||||||
+policy ``scm``. Policy data provided there are composed of two parts. First one
|
|
||||||
+are ``scm_*`` values which are same as in ``build_from_scm``.
|
|
||||||
+
|
|
||||||
+.. code::
|
|
||||||
+
|
|
||||||
+ scm =
|
|
||||||
+ # allow scratch builds from any commits
|
|
||||||
+ bool scratch :: allow
|
|
||||||
+ # very safe scm, allow anything from there, but only to special target
|
|
||||||
+ match scm_host very.safe.git.org && buildtag testing-build-tag :: allow
|
|
||||||
+ match_all branches * !! deny Commit must be present on some branch
|
|
||||||
+ match_all branches private-* test-* :: deny Private/testing branches are not allowed
|
|
||||||
+ all :: allow
|
|
||||||
diff --git a/koji/policy.py b/koji/policy.py
|
|
||||||
index 729e02e5..8a570575 100644
|
|
||||||
--- a/koji/policy.py
|
|
||||||
+++ b/koji/policy.py
|
|
||||||
@@ -25,7 +25,7 @@ import logging
|
|
||||||
import six
|
|
||||||
|
|
||||||
import koji
|
|
||||||
-from koji.util import to_list
|
|
||||||
+from koji.util import to_list, multi_fnmatch
|
|
||||||
|
|
||||||
|
|
||||||
class BaseSimpleTest(object):
|
|
||||||
@@ -141,6 +141,57 @@ class MatchTest(BaseSimpleTest):
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
+class MatchAnyTest(BaseSimpleTest):
|
|
||||||
+ """Matches any item of a list/tuple/set value in the data against glob patterns
|
|
||||||
+
|
|
||||||
+ True if any of the expressions matches any item in the list/tuple/set, else False.
|
|
||||||
+ If the field doesn't exist or isn't a list/tuple/set, the test returns False
|
|
||||||
+
|
|
||||||
+ Syntax:
|
|
||||||
+ find field pattern1 [pattern2 ...]
|
|
||||||
+
|
|
||||||
+ """
|
|
||||||
+ name = 'match_any'
|
|
||||||
+ field = None
|
|
||||||
+
|
|
||||||
+ def run(self, data):
|
|
||||||
+ args = self.str.split()[1:]
|
|
||||||
+ self.field = args[0]
|
|
||||||
+ args = args[1:]
|
|
||||||
+ tgt = data.get(self.field)
|
|
||||||
+ if tgt and isinstance(tgt, (list, tuple, set)):
|
|
||||||
+ for i in tgt:
|
|
||||||
+ if i is not None and multi_fnmatch(str(i), args):
|
|
||||||
+ return True
|
|
||||||
+ return False
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+class MatchAllTest(BaseSimpleTest):
|
|
||||||
+ """Matches all items of a list/tuple/set value in the data against glob patterns
|
|
||||||
+
|
|
||||||
+ True if any of the expressions matches all items in the list/tuple/set, else False.
|
|
||||||
+ If the field doesn't exist or isn't a list/tuple/set, the test returns False
|
|
||||||
+
|
|
||||||
+ Syntax:
|
|
||||||
+ match_all field pattern1 [pattern2 ...]
|
|
||||||
+
|
|
||||||
+ """
|
|
||||||
+ name = 'match_all'
|
|
||||||
+ field = None
|
|
||||||
+
|
|
||||||
+ def run(self, data):
|
|
||||||
+ args = self.str.split()[1:]
|
|
||||||
+ self.field = args[0]
|
|
||||||
+ args = args[1:]
|
|
||||||
+ tgt = data.get(self.field)
|
|
||||||
+ if tgt and isinstance(tgt, (list, tuple, set)):
|
|
||||||
+ for i in tgt:
|
|
||||||
+ if i is None or not multi_fnmatch(str(i), args):
|
|
||||||
+ return False
|
|
||||||
+ return True
|
|
||||||
+ return False
|
|
||||||
+
|
|
||||||
+
|
|
||||||
class TargetTest(MatchTest):
|
|
||||||
"""Matches target in the data against glob patterns
|
|
||||||
|
|
||||||
diff --git a/plugins/builder/scmpolicy.py b/plugins/builder/scmpolicy.py
|
|
||||||
new file mode 100644
|
|
||||||
index 00000000..f120e33b
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/plugins/builder/scmpolicy.py
|
|
||||||
@@ -0,0 +1,72 @@
|
|
||||||
+import logging
|
|
||||||
+import re
|
|
||||||
+import subprocess
|
|
||||||
+
|
|
||||||
+import six
|
|
||||||
+
|
|
||||||
+from koji import ActionNotAllowed, GenericError
|
|
||||||
+from koji.plugin import callback
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+logger = logging.getLogger('koji.plugins.scmpolicy')
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+@callback('postSCMCheckout')
|
|
||||||
+def assert_scm_policy(clb_type, *args, **kwargs):
|
|
||||||
+ taskinfo = kwargs['taskinfo']
|
|
||||||
+ session = kwargs['session']
|
|
||||||
+ build_tag = kwargs['build_tag']
|
|
||||||
+ scminfo = kwargs['scminfo']
|
|
||||||
+ srcdir = kwargs['srcdir']
|
|
||||||
+ scratch = kwargs['scratch']
|
|
||||||
+
|
|
||||||
+ method = get_task_method(session, taskinfo)
|
|
||||||
+
|
|
||||||
+ policy_data = {
|
|
||||||
+ 'build_tag': build_tag,
|
|
||||||
+ 'method': method,
|
|
||||||
+ 'scratch': scratch,
|
|
||||||
+ 'branches': get_branches(srcdir)
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ # Merge scminfo into data with "scm_" prefix. And "scm*" are changed to "scm_*".
|
|
||||||
+ for k, v in six.iteritems(scminfo):
|
|
||||||
+ policy_data[re.sub(r'^(scm_?)?', 'scm_', k)] = v
|
|
||||||
+
|
|
||||||
+ logger.info("Checking SCM policy for task %s", taskinfo['id'])
|
|
||||||
+ logger.debug("Policy data: %r", policy_data)
|
|
||||||
+
|
|
||||||
+ # check the policy
|
|
||||||
+ try:
|
|
||||||
+ session.host.assertPolicy('scm', policy_data)
|
|
||||||
+ logger.info("SCM policy check for task %s: PASSED", taskinfo['id'])
|
|
||||||
+ except ActionNotAllowed:
|
|
||||||
+ logger.warning("SCM policy check for task %s: DENIED", taskinfo['id'])
|
|
||||||
+ raise
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+def get_task_method(session, taskinfo):
|
|
||||||
+ """Get the Task method from taskinfo"""
|
|
||||||
+ method = None
|
|
||||||
+ if isinstance(taskinfo, six.integer_types):
|
|
||||||
+ taskinfo = session.getTaskInfo(taskinfo, strict=True)
|
|
||||||
+ if isinstance(taskinfo, dict):
|
|
||||||
+ method = taskinfo.get('method')
|
|
||||||
+ if method is None:
|
|
||||||
+ raise GenericError("Invalid taskinfo: %s" % taskinfo)
|
|
||||||
+ return method
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+def get_branches(srcdir):
|
|
||||||
+ """Determine which remote branches contain the current checkout"""
|
|
||||||
+ cmd = ['git', 'branch', '-r', '--contains', 'HEAD']
|
|
||||||
+ proc = subprocess.Popen(cmd, cwd=srcdir, stdout=subprocess.PIPE)
|
|
||||||
+ (out, _) = proc.communicate()
|
|
||||||
+ status = proc.wait()
|
|
||||||
+ if status != 0:
|
|
||||||
+ raise Exception('Error getting branches for git checkout')
|
|
||||||
+
|
|
||||||
+ # cut off origin/ prefix
|
|
||||||
+ branches = [b.strip() for b in out.decode().split('\n') if 'origin/HEAD' not in b and b]
|
|
||||||
+ branches = [re.sub('^origin/', '', b) for b in branches]
|
|
||||||
+ return branches
|
|
||||||
--
|
|
||||||
GitLab
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
|||||||
From 2a6e18fa356f1aa2a1b5099e55e0af1c89ae4163 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Mike McLean <mikem@redhat.com>
|
|
||||||
Date: Feb 05 2024 10:28:43 +0000
|
|
||||||
Subject: typo in set_refusal
|
|
||||||
|
|
||||||
|
|
||||||
Fixes https://pagure.io/koji/issue/3997
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
diff --git a/kojihub/scheduler.py b/kojihub/scheduler.py
|
|
||||||
index 815b0f1..961ef39 100644
|
|
||||||
--- a/kojihub/scheduler.py
|
|
||||||
+++ b/kojihub/scheduler.py
|
|
||||||
@@ -91,8 +91,8 @@ def get_tasks_for_host(hostID, retry=True):
|
|
||||||
|
|
||||||
def set_refusal(hostID, taskID, soft=True, by_host=False, msg=''):
|
|
||||||
data = {
|
|
||||||
- 'task_id': kojihub.convert_value(hostID, cast=int),
|
|
||||||
- 'host_id': kojihub.convert_value(taskID, cast=int),
|
|
||||||
+ 'host_id': kojihub.convert_value(hostID, cast=int),
|
|
||||||
+ 'task_id': kojihub.convert_value(taskID, cast=int),
|
|
||||||
'soft': kojihub.convert_value(soft, cast=bool),
|
|
||||||
'by_host': kojihub.convert_value(by_host, cast=bool),
|
|
||||||
'msg': kojihub.convert_value(msg, cast=str),
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
|||||||
From 36953540662aa39ff1b85218cefededfa4e529a9 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Tomas Kopecek <tkopecek@redhat.com>
|
|
||||||
Date: Jan 15 2024 12:48:16 +0000
|
|
||||||
Subject: Use dnf5-compatible "group install" command
|
|
||||||
|
|
||||||
|
|
||||||
* yum knows only "yum groupinstall"
|
|
||||||
* dnf < 5 knows both
|
|
||||||
* dnf-5 only "dnf5 group install"
|
|
||||||
|
|
||||||
It is reasonable to assume that dnf is used in most setups, so changing
|
|
||||||
default to "group install". If yum is specified *explicitly* via
|
|
||||||
tags's extra "mock.package_manager", "groupinstall" is used instead.
|
|
||||||
|
|
||||||
Related: https://pagure.io/koji/issue/3971
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
diff --git a/koji/__init__.py b/koji/__init__.py
|
|
||||||
index 334b403..9b222cd 100644
|
|
||||||
--- a/koji/__init__.py
|
|
||||||
+++ b/koji/__init__.py
|
|
||||||
@@ -1804,7 +1804,7 @@ def genMockConfig(name, arch, managed=False, repoid=None, tag_name=None, **opts)
|
|
||||||
'target_arch': opts.get('target_arch', arch),
|
|
||||||
'chroothome': '/builddir',
|
|
||||||
# Use the group data rather than a generated rpm
|
|
||||||
- 'chroot_setup_cmd': 'groupinstall %s' % opts.get('install_group', 'build'),
|
|
||||||
+ 'chroot_setup_cmd': 'group install %s' % opts.get('install_group', 'build'),
|
|
||||||
# don't encourage network access from the chroot
|
|
||||||
'rpmbuild_networking': opts.get('use_host_resolv', False),
|
|
||||||
'use_host_resolv': opts.get('use_host_resolv', False),
|
|
||||||
@@ -1817,6 +1817,10 @@ def genMockConfig(name, arch, managed=False, repoid=None, tag_name=None, **opts)
|
|
||||||
config_opts['forcearch'] = opts['forcearch']
|
|
||||||
if opts.get('package_manager'):
|
|
||||||
config_opts['package_manager'] = opts['package_manager']
|
|
||||||
+ if opts['package_manager'].endswith('yum'):
|
|
||||||
+ # backward compatibility with yum (doesn't have separate "group")
|
|
||||||
+ config_opts['chroot_setup_cmd'] = \
|
|
||||||
+ 'groupinstall %s' % opts.get('install_group', 'build')
|
|
||||||
if opts.get('bootstrap_image'):
|
|
||||||
config_opts['use_bootstrap_image'] = True
|
|
||||||
config_opts['bootstrap_image'] = opts['bootstrap_image']
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
|||||||
From bc8e6253f519eeb78fbc8740bba25e8a34490814 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Mike McLean <mikem@redhat.com>
|
|
||||||
Date: Feb 14 2024 06:40:24 +0000
|
|
||||||
Subject: let tag.extra override tag arches for noarch
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
diff --git a/builder/kojid b/builder/kojid
|
|
||||||
index b4536dd..8b81d66 100755
|
|
||||||
--- a/builder/kojid
|
|
||||||
+++ b/builder/kojid
|
|
||||||
@@ -1339,23 +1339,33 @@ class BuildTask(BaseTaskHandler):
|
|
||||||
exclusivearch = koji.get_header_field(h, 'exclusivearch')
|
|
||||||
excludearch = koji.get_header_field(h, 'excludearch')
|
|
||||||
|
|
||||||
- if exclusivearch or excludearch:
|
|
||||||
+ buildconfig = self.session.getBuildConfig(build_tag, event=self.event_id)
|
|
||||||
+ noarch_arches = buildconfig.get('extra', {}).get('noarch_arches')
|
|
||||||
+
|
|
||||||
+ if exclusivearch or excludearch or noarch_arches:
|
|
||||||
# if one of the tag arches is filtered out, then we can't use a
|
|
||||||
# noarch task
|
|
||||||
- buildconfig = self.session.getBuildConfig(build_tag, event=self.event_id)
|
|
||||||
arches = buildconfig['arches']
|
|
||||||
tag_arches = [koji.canonArch(a) for a in arches.split()]
|
|
||||||
exclusivearch = [koji.canonArch(a) for a in exclusivearch]
|
|
||||||
excludearch = [koji.canonArch(a) for a in excludearch]
|
|
||||||
- archlist = list(tag_arches)
|
|
||||||
+ # tag.extra overrides tag arches for noarch
|
|
||||||
+ if noarch_arches:
|
|
||||||
+ archlist = [koji.canonArch(a) for a in noarch_arches.split()]
|
|
||||||
+ archlist = [a for a in archlist if a in tag_arches]
|
|
||||||
+ else:
|
|
||||||
+ archlist = list(tag_arches)
|
|
||||||
if exclusivearch:
|
|
||||||
archlist = [a for a in archlist if a in exclusivearch]
|
|
||||||
if excludearch:
|
|
||||||
archlist = [a for a in archlist if a not in excludearch]
|
|
||||||
+ self.logger.info('Filtering arches for noarch subtask. Choices: %r', archlist)
|
|
||||||
if not archlist:
|
|
||||||
- raise koji.BuildError("No valid arches were found. tag %r, "
|
|
||||||
- "exclusive %r, exclude %r" % (tag_arches,
|
|
||||||
+ raise koji.BuildError("No valid arches were found. tag %r, extra %r,"
|
|
||||||
+ "exclusive %r, exclude %r" % (tag_arches, noarch_arches,
|
|
||||||
exclusivearch, excludearch))
|
|
||||||
+ self.logger.debug('tag: %r, extra: %r, exclusive: %r, exclude: %r',
|
|
||||||
+ tag_arches, noarch_arches, exclusivearch, excludearch)
|
|
||||||
if set(archlist) != set(tag_arches):
|
|
||||||
return random.choice(archlist)
|
|
||||||
else:
|
|
||||||
|
|
@ -1,38 +0,0 @@
|
|||||||
From f453092d308605707ba1fb3fa314e05b515e7a25 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Tomas Kopecek <tkopecek@redhat.com>
|
|
||||||
Date: Feb 29 2024 10:45:55 +0000
|
|
||||||
Subject: Better index for rpm lookup
|
|
||||||
|
|
||||||
|
|
||||||
Related: https://pagure.io/koji/issue/4022
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
diff --git a/schemas/schema-upgrade-1.34-1.35.sql b/schemas/schema-upgrade-1.34-1.35.sql
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..3cc82bc
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/schemas/schema-upgrade-1.34-1.35.sql
|
|
||||||
@@ -0,0 +1,9 @@
|
|
||||||
+-- upgrade script to migrate the Koji database schema
|
|
||||||
+-- from version 1.33 to 1.34
|
|
||||||
+
|
|
||||||
+BEGIN;
|
|
||||||
+
|
|
||||||
+CREATE INDEX CONCURRENTLY IF NOT EXISTS rpminfo_nvra
|
|
||||||
+ ON rpminfo(name,version,release,arch,external_repo_id);
|
|
||||||
+
|
|
||||||
+COMMIT;
|
|
||||||
diff --git a/schemas/schema.sql b/schemas/schema.sql
|
|
||||||
index e5f3462..7e3298c 100644
|
|
||||||
--- a/schemas/schema.sql
|
|
||||||
+++ b/schemas/schema.sql
|
|
||||||
@@ -752,6 +752,7 @@ CREATE TABLE rpminfo (
|
|
||||||
CREATE INDEX rpminfo_build ON rpminfo(build_id);
|
|
||||||
CREATE UNIQUE INDEX rpminfo_unique_nvra_not_draft ON rpminfo(name,version,release,arch,external_repo_id)
|
|
||||||
WHERE draft IS NOT TRUE;
|
|
||||||
+CREATE INDEX rpminfo_nvra ON rpminfo(name,version,release,arch,external_repo_id);
|
|
||||||
-- index for default search method for rpms, PG11+ can benefit from new include method
|
|
||||||
DO $$
|
|
||||||
DECLARE version integer;
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
|||||||
From a241746b2a496540bb6cbe64a5b59eb5bb1c50a6 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Miro Hrončok <miro@hroncok.cz>
|
|
||||||
Date: May 28 2024 20:10:07 +0000
|
|
||||||
Subject: setup.py: Fix version retrieval on Python 3.13+
|
|
||||||
|
|
||||||
|
|
||||||
Accessing __version__ from locals() no longer works.
|
|
||||||
|
|
||||||
This was reported to Python in https://github.com/python/cpython/issues/118888
|
|
||||||
but according to Python developers, it:
|
|
||||||
|
|
||||||
- is an intended change of behavior described in PEP 667
|
|
||||||
- was an illegal usage that happens to work in a favored way to begin with
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
diff --git a/setup.py b/setup.py
|
|
||||||
index 91f7d76..4d38c08 100755
|
|
||||||
--- a/setup.py
|
|
||||||
+++ b/setup.py
|
|
||||||
@@ -25,8 +25,9 @@ def get_install_requires():
|
|
||||||
|
|
||||||
def get_version():
|
|
||||||
cwd = os.path.dirname(__file__)
|
|
||||||
- exec(open(os.path.join(cwd, 'koji/_version.py'), 'rt').read())
|
|
||||||
- return locals()['__version__']
|
|
||||||
+ lcls = {}
|
|
||||||
+ exec(open(os.path.join(cwd, 'koji/_version.py'), 'rt').read(), None, lcls)
|
|
||||||
+ return lcls['__version__']
|
|
||||||
|
|
||||||
|
|
||||||
def get_long_description():
|
|
||||||
|
|
@ -1 +1 @@
|
|||||||
SHA512 (koji-1.34.1.tar.bz2) = ed55e8c16239ba43e1b931d6b16523530ede77c087f93828e53f30aec9514e81d252adb7e64c1194f7fc4e9db33ee4e6c74841f07dfc688d6bb68bd9b7bd80b6
|
SHA512 (koji-1.35.0.tar.bz2) = e4bfa99478d5a47414a176c7972cef7351e6bc2f06bcb34ea536800acbdd725bb7b65acb01403b786f64a0f727cd85a87b9bb03bd7884f0c442b986ffb71d3a0
|
||||||
|
Loading…
Reference in new issue