public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/rpkg] 1.70-1: Backporting some fixes and features
@ 2026-08-10 21:44
0 siblings, 0 replies; 2+ messages in thread
From: @ 2026-08-10 21:44 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/rpkg
Branch : 1.70-1
Commit : 667c617b5307376cd5ae162059243abeca2040bc
Author : Ondřej Nosek <onosek@redhat.com>
Date : 2019-10-25T13:16:05+00:00
Stats : +362/-1 in 6 file(s)
URL : https://src.fedoraproject.org/rpms/rpkg/c/667c617b5307376cd5ae162059243abeca2040bc?branch=1.70-1
Log:
Backporting some fixes and features
- container-build: add --isolated and --koji-parent-build arguments
- Pass skip_build option to buildContainer
- Reuse koji_cli.lib.unique_path
Signed-off-by: Ondřej Nosek <onosek@redhat.com>
---
diff --git a/0001-Reuse-koji_cli.lib.unique_path.patch b/0001-Reuse-koji_cli.lib.unique_path.patch
new file mode 100644
index 0000000..45d3bb4
--- /dev/null
+++ b/0001-Reuse-koji_cli.lib.unique_path.patch
@@ -0,0 +1,48 @@
+From 0ee52cf747e218008984d604c468f9e1515f1ef9 Mon Sep 17 00:00:00 2001
+From: Chenxiong Qi <cqi@redhat.com>
+Date: Mon, 15 Apr 2019 11:17:21 +0800
+Subject: [PATCH 1/5] Reuse koji_cli.lib.unique_path
+
+Call this method instead of constructing the path by rpkg itself.
+
+Merges: https://pagure.io/rpkg/pull-request/336
+
+Signed-off-by: Chenxiong Qi <cqi@redhat.com>
+---
+ pyrpkg/cli.py | 11 +++--------
+ 1 file changed, 3 insertions(+), 8 deletions(-)
+
+diff --git a/pyrpkg/cli.py b/pyrpkg/cli.py
+index 6b584ae..7ab146d 100644
+--- a/pyrpkg/cli.py
++++ b/pyrpkg/cli.py
+@@ -18,11 +18,8 @@ import argparse
+ import getpass
+ import logging
+ import os
+-import random
+ import re
+-import string
+ import sys
+-import time
+ from gettext import gettext as _ # For `_ArgumentParser'
+
+ import requests
+@@ -1646,11 +1643,9 @@ see API KEY section of copr-cli(1) man page.
+ callback = None
+ if not self.args.q:
+ callback = koji_cli.lib._progress_callback
+- # define a unique path for this upload. Stolen from /usr/bin/koji
+- uniquepath = 'cli-build/%r.%s' % (
+- time.time(),
+- ''.join([random.choice(string.ascii_letters) for i in range(8)])
+- )
++ # Define a unique path for this upload. Learned from koji to use prefix
++ # cli-build.
++ uniquepath = koji_cli.lib.unique_path('cli-build')
+ if not name:
+ name = os.path.basename(file)
+ # Should have a try here, not sure what errors we'll get yet though
+--
+2.21.0
+
diff --git a/0002-Pass-skip_build-option-to-buildContainer.patch b/0002-Pass-skip_build-option-to-buildContainer.patch
new file mode 100644
index 0000000..55580a1
--- /dev/null
+++ b/0002-Pass-skip_build-option-to-buildContainer.patch
@@ -0,0 +1,29 @@
+From 48e3ce2f754ba9b30b195a3c48ffdfb2b147d1ab Mon Sep 17 00:00:00 2001
+From: Robert Cerven <rcerven@redhat.com>
+Date: Mon, 7 Oct 2019 21:32:46 +0200
+Subject: [PATCH 2/5] Pass skip_build option to buildContainer
+
+* OSBS-7711
+
+Signed-off-by: Robert Cerven <rcerven@redhat.com>
+---
+ pyrpkg/__init__.py | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
+index 68aceb2..8e0960b 100644
+--- a/pyrpkg/__init__.py
++++ b/pyrpkg/__init__.py
+@@ -3126,7 +3126,8 @@ class Commands(object):
+
+ task_opts = {}
+ for key in ('scratch', 'name', 'version', 'release',
+- 'yum_repourls', 'git_branch', 'signing_intent', 'compose_ids'):
++ 'yum_repourls', 'git_branch', 'signing_intent', 'compose_ids',
++ 'skip_build'):
+ if key in opts:
+ task_opts[key] = opts[key]
+
+--
+2.21.0
+
diff --git a/0003-container-build-add-isolated-argument.patch b/0003-container-build-add-isolated-argument.patch
new file mode 100644
index 0000000..ddc9f71
--- /dev/null
+++ b/0003-container-build-add-isolated-argument.patch
@@ -0,0 +1,112 @@
+From 174f61ce13d47c84a1a9f697c7c6b7c817db73f7 Mon Sep 17 00:00:00 2001
+From: Ken Dreyer <kdreyer@redhat.com>
+Date: Wed, 25 Sep 2019 11:56:21 -0600
+Subject: [PATCH 3/5] container-build: add --isolated argument
+
+Add support for a new "--isolated" argument to the container-build
+sub-command.
+
+Isolated builds will only update the {version}-{release} unique tag and
+the primary tag in target container registry. Also, OSBS's bump_release
+plugin will ignore isolated builds.
+
+Users must specify a --build-release argument when the use the
+--isolated argument.
+
+Signed-off-by: Ken Dreyer <kdreyer@redhat.com>
+---
+ pyrpkg/__init__.py | 2 +-
+ pyrpkg/cli.py | 13 +++++++++++++
+ tests/test_cli.py | 4 ++++
+ 3 files changed, 18 insertions(+), 1 deletion(-)
+
+diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
+index 8e0960b..1aa1c2b 100644
+--- a/pyrpkg/__init__.py
++++ b/pyrpkg/__init__.py
+@@ -3125,7 +3125,7 @@ class Commands(object):
+ source = self.construct_build_url()
+
+ task_opts = {}
+- for key in ('scratch', 'name', 'version', 'release',
++ for key in ('scratch', 'name', 'version', 'release', 'isolated',
+ 'yum_repourls', 'git_branch', 'signing_intent', 'compose_ids',
+ 'skip_build'):
+ if key in opts:
+diff --git a/pyrpkg/cli.py b/pyrpkg/cli.py
+index 7ab146d..0845d99 100644
+--- a/pyrpkg/cli.py
++++ b/pyrpkg/cli.py
+@@ -1544,6 +1544,13 @@ see API KEY section of copr-cli(1) man page.
+ default=None,
+ help="Specify a release value for this build's NVR")
+
++ parser.add_argument(
++ '--isolated',
++ help='Do not auto-increment the release value or update'
++ ' additional tags in the registry. You must use the'
++ ' --build-release argument',
++ action="store_true")
++
+ parser.add_argument(
+ '--scratch',
+ help='Scratch build',
+@@ -1981,6 +1988,7 @@ see API KEY section of copr-cli(1) man page.
+ opts = {"scratch": self.args.scratch,
+ "quiet": self.args.q,
+ "release": self.args.build_release,
++ "isolated": self.args.isolated,
+ "git_branch": self.cmd.branch_merge,
+ "arches": self.args.arches,
+ "skip_build": self.args.skip_build}
+@@ -1995,6 +2003,11 @@ see API KEY section of copr-cli(1) man page.
+ "signing_intent": self.args.signing_intent,
+ })
+
++ if self.args.isolated and not self.args.build_release:
++ self.container_build_parser.error(
++ 'missing --build-release: using --isolated requires'
++ ' --build-release option')
++
+ section_name = "%s.container-build" % self.name
+ err_msg = "Missing %(option)s option in [%(plugin.section)s] section. " \
+ "Using %(option)s from [%(root.section)s]"
+diff --git a/tests/test_cli.py b/tests/test_cli.py
+index ae87030..35b37d6 100644
+--- a/tests/test_cli.py
++++ b/tests/test_cli.py
+@@ -224,6 +224,7 @@ class TestContainerBuildWithKoji(CliTestCase):
+ 'scratch': False,
+ 'quiet': False,
+ 'release': None,
++ 'isolated': False,
+ 'yum_repourls': None,
+ 'git_branch': 'eng-rhel-7',
+ 'arches': None,
+@@ -254,6 +255,7 @@ class TestContainerBuildWithKoji(CliTestCase):
+ 'scratch': False,
+ 'quiet': False,
+ 'release': None,
++ 'isolated': False,
+ 'yum_repourls': None,
+ 'git_branch': 'eng-rhel-7',
+ 'arches': None,
+@@ -293,6 +295,7 @@ class TestContainerBuildWithKoji(CliTestCase):
+ 'scratch': False,
+ 'quiet': False,
+ 'release': None,
++ 'isolated': False,
+ 'yum_repourls': None,
+ 'git_branch': 'eng-rhel-7',
+ 'arches': None,
+@@ -350,6 +353,7 @@ class TestContainerBuildWithKoji(CliTestCase):
+ 'scratch': False,
+ 'quiet': False,
+ 'release': None,
++ 'isolated': False,
+ 'git_branch': 'eng-rhel-7',
+ 'arches': None,
+ 'skip_build': False
+--
+2.21.0
+
diff --git a/0004-tests-add-container-build-isolated-test.patch b/0004-tests-add-container-build-isolated-test.patch
new file mode 100644
index 0000000..d3994b3
--- /dev/null
+++ b/0004-tests-add-container-build-isolated-test.patch
@@ -0,0 +1,56 @@
+From 10de8c40d2f2964ce0c4f643a143c59e5fa11f94 Mon Sep 17 00:00:00 2001
+From: Ken Dreyer <kdreyer@redhat.com>
+Date: Fri, 11 Oct 2019 09:42:22 -0600
+Subject: [PATCH 4/5] tests: add container-build --isolated test
+
+Verify the behavior of the container-build "--isolated" option.
+
+Signed-off-by: Ken Dreyer <kdreyer@redhat.com>
+---
+ tests/test_cli.py | 30 ++++++++++++++++++++++++++++++
+ 1 file changed, 30 insertions(+)
+
+diff --git a/tests/test_cli.py b/tests/test_cli.py
+index 35b37d6..fa18647 100644
+--- a/tests/test_cli.py
++++ b/tests/test_cli.py
+@@ -271,6 +271,36 @@ class TestContainerBuildWithKoji(CliTestCase):
+ flatpak=False
+ )
+
++ def test_isolated(self):
++ cli_cmd = ['rpkg', '--path', self.cloned_repo_path, 'container-build',
++ '--isolated', '--build-release', '99']
++
++ with patch('sys.argv', new=cli_cmd):
++ cli = self.new_cli()
++ cli.container_build_koji()
++
++ self.mock_container_build_koji.assert_called_once_with(
++ False,
++ opts={
++ 'scratch': False,
++ 'quiet': False,
++ 'release': '99',
++ 'isolated': True,
++ 'yum_repourls': None,
++ 'git_branch': 'eng-rhel-7',
++ 'arches': None,
++ 'signing_intent': None,
++ 'compose_ids': None,
++ 'skip_build': False
++ },
++ kojiconfig=None,
++ kojiprofile='koji',
++ build_client=utils.build_client,
++ koji_task_watcher=koji_cli.lib.watch_tasks,
++ nowait=False,
++ flatpak=False
++ )
++
+ def test_using_deprecated_kojiconfig(self):
+ """test_build_using_deprecated_kojiconfig
+
+--
+2.21.0
+
diff --git a/0005-container-build-add-koji-parent-build-argument.patch b/0005-container-build-add-koji-parent-build-argument.patch
new file mode 100644
index 0000000..4efcb65
--- /dev/null
+++ b/0005-container-build-add-koji-parent-build-argument.patch
@@ -0,0 +1,106 @@
+From 4b48dbcba45bf3ad44a3179380972b3ad6997616 Mon Sep 17 00:00:00 2001
+From: Ken Dreyer <kdreyer@redhat.com>
+Date: Fri, 11 Oct 2019 09:42:08 -0600
+Subject: [PATCH 5/5] container-build: add --koji-parent-build argument
+
+Add support for a new "--koji-parent-build" argument to the
+container-build sub-command.
+
+OSBS allows users to dynamically override the Dockerfile's "FROM" image
+at build time. This allows you to build your container against a
+specific parent image without pushing changes to dist-git.
+
+Signed-off-by: Ken Dreyer <kdreyer@redhat.com>
+---
+ pyrpkg/__init__.py | 4 ++--
+ pyrpkg/cli.py | 7 +++++++
+ tests/test_cli.py | 5 +++++
+ 3 files changed, 14 insertions(+), 2 deletions(-)
+
+diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
+index 1aa1c2b..b139fe0 100644
+--- a/pyrpkg/__init__.py
++++ b/pyrpkg/__init__.py
+@@ -3126,8 +3126,8 @@ class Commands(object):
+
+ task_opts = {}
+ for key in ('scratch', 'name', 'version', 'release', 'isolated',
+- 'yum_repourls', 'git_branch', 'signing_intent', 'compose_ids',
+- 'skip_build'):
++ 'koji_parent_build', 'yum_repourls', 'git_branch',
++ 'signing_intent', 'compose_ids', 'skip_build'):
+ if key in opts:
+ task_opts[key] = opts[key]
+
+diff --git a/pyrpkg/cli.py b/pyrpkg/cli.py
+index 0845d99..0036136 100644
+--- a/pyrpkg/cli.py
++++ b/pyrpkg/cli.py
+@@ -1551,6 +1551,12 @@ see API KEY section of copr-cli(1) man page.
+ ' --build-release argument',
+ action="store_true")
+
++ parser.add_argument(
++ '--koji-parent-build',
++ default=None,
++ help='Specify a Koji NVR for the parent container image. This'
++ ' will override the "FROM" value in your Dockerfile.')
++
+ parser.add_argument(
+ '--scratch',
+ help='Scratch build',
+@@ -1989,6 +1995,7 @@ see API KEY section of copr-cli(1) man page.
+ "quiet": self.args.q,
+ "release": self.args.build_release,
+ "isolated": self.args.isolated,
++ "koji_parent_build": self.args.koji_parent_build,
+ "git_branch": self.cmd.branch_merge,
+ "arches": self.args.arches,
+ "skip_build": self.args.skip_build}
+diff --git a/tests/test_cli.py b/tests/test_cli.py
+index fa18647..0868a30 100644
+--- a/tests/test_cli.py
++++ b/tests/test_cli.py
+@@ -225,6 +225,7 @@ class TestContainerBuildWithKoji(CliTestCase):
+ 'quiet': False,
+ 'release': None,
+ 'isolated': False,
++ 'koji_parent_build': None,
+ 'yum_repourls': None,
+ 'git_branch': 'eng-rhel-7',
+ 'arches': None,
+@@ -256,6 +257,7 @@ class TestContainerBuildWithKoji(CliTestCase):
+ 'quiet': False,
+ 'release': None,
+ 'isolated': False,
++ 'koji_parent_build': None,
+ 'yum_repourls': None,
+ 'git_branch': 'eng-rhel-7',
+ 'arches': None,
+@@ -286,6 +288,7 @@ class TestContainerBuildWithKoji(CliTestCase):
+ 'quiet': False,
+ 'release': '99',
+ 'isolated': True,
++ 'koji_parent_build': None,
+ 'yum_repourls': None,
+ 'git_branch': 'eng-rhel-7',
+ 'arches': None,
+@@ -326,6 +329,7 @@ class TestContainerBuildWithKoji(CliTestCase):
+ 'quiet': False,
+ 'release': None,
+ 'isolated': False,
++ 'koji_parent_build': None,
+ 'yum_repourls': None,
+ 'git_branch': 'eng-rhel-7',
+ 'arches': None,
+@@ -384,6 +388,7 @@ class TestContainerBuildWithKoji(CliTestCase):
+ 'quiet': False,
+ 'release': None,
+ 'isolated': False,
++ 'koji_parent_build': None,
+ 'git_branch': 'eng-rhel-7',
+ 'arches': None,
+ 'skip_build': False
+--
+2.21.0
+
diff --git a/rpkg.spec b/rpkg.spec
index a05c6f7..67ab561 100644
--- a/rpkg.spec
+++ b/rpkg.spec
@@ -4,7 +4,7 @@
Name: rpkg
Version: 1.59
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: Python library for interacting with rpm+git
License: GPLv2+ and LGPLv2
@@ -21,6 +21,11 @@ Source0: https://pagure.io/releases/rpkg/%{name}-%{version}.tar.gz
# and there is only old rpm-python package in EL6 and 7, so just simply to
# remove rpm-py-installer for now.
Patch0: remove-koji-and-rpm-py-installer-from-requires.patch
+Patch1: 0001-Reuse-koji_cli.lib.unique_path.patch
+Patch2: 0002-Pass-skip_build-option-to-buildContainer.patch
+Patch3: 0003-container-build-add-isolated-argument.patch
+Patch4: 0004-tests-add-container-build-isolated-test.patch
+Patch5: 0005-container-build-add-koji-parent-build-argument.patch
%if 0%{?fedora} || 0%{?rhel} > 7
# Enable python3 build by default
@@ -271,6 +276,11 @@ nosetests tests
%changelog
+* Fri Oct 25 2019 Ondrej Nosek <onosek@redhat.com> - 1.59-2
+- Backport: container-build: add --isolated and --koji-parent-build arguments
+- Backport: Pass skip_build option to buildContainer
+- Backport: Reuse koji_cli.lib.unique_path
+
* Mon Sep 16 2019 Ondřej Nosek <onosek@redhat.com> - 1.59-1
- Add argument to skip build option for container-build (rcerven)
- Sorting imports (onosek)
^ permalink raw reply related [flat|nested] 2+ messages in thread* [rpms/rpkg] 1.70-1: Backporting some fixes and features
@ 2026-08-10 21:44
0 siblings, 0 replies; 2+ messages in thread
From: @ 2026-08-10 21:44 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/rpkg
Branch : 1.70-1
Commit : b725d6929774a361b92c14378d5b0ae75feece06
Author : Ondřej Nosek <onosek@redhat.com>
Date : 2019-05-27T11:55:33+00:00
Stats : +328/-1 in 4 file(s)
URL : https://src.fedoraproject.org/rpms/rpkg/c/b725d6929774a361b92c14378d5b0ae75feece06?branch=1.70-1
Log:
Backporting some fixes and features
- Custom handler for koji watch_tasks
- Show nvr in container-build
- Different import --offline command behavior
Signed-off-by: Ondřej Nosek <onosek@redhat.com>
---
diff --git a/0002-Custom-handler-for-koji-watch_tasks.patch b/0002-Custom-handler-for-koji-watch_tasks.patch
new file mode 100644
index 0000000..9e4c2d2
--- /dev/null
+++ b/0002-Custom-handler-for-koji-watch_tasks.patch
@@ -0,0 +1,121 @@
+From 910ed50456ea41995989d59a5a469799ba8d4e5b Mon Sep 17 00:00:00 2001
+From: Ondrej Nosek <onosek@redhat.com>
+Date: Wed, 15 May 2019 18:53:30 +0200
+Subject: [PATCH] Custom handler for koji watch_tasks
+
+Output text during rhpkg/fedpkg build process states that there
+is a 'watch_task' subcommand. When 'koji_cli' library is imported
+in rhpkg/fedpkg tool, it shows that command is named
+'rhpkg/fedpkg watch_task' instead of 'brew/koji watch_task'. Custom
+handler replaces the internal one inside koji_cli library.
+Additional fix in rhpkg is needed after this change is released.
+
+Relates: rhbz#1570921
+Relates: COMPOSE-2809
+
+Signed-off-by: Ondrej Nosek <onosek@redhat.com>
+---
+ pyrpkg/cli.py | 6 +++++-
+ pyrpkg/utils.py | 21 +++++++++++++++++++++
+ tests/test_cli.py | 39 ++++++++++++++++++++++-----------------
+ 3 files changed, 48 insertions(+), 18 deletions(-)
+
+diff --git a/pyrpkg/cli.py b/pyrpkg/cli.py
+index 7b83a44..72be1cf 100644
+--- a/pyrpkg/cli.py
++++ b/pyrpkg/cli.py
+@@ -1667,7 +1667,11 @@ see API KEY section of copr-cli(1) man page.
+ if self.args.dry_run:
+ self.log.info('DRY-RUN: Watch tasks: %s', task_ids)
+ else:
+- return koji_cli.lib.watch_tasks(self.cmd.kojisession, task_ids)
++ return koji_cli.lib.watch_tasks(
++ self.cmd.kojisession,
++ task_ids,
++ ki_handler=utils.make_koji_watch_tasks_handler(self.cmd.build_client)
++ )
+
+ def extract_greenwave_url(self):
+ greenwave_url = None
+diff --git a/pyrpkg/utils.py b/pyrpkg/utils.py
+index 2268e6f..37a39e2 100644
+--- a/pyrpkg/utils.py
++++ b/pyrpkg/utils.py
+@@ -128,3 +128,24 @@ def validate_module_build_optional(optional_arg):
+ 'The "{0}" optional argument is reserved to built-in arguments'.format(key))
+
+ return (key, value)
++
++
++def make_koji_watch_tasks_handler(progname):
++ def koji_watch_tasks_handler(_, tasks, quiet):
++ """
++ Displays information about running tasks and says how to watch them.
++ Unlike the default version at koji library it overrides progname
++ to show brew, koji or other build client.
++ """
++ if not quiet:
++ tlist = ['%s: %s' % (t.str(), t.display_state(t.info))
++ for t in tasks.values() if not t.is_done()]
++ print("""Tasks still running. You can continue to watch with the '%s watch-task' command.
++Running Tasks: %s""" % (progname, '\n'.join(tlist)))
++
++ # Save reference of the handler during first time use.
++ # It guarantees that the same object is always returned (it allows unittest to pass).
++ global handler_reference
++ if 'handler_reference' not in globals():
++ handler_reference = koji_watch_tasks_handler
++ return handler_reference
+diff --git a/tests/test_cli.py b/tests/test_cli.py
+index 785e103..b3e0718 100644
+--- a/tests/test_cli.py
++++ b/tests/test_cli.py
+@@ -3235,23 +3235,28 @@ class TestBuildPackage(FakeKojiCreds, CliTestCase):
+ mock_build_api = None
+
+ with patch('koji_cli.lib.watch_tasks') as watch_tasks:
+- with patch('sys.argv', new=cli_cmd):
+- cli = self.new_cli(cfg=config_file)
+- if sub_command == 'build':
+- mock_build_api = session.build
+- cli.build()
+- elif sub_command == 'scratch-build':
+- mock_build_api = session.build
+- cli.scratch_build()
+- elif sub_command == 'chain-build':
+- mock_build_api = session.chainBuild
+- cli.chainbuild()
+-
+- if '--nowait' in cli_cmd:
+- watch_tasks.assert_not_called()
+- else:
+- watch_tasks.assert_called_once_with(
+- session, [mock_build_api.return_value])
++ with patch('pyrpkg.utils.make_koji_watch_tasks_handler') as mock_ki:
++ with patch('sys.argv', new=cli_cmd):
++ cli = self.new_cli(cfg=config_file)
++ if sub_command == 'build':
++ mock_build_api = session.build
++ cli.build()
++ elif sub_command == 'scratch-build':
++ mock_build_api = session.build
++ cli.scratch_build()
++ elif sub_command == 'chain-build':
++ mock_build_api = session.chainBuild
++ cli.chainbuild()
++
++ if '--nowait' in cli_cmd:
++ watch_tasks.assert_not_called()
++ else:
++ watch_tasks.assert_called_once_with(
++ session,
++ [mock_build_api.return_value],
++ ki_handler=mock_ki.return_value
++ )
++ self.assertEqual(mock_ki.call_args, (("koji",),))
+
+ mock_build_api.assert_called_once()
+
+--
+2.20.1
+
diff --git a/0003-Show-nvr-in-container-build.patch b/0003-Show-nvr-in-container-build.patch
new file mode 100644
index 0000000..d7a6bae
--- /dev/null
+++ b/0003-Show-nvr-in-container-build.patch
@@ -0,0 +1,75 @@
+From 7cef29d843fabce5abab317303e9016c91414913 Mon Sep 17 00:00:00 2001
+From: Ondrej Nosek <onosek@redhat.com>
+Date: Fri, 24 May 2019 11:21:34 +0200
+Subject: [PATCH] Show nvr in container-build
+
+JIRA: COMPOSE-3481
+
+Signed-off-by: Ondrej Nosek <onosek@redhat.com>
+---
+ pyrpkg/__init__.py | 42 ++++++++++++++++++++++++++++++++++--------
+ 1 file changed, 34 insertions(+), 8 deletions(-)
+
+diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
+index 291b9ac..0348420 100644
+--- a/pyrpkg/__init__.py
++++ b/pyrpkg/__init__.py
+@@ -3036,6 +3036,39 @@ class Commands(object):
+ # Run the command
+ self._run_command(cmd, shell=True)
+
++ def _process_koji_task_result(self, task_id):
++ """
++ Parse and modify output from brew/koji containing information about
++ task (and eventually builds).
++
++ :param int task_id: id of the current task
++ :return: record containing information about repositories, builds and nvrs
++ :rtype: dict(str, str)
++ """
++ koji_result = self.kojisession.getTaskResult(task_id)
++ if not koji_result:
++ raise rpkgError('Unknown task: %s' % task_id)
++ koji_builds = koji_result.get("koji_builds", [])
++ koji_result["koji_builds"] = []
++
++ for build_id in koji_builds:
++ try:
++ build_id = int(build_id)
++ except ValueError:
++ raise rpkgError("Can not convert 'build_id' to integer: %s" % build_id)
++
++ bdata = self.kojisession.getBuild(build_id)
++ if not bdata:
++ raise rpkgError('Unknown build: %s' % build_id)
++ nvr = bdata.get("nvr")
++ if nvr:
++ koji_result.setdefault("nvrs", []).append(nvr)
++
++ koji_result["koji_builds"].append(
++ "%s/buildinfo?buildID=%d" % (self.kojiweburl, build_id))
++
++ return koji_result
++
+ def container_build_koji(self, target_override=False, opts={},
+ kojiconfig=None, kojiprofile=None,
+ build_client=None,
+@@ -3105,14 +3138,7 @@ class Commands(object):
+ if not nowait:
+ rv = koji_task_watcher(self.kojisession, [task_id])
+ if rv == 0:
+- result = self.kojisession.getTaskResult(task_id)
+- try:
+- result["koji_builds"] = [
+- "%s/buildinfo?buildID=%s" % (self.kojiweburl,
+- build_id)
+- for build_id in result.get("koji_builds", [])]
+- except TypeError:
+- pass
++ result = self._process_koji_task_result(task_id)
+ log_result(self.log.info, result)
+
+ finally:
+--
+2.20.1
+
diff --git a/0004-Different-import-offline-command-behavior.patch b/0004-Different-import-offline-command-behavior.patch
new file mode 100644
index 0000000..b17da5b
--- /dev/null
+++ b/0004-Different-import-offline-command-behavior.patch
@@ -0,0 +1,123 @@
+From 810b2f7efda65ba369f1bb865f25d351915db1ab Mon Sep 17 00:00:00 2001
+From: Ondrej Nosek <onosek@redhat.com>
+Date: Fri, 24 May 2019 17:43:01 +0200
+Subject: [PATCH] Different import --offline command behavior
+
+`*pkg import --offline` didn't update 'source' and '.gitignore' files.
+Modified incorrect output about uploaded sources. Offline mode now does
+everything but uploading sources into lookaside cache.
+
+JIRA: COMPOSE-3558
+Fixes: #445
+Resolves: rhbz#1175262
+
+Signed-off-by: Ondrej Nosek <onosek@redhat.com>
+---
+ pyrpkg/__init__.py | 5 +++--
+ pyrpkg/cli.py | 15 +++++++++++----
+ pyrpkg/lookaside.py | 8 +++++++-
+ tests/test_cli.py | 2 +-
+ 4 files changed, 22 insertions(+), 8 deletions(-)
+
+diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
+index 0348420..1f61082 100644
+--- a/pyrpkg/__init__.py
++++ b/pyrpkg/__init__.py
+@@ -2818,7 +2818,7 @@ class Commands(object):
+ self.log.debug('Cleaning up mock temporary config directory: %s', config_dir)
+ self._cleanup_tmp_dir(config_dir)
+
+- def upload(self, files, replace=False):
++ def upload(self, files, replace=False, offline=False):
+ """Upload source file(s) in the lookaside cache
+
+ Both file `sources` and `.gitignore` will be updated with uploaded
+@@ -2827,6 +2827,7 @@ class Commands(object):
+ :param iterable files: an iterable of files to upload.
+ :param bool replace: optionally replace the existing tracked sources.
+ Defaults to `False`.
++ :param bool offline: do all the steps except uploading into lookaside cache
+ :raises rpkgError: if failed to add a file to file `sources`.
+ """
+
+@@ -2859,7 +2860,7 @@ class Commands(object):
+ gitignore.add('/%s' % file_basename)
+ self.lookasidecache.upload(
+ self.ns_repo_name if self.lookaside_namespaced else self.repo_name,
+- f, file_hash)
++ f, file_hash, offline=offline)
+
+ sourcesf.write()
+ gitignore.write()
+diff --git a/pyrpkg/cli.py b/pyrpkg/cli.py
+index 72be1cf..eb0f499 100644
+--- a/pyrpkg/cli.py
++++ b/pyrpkg/cli.py
+@@ -2027,13 +2027,20 @@ see API KEY section of copr-cli(1) man page.
+
+ def import_srpm(self):
+ uploadfiles = self.cmd.import_srpm(self.args.srpm)
+- if uploadfiles and not self.args.offline:
+- self.cmd.upload(uploadfiles, replace=True)
++ if uploadfiles:
++ self.cmd.upload(uploadfiles, replace=True, offline=self.args.offline)
+ if not self.args.skip_diffs:
+ self.cmd.diff(cached=True)
+ self.log.info('--------------------------------------------')
+- self.log.info("New content staged and new sources uploaded.")
+- self.log.info("Commit if happy or revert with: git reset --hard HEAD")
++ if uploadfiles and self.args.offline:
++ self.log.info("New content staged without uploading sources.")
++ self.log.info("Commit and upload (%s upload <source>) if happy or revert with: "
++ "'git reset --hard HEAD' (warning: it reverts also eventual user "
++ "changes)." % (self._name,))
++ else:
++ self.log.info("New content staged and new sources uploaded.")
++ self.log.info("Commit if happy or revert with: 'git reset --hard HEAD' (warning: "
++ "it reverts also eventual user changes).")
+
+ def install(self):
+ self.sources()
+diff --git a/pyrpkg/lookaside.py b/pyrpkg/lookaside.py
+index d28c1d9..ede81ea 100644
+--- a/pyrpkg/lookaside.py
++++ b/pyrpkg/lookaside.py
+@@ -269,7 +269,7 @@ class CGILookasideCache(object):
+ raise UploadError('Error checking for %s at %s'
+ % (filename, self.upload_url))
+
+- def upload(self, name, filepath, hash):
++ def upload(self, name, filepath, hash, offline=False):
+ """Upload a source file
+
+ :param str name: The name of the module. (usually the name of the SRPM)
+@@ -277,7 +277,13 @@ class CGILookasideCache(object):
+ server side expects).
+ :param str filepath: The full path to the file to upload.
+ :param str hash: The known good hash of the file.
++ :param bool offline: Method prints a message about disabled upload and does return.
+ """
++ if offline:
++ self.log.info("Uploading: %s", filepath)
++ self.log.info("*Upload disabled*")
++ return
++
+ filename = os.path.basename(filepath)
+
+ # As in remote_file_exists, we need to convert unicode strings to str
+diff --git a/tests/test_cli.py b/tests/test_cli.py
+index b3e0718..ee92389 100644
+--- a/tests/test_cli.py
++++ b/tests/test_cli.py
+@@ -1163,7 +1163,7 @@ class LookasideCacheMock(object):
+ def destroy_lookaside_cache(self):
+ shutil.rmtree(self.lookasidecache_storage)
+
+- def lookasidecache_upload(self, repo_name, filepath, hash):
++ def lookasidecache_upload(self, repo_name, filepath, hash, offline):
+ filename = os.path.basename(filepath)
+ storage_filename = os.path.join(self.lookasidecache_storage, filename)
+ with open(storage_filename, 'wb') as fout:
+--
+2.20.1
+
diff --git a/rpkg.spec b/rpkg.spec
index 5d6180a..8399f93 100644
--- a/rpkg.spec
+++ b/rpkg.spec
@@ -4,7 +4,7 @@
Name: rpkg
Version: 1.58
-Release: 2%{?dist}
+Release: 3%{?dist}
Summary: Python library for interacting with rpm+git
License: GPLv2+ and LGPLv2
@@ -22,6 +22,9 @@ Source0: https://pagure.io/releases/rpkg/%{name}-%{version}.tar.gz
# remove rpm-py-installer for now.
Patch0: remove-koji-and-rpm-py-installer-from-requires.patch
Patch1: 0001-Fix-clone-branches.patch
+Patch2: 0002-Custom-handler-for-koji-watch_tasks.patch
+Patch3: 0003-Show-nvr-in-container-build.patch
+Patch4: 0004-Different-import-offline-command-behavior.patch
%if 0%{?fedora} || 0%{?rhel} > 7
# Enable python3 build by default
@@ -262,6 +265,11 @@ nosetests tests
%changelog
+* Mon May 27 2019 Ondřej Nosek <onosek@redhat.com> - 1.58-3
+- Backport: Custom handler for koji watch_tasks
+- Backport: Show nvr in container-build
+- Backport: Different import --offline command behavior
+
* Thu May 09 2019 Ondrej Nosek <onosek@redhat.com> - 1.58-2
- Backport: fixed 'clone --branch' command
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-08-10 21:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-10 21:44 [rpms/rpkg] 1.70-1: Backporting some fixes and features
-- strict thread matches above, loose matches on Subject: below --
2026-08-10 21:44
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox