public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/rpkg] 1.70-1: New release 1.67
@ 2026-08-10 21:44
0 siblings, 0 replies; only message 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 : 8a987032d1675375f57417d2b7b255d8fdb815a1
Author : Ondřej Nosek <onosek@redhat.com>
Date : 2024-06-26T04:01:05+00:00
Stats : +68/-3229 in 37 file(s)
URL : https://src.fedoraproject.org/rpms/rpkg/c/8a987032d1675375f57417d2b7b255d8fdb815a1?branch=1.70-1
Log:
New release 1.67
Signed-off-by: Ondřej Nosek <onosek@redhat.com>
---
diff --git a/.gitignore b/.gitignore
index a29257e..7a933c4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -62,3 +62,4 @@
/rpkg-1.64.tar.gz
/rpkg-1.65.tar.gz
/rpkg-1.66.tar.gz
+/rpkg-1.67.tar.gz
diff --git a/0002-Remove-pytest-coverage-execution.patch b/0002-Remove-pytest-coverage-execution.patch
index fbc9cb7..d746c7b 100644
--- a/0002-Remove-pytest-coverage-execution.patch
+++ b/0002-Remove-pytest-coverage-execution.patch
@@ -1,25 +1,11 @@
-From 8bf7c3b1336738ed5938f679fc4d450c3f8f0a62 Mon Sep 17 00:00:00 2001
-From: Ondrej Nosek <onosek@redhat.com>
-Date: Wed, 7 Sep 2022 00:11:56 +0200
-Subject: [PATCH] Remove pytest coverage execution
-
-Signed-off-by: Ondrej Nosek <onosek@redhat.com>
----
- setup.cfg | 1 -
- 1 file changed, 1 deletion(-)
-
-diff --git a/setup.cfg b/setup.cfg
-index 5e29c2f..4fe73fa 100644
---- a/setup.cfg
-+++ b/setup.cfg
-@@ -5,7 +5,6 @@ test = pytest
+--- a/setup.cfg 2023-12-11 18:21:45.586656058 +0100
++++ b/setup.cfg 2024-06-26 02:33:53.017645612 +0200
+@@ -5,8 +5,4 @@
max-line-length = 100
[tool:pytest]
+-# additional values for 'addopts' can be:
+-# --cov-report html
+-# -ra -q
-addopts = --cov=pyrpkg
testpaths = tests
-
- [egg_info]
---
-2.37.2
-
diff --git a/0004-Process-source-URLs-with-fragment-in-pre-push-hook.patch b/0004-Process-source-URLs-with-fragment-in-pre-push-hook.patch
deleted file mode 100644
index e252038..0000000
--- a/0004-Process-source-URLs-with-fragment-in-pre-push-hook.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-From 6d813d40aff91345b171323512b3ae641a168d45 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= <lsedlar@redhat.com>
-Date: Mon, 27 Feb 2023 08:36:20 +0100
-Subject: [PATCH] Process source URLs with fragment in pre-push hook
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Some download services do not have the actual filename in the URL.
-Packagers work around that by adding a fragment to the URL. This is then
-ignored by any server, but tricks RPM into getting the correct filename.
-
-Example:
-
- Source0: https://crates.io/api/v1/crates/actix/0.13.0/download#/actix-0.13.0.crate
-
-The filename is obviously `actix-0.13.0.crate`, but rpkg without this
-patch will come up with `download`.
-
-Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
----
- pyrpkg/__init__.py | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
-
-diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
-index 6a0e9eb..c650851 100644
---- a/pyrpkg/__init__.py
-+++ b/pyrpkg/__init__.py
-@@ -4464,7 +4464,9 @@ class Commands(object):
- # find out the format of the source file path. From URL use just the file name.
- # We want to keep hierarchy of the files if possible
- res = urllib.parse.urlparse(file_location)
-- if res.scheme and res.netloc:
-+ if res.scheme and res.fragment:
-+ source_files.append(os.path.basename(res.fragment))
-+ elif res.scheme and res.netloc:
- source_files.append(os.path.basename(res.path))
- else:
- source_files.append(file_location)
---
-2.39.2
-
diff --git a/0005-container-build-update-signing-intent-help-for-OSBS-.patch b/0005-container-build-update-signing-intent-help-for-OSBS-.patch
deleted file mode 100644
index 4ead6a3..0000000
--- a/0005-container-build-update-signing-intent-help-for-OSBS-.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From e38cfe4b688b600c411a9745922b77ebb9c14122 Mon Sep 17 00:00:00 2001
-From: Ken Dreyer <kdreyer@redhat.com>
-Date: Tue, 28 Feb 2023 16:17:03 -0500
-Subject: [PATCH] container-build: update --signing-intent help for OSBS 2
-
-OSBS 2 logs the reactor configuration in a slightly different way.
-Update the --help text for --signing-intent to point users at the new
-location.
-
-Signed-off-by: Ken Dreyer <kdreyer@redhat.com>
----
- pyrpkg/cli.py | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/pyrpkg/cli.py b/pyrpkg/cli.py
-index 41c4354..c3672b3 100644
---- a/pyrpkg/cli.py
-+++ b/pyrpkg/cli.py
-@@ -1724,7 +1724,7 @@ class cliClient(object):
- " server. If unspecified, the server will use the signing intent"
- " of the compose_ids you specify, or the server's"
- " default_signing_intent. To view the full list of possible"
-- " names, see REACTOR_CONFIG in orchestrator.log.")
-+ " names, see atomic_reactor.config in osbs-build.log.")
-
- parser.add_argument(
- '--skip-remote-rules-validation',
---
-2.39.2
-
diff --git a/0006-Do-not-generate-pre-push-hook-script-in-some-cases.patch b/0006-Do-not-generate-pre-push-hook-script-in-some-cases.patch
deleted file mode 100644
index 3369959..0000000
--- a/0006-Do-not-generate-pre-push-hook-script-in-some-cases.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From 30f189736137a50da4b740acf775ff6675a15a70 Mon Sep 17 00:00:00 2001
-From: Ondrej Nosek <onosek@redhat.com>
-Date: Wed, 8 Mar 2023 16:39:16 +0100
-Subject: [PATCH] Do not generate pre-push hook script in some cases
-
-Some rpkg users don't use fedpkg or similar tool for cloning
-and therefore there is no tool to execute the pre-push-check
-function. Do not generate the hook script in this case.
-
-Fixes: #665
-JIRA: RHELCMP-11392
-Signed-off-by: Ondrej Nosek <onosek@redhat.com>
----
- pyrpkg/__init__.py | 7 +++++++
- 1 file changed, 7 insertions(+)
-
-diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
-index acdad22..776cb21 100644
---- a/pyrpkg/__init__.py
-+++ b/pyrpkg/__init__.py
-@@ -1795,6 +1795,13 @@ class Commands(object):
- for possible user mistakes.
- """
- tool_name = os.path.basename(sys.argv[0]) # rhpkg|fedpkg|...
-+ if not tool_name:
-+ # empty argv - this functionality is not executed from x-pkg tool
-+ # and therefore there isn't a program that can run pre-push-check.
-+ # Example: the COPR team executes 'clone' by their own script.
-+ self.log.debug('Pre-push hook script was NOT added - missing '
-+ 'the packaging tool like fedpkg, rhpkg, ...')
-+ return
- hook_content = textwrap.dedent("""
- #!/bin/bash
-
---
-2.39.2
-
diff --git a/0007-More-robust-spec-file-presence-checking.patch b/0007-More-robust-spec-file-presence-checking.patch
deleted file mode 100644
index a1dde64..0000000
--- a/0007-More-robust-spec-file-presence-checking.patch
+++ /dev/null
@@ -1,292 +0,0 @@
-From 1108810bdefd0d880517b274acd6a3bd0d4156e0 Mon Sep 17 00:00:00 2001
-From: Ondrej Nosek <onosek@redhat.com>
-Date: Tue, 21 Mar 2023 02:44:04 +0100
-Subject: [PATCH 07/12] More robust spec file presence checking
-
-Some commands (verrel, sources, prep, import, ...) need to check
-whether the dist-git repository is in the correct state. It means
-at least the presence of the specfile.
-In the beginning, rpkg detects layouts. Layouts determine the file
-structure of the repository. For example, most commands can't
-be executed for the RetiredLayout (there is no specfile).
-When the repository directory exists, some layout can be always
-detected. Therefore '--path' argument is now checked for
-a valid directory.
-The timeout change in the request fixes the new bandit's finding.
-
-Fixes: #663
-JIRA: RHELCMP-11387
-
-Signed-off-by: Ondrej Nosek <onosek@redhat.com>
----
- pyrpkg/__init__.py | 9 ++++---
- pyrpkg/cli.py | 8 +++---
- pyrpkg/layout/__init__.py | 4 +--
- pyrpkg/utils.py | 14 ++++++++++
- tests/commands/test_push.py | 54 +++++++++++++++++++------------------
- tests/test_cli.py | 12 ++++++---
- 6 files changed, 63 insertions(+), 38 deletions(-)
-
-diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
-index 776cb21..028d195 100644
---- a/pyrpkg/__init__.py
-+++ b/pyrpkg/__init__.py
-@@ -923,9 +923,8 @@ class Commands(object):
- def load_spec(self):
- """This sets the spec attribute"""
-
-- if self.layout is None:
-+ if self.layout is None or isinstance(self.layout, layout.IncompleteLayout):
- raise rpkgError('Spec file is not available')
--
- if self.is_retired():
- raise rpkgError('This package or module is retired. The action has stopped.')
-
-@@ -1166,8 +1165,10 @@ class Commands(object):
-
- @property
- def sources_filename(self):
-- if self.layout is None:
-- return os.path.join(self.path, 'sources')
-+ if self.layout is None or isinstance(self.layout, layout.IncompleteLayout):
-+ raise rpkgError('Spec file is not available')
-+ if self.is_retired():
-+ raise rpkgError('This package or module is retired. The action has stopped.')
- return os.path.join(
- self.path, self.layout.sources_file_template.replace("{0.repo_name}", self.repo_name))
-
-diff --git a/pyrpkg/cli.py b/pyrpkg/cli.py
-index c3672b3..1bcf6e4 100644
---- a/pyrpkg/cli.py
-+++ b/pyrpkg/cli.py
-@@ -386,7 +386,7 @@ class cliClient(object):
- help='Run Koji commands as a different user')
- # Let the user define a path to work in rather than cwd
- self.parser.add_argument('--path', default=None,
-- type=utils.u,
-+ type=utils.validate_path,
- help='Define the directory to work in '
- '(defaults to cwd)')
- # Verbosity
-@@ -911,8 +911,9 @@ class cliClient(object):
- if 'path' in args:
- # Without "path", we can't really test...
- url = '%(protocol)s://%(host)s/%(path)s/info/refs?service=git-receive-pack' % args
-- resp = requests.head(url, auth=HTTPBasicAuth(args['username'],
-- args['password']))
-+ resp = requests.head(url,
-+ auth=HTTPBasicAuth(args['username'], args['password']),
-+ timeout=15)
- if resp.status_code == 401:
- return self.oidc_client.report_token_issue()
-
-@@ -2363,6 +2364,7 @@ class cliClient(object):
-
- def import_srpm(self):
- uploadfiles = self.cmd.import_srpm(self.args.srpm)
-+ self.load_cmd() # to reload layouts - because a specfile could appear during import
- if uploadfiles:
- try:
- self.cmd.upload(uploadfiles, replace=True, offline=self.args.offline)
-diff --git a/pyrpkg/layout/__init__.py b/pyrpkg/layout/__init__.py
-index 762af0d..850ddc2 100644
---- a/pyrpkg/layout/__init__.py
-+++ b/pyrpkg/layout/__init__.py
-@@ -12,8 +12,8 @@
- from pyrpkg.errors import LayoutError
-
- from .base import MetaLayout
--from .layouts import (DistGitLayout, IncompleteLayout, # noqa: F401
-- RetiredLayout, SRPMLayout)
-+from .layouts import (DistGitLayout, DistGitResultsDirLayout, # noqa: F401
-+ IncompleteLayout, RetiredLayout, SRPMLayout)
-
-
- def build(path, hint=None):
-diff --git a/pyrpkg/utils.py b/pyrpkg/utils.py
-index ceb4906..3337bdb 100644
---- a/pyrpkg/utils.py
-+++ b/pyrpkg/utils.py
-@@ -26,11 +26,25 @@ if six.PY3:
- def u(s):
- return s
-
-+ def validate_path(s):
-+ abspath = os.path.abspath(s)
-+ if os.path.exists(abspath):
-+ return s
-+ else:
-+ raise argparse.ArgumentTypeError('given path \'{0}\' doesn\'t exist'.format(abspath))
-+
- getcwd = os.getcwd
- else:
- def u(s):
- return s.decode('utf-8')
-
-+ def validate_path(s):
-+ abspath = os.path.abspath(s.decode('utf-8'))
-+ if os.path.exists(abspath):
-+ return s.decode('utf-8')
-+ else:
-+ raise argparse.ArgumentTypeError('given path \'{0}\' doesn\'t exist'.format(abspath))
-+
- getcwd = os.getcwdu
-
-
-diff --git a/tests/commands/test_push.py b/tests/commands/test_push.py
-index ef8057a..79c3a8b 100644
---- a/tests/commands/test_push.py
-+++ b/tests/commands/test_push.py
-@@ -1,9 +1,13 @@
- # -*- coding: utf-8 -*-
-
- import os
-+import subprocess
-
- import git
-
-+import pyrpkg
-+from pyrpkg.sources import SourcesFile
-+
- from . import CommandTestCase
-
- SPECFILE_TEMPLATE = """Name: test
-@@ -22,11 +26,6 @@ Test
- %%install
- rm -f $RPM_BUILD_ROOT%%{_sysconfdir}/"""
-
--CLONE_CONFIG = '''
-- bz.default-component %(module)s
-- sendemail.to %(module)s-owner@fedoraproject.org
--'''
--
-
- class CommandPushTestCase(CommandTestCase):
-
-@@ -45,28 +44,30 @@ class CommandPushTestCase(CommandTestCase):
-
- self.make_new_git(self.module)
-
-- import pyrpkg
-- cmd = pyrpkg.Commands(self.path, self.lookaside,
-- self.lookasidehash,
-- self.lookaside_cgi, self.gitbaseurl,
-- self.anongiturl, self.branchre, self.kojiprofile,
-- self.build_client, self.user, self.dist,
-- self.target, self.quiet)
-- cmd.clone_config_rpms = CLONE_CONFIG
-- cmd.clone(self.module, anon=True)
-- cmd.path = os.path.join(self.path, self.module)
-- os.chdir(os.path.join(self.path, self.module))
-+ moduledir = os.path.join(self.gitroot, self.module)
-+ subprocess.check_call(['git', 'clone', 'file://%s' % moduledir],
-+ cwd=self.path, stdout=subprocess.PIPE,
-+ stderr=subprocess.PIPE)
-+
-+ self.cloned_dir = os.path.join(self.path, self.module)
-+ self.cmd = pyrpkg.Commands(self.cloned_dir, self.lookaside,
-+ self.lookasidehash,
-+ self.lookaside_cgi, self.gitbaseurl,
-+ self.anongiturl, self.branchre, self.kojiprofile,
-+ self.build_client, self.user, self.dist,
-+ self.target, self.quiet)
-+ os.chdir(self.cloned_dir)
-
- spec_file = 'module.spec'
- with open(spec_file, 'w') as f:
- f.write(SPECFILE_TEMPLATE % '')
-
-- cmd.repo.index.add([spec_file])
-- cmd.repo.index.commit("add SPEC")
-+ self.cmd.repo.index.add([spec_file])
-+ self.cmd.repo.index.commit("add SPEC")
-
- # Now, change directory to parent and test the push
- os.chdir(self.path)
-- cmd.push(no_verify=True)
-+ self.cmd.push(no_verify=True)
-
-
- class TestPushWithPatches(CommandTestCase):
-@@ -76,18 +77,20 @@ class TestPushWithPatches(CommandTestCase):
-
- self.make_new_git(self.module)
-
-- import pyrpkg
-- self.cmd = pyrpkg.Commands(self.path, self.lookaside,
-+ moduledir = os.path.join(self.gitroot, self.module)
-+ subprocess.check_call(['git', 'clone', 'file://%s' % moduledir],
-+ cwd=self.path, stdout=subprocess.PIPE,
-+ stderr=subprocess.PIPE)
-+
-+ self.cloned_dir = os.path.join(self.path, self.module)
-+ self.cmd = pyrpkg.Commands(self.cloned_dir, self.lookaside,
- self.lookasidehash,
- self.lookaside_cgi, self.gitbaseurl,
- self.anongiturl, self.branchre,
- self.kojiprofile,
- self.build_client, self.user, self.dist,
- self.target, self.quiet)
-- self.cmd.clone_config_rpms = CLONE_CONFIG
-- self.cmd.clone(self.module, anon=True)
-- self.cmd.path = os.path.join(self.path, self.module)
-- os.chdir(os.path.join(self.path, self.module))
-+ os.chdir(self.cloned_dir)
-
- # Track SPEC and a.patch in git
- spec_file = 'module.spec'
-@@ -103,7 +106,6 @@ Patch3: d.path
- f.write(patch_file)
-
- # Track c.patch in sources
-- from pyrpkg.sources import SourcesFile
- sources_file = SourcesFile(self.cmd.sources_filename,
- self.cmd.source_entry_type)
- file_hash = self.cmd.lookasidecache.hash_file('c.patch')
-diff --git a/tests/test_cli.py b/tests/test_cli.py
-index df053aa..868ad1f 100644
---- a/tests/test_cli.py
-+++ b/tests/test_cli.py
-@@ -1841,9 +1841,11 @@ class TestMockbuild(CliTestCase):
- @patch('pyrpkg.Commands._config_dir_basic')
- @patch('pyrpkg.Commands._config_dir_other')
- @patch('os.path.exists', return_value=False)
-+ @patch('pyrpkg.utils.validate_path')
- def test_use_mock_config_got_from_koji(
-- self, exists, config_dir_other, config_dir_basic):
-+ self, validate_path, exists, config_dir_other, config_dir_basic):
- mock_layout = layout.DistGitLayout(root_dir=self.cloned_repo_path)
-+ validate_path.return_value = self.cloned_repo_path
- with patch('pyrpkg.layout.build', return_value=mock_layout):
- config_dir_basic.return_value = '/path/to/config-dir'
-
-@@ -1859,9 +1861,11 @@ class TestMockbuild(CliTestCase):
-
- @patch('pyrpkg.Commands._config_dir_basic')
- @patch('os.path.exists', return_value=False)
-+ @patch('pyrpkg.utils.validate_path')
- def test_fail_to_store_mock_config_in_created_config_dir(
-- self, exists, config_dir_basic):
-+ self, validate_path, exists, config_dir_basic):
- config_dir_basic.side_effect = rpkgError
-+ validate_path.return_value = self.cloned_repo_path
-
- cli_cmd = ['rpkg', '--path', self.cloned_repo_path,
- '--release', 'rhel-7', 'mockbuild']
-@@ -1870,10 +1874,12 @@ class TestMockbuild(CliTestCase):
- @patch('pyrpkg.Commands._config_dir_basic')
- @patch('pyrpkg.Commands._config_dir_other')
- @patch('os.path.exists', return_value=False)
-+ @patch('pyrpkg.utils.validate_path')
- def test_fail_to_populate_mock_config(
-- self, exists, config_dir_other, config_dir_basic):
-+ self, validate_path, exists, config_dir_other, config_dir_basic):
- config_dir_basic.return_value = '/path/to/config-dir'
- config_dir_other.side_effect = rpkgError
-+ validate_path.return_value = self.cloned_repo_path
-
- cli_cmd = ['rpkg', '--path', self.cloned_repo_path,
- '--release', 'rhel-7', 'mockbuild']
---
-2.39.2
-
diff --git a/0008-Update-to-spec-file-presence-checking.patch b/0008-Update-to-spec-file-presence-checking.patch
deleted file mode 100644
index 723415f..0000000
--- a/0008-Update-to-spec-file-presence-checking.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From 791fd03b4de1324508583ab53c89cc67459db355 Mon Sep 17 00:00:00 2001
-From: Ondrej Nosek <onosek@redhat.com>
-Date: Tue, 21 Mar 2023 13:44:38 +0100
-Subject: [PATCH 08/12] Update to spec file presence checking
-
-Using a different approach to checking the layout. Older way prevented
-`retire` function working correctly. Layouts are detected at the
-beginning of the run and the result stays the same, unlike the direct
-checking files like dead.package in function `is_retired`.
-
-Fixes: #663
-JIRA: RHELCMP-11387
-
-Signed-off-by: Ondrej Nosek <onosek@redhat.com>
----
- pyrpkg/__init__.py | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
-index 028d195..e8f4886 100644
---- a/pyrpkg/__init__.py
-+++ b/pyrpkg/__init__.py
-@@ -925,7 +925,7 @@ class Commands(object):
-
- if self.layout is None or isinstance(self.layout, layout.IncompleteLayout):
- raise rpkgError('Spec file is not available')
-- if self.is_retired():
-+ if isinstance(self.layout, layout.RetiredLayout):
- raise rpkgError('This package or module is retired. The action has stopped.')
-
- # Get a list of ".spec" files in the path we're looking at
-@@ -1167,7 +1167,7 @@ class Commands(object):
- def sources_filename(self):
- if self.layout is None or isinstance(self.layout, layout.IncompleteLayout):
- raise rpkgError('Spec file is not available')
-- if self.is_retired():
-+ if isinstance(self.layout, layout.RetiredLayout):
- raise rpkgError('This package or module is retired. The action has stopped.')
- return os.path.join(
- self.path, self.layout.sources_file_template.replace("{0.repo_name}", self.repo_name))
---
-2.39.2
-
diff --git a/0009-Add-more-information-about-pre-push-hook.patch b/0009-Add-more-information-about-pre-push-hook.patch
deleted file mode 100644
index 60bad27..0000000
--- a/0009-Add-more-information-about-pre-push-hook.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From 0393dc39bf450cf20df9db63bac135c078f64a14 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= <lsedlar@redhat.com>
-Date: Tue, 28 Mar 2023 08:53:30 +0200
-Subject: [PATCH 09/12] Add more information about pre-push hook
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-It's not obvious to many users where the check is coming from, and they
-have the power to edit the script or delete it completely. Let's try to
-improve that a bit.
-
-Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
----
- pyrpkg/__init__.py | 6 +++++-
- 1 file changed, 5 insertions(+), 1 deletion(-)
-
-diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
-index e8f4886..7a3c9c6 100644
---- a/pyrpkg/__init__.py
-+++ b/pyrpkg/__init__.py
-@@ -1806,6 +1806,10 @@ class Commands(object):
- hook_content = textwrap.dedent("""
- #!/bin/bash
-
-+ # This file was generated by {0} when cloning the repository.
-+ # You can edit it to your liking or delete completely. It will not
-+ # be recreated.
-+
- _remote="$1"
- _url="$2"
-
-@@ -4429,7 +4433,7 @@ class Commands(object):
- return self._repo_name, version, release
-
- def pre_push_check(self, ref):
-- show_hint = ('Hint: this check (pre-push hook script) can be bypassed by adding '
-+ show_hint = ('Hint: this check (.git/hooks/pre-push script) can be bypassed by adding '
- 'the argument \'--no-verify\' argument to the push command.')
- try:
- commit = self.repo.commit(ref)
---
-2.39.2
-
diff --git a/0010-pre-push-check-have-to-use-spectool-with-define.patch b/0010-pre-push-check-have-to-use-spectool-with-define.patch
deleted file mode 100644
index bfe7094..0000000
--- a/0010-pre-push-check-have-to-use-spectool-with-define.patch
+++ /dev/null
@@ -1,146 +0,0 @@
-From d5be51eec99108c3809551b615064d0c5cbe628a Mon Sep 17 00:00:00 2001
-From: Ondrej Nosek <onosek@redhat.com>
-Date: Tue, 28 Mar 2023 19:58:06 +0200
-Subject: [PATCH 10/12] `pre-push-check` have to use spectool with --define
-
-To get all defined source files and patches from the specfile,
-the 'spectool' utility needs '--define' argument(s) to set specific
-paths for the repository.
-
-JIRA: RHELCMP-11466
-Fixes: #672
-
-Signed-off-by: Ondrej Nosek <onosek@redhat.com>
----
- pyrpkg/__init__.py | 57 +++++++++++++++------------
- tests/commands/test_pre_push_check.py | 3 +-
- 2 files changed, 33 insertions(+), 27 deletions(-)
-
-diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
-index 7a3c9c6..584c141 100644
---- a/pyrpkg/__init__.py
-+++ b/pyrpkg/__init__.py
-@@ -4442,30 +4442,41 @@ class Commands(object):
- sys.exit(1)
-
- try:
-+ clone_dir = tempfile.mkdtemp(prefix="pre_push_hook_")
-+ for cmd in [
-+ ('git', 'clone', self.path, clone_dir),
-+ ('git', 'checkout', ref),
-+ ]:
-+ ret, _, _ = self._run_command(cmd, cwd=clone_dir,
-+ # suppress unwanted printing of command line messages
-+ return_stdout=True, return_stderr=True)
-+ if ret != 0:
-+ self.log.error('Command \'{0}\' failed. Push operation '
-+ 'was cancelled.'.format(' '.join(cmd)))
-+ self.log.warning(show_hint)
-+ sys.exit(2)
-+
-+ # get all source files from the specfile (including patches)
- # Assume, that specfile names are same in the active branch
- # and in the pushed branch (git checkout f37 && git push origin rawhide)
- # in this case 'f37' is active branch and 'rawhide' is pushed branch.
- specfile_path_absolute = os.path.join(self.layout.specdir, self.spec)
- # convert to relative path
- specfile_path = os.path.relpath(specfile_path_absolute, start=self.path)
-- spec_content = self.repo.git.cat_file("-p", "{0}:{1}".format(ref, specfile_path))
-- except Exception:
-- # It might be the case of an empty commit
-- self.log.warning('Specfile doesn\'t exist. Push operation continues.')
-- return
--
-- # load specfile content from pushed branch and save it into a temporary file
-- with tempfile.NamedTemporaryFile(mode="w+") as temporary_spec:
-- temporary_spec.write(spec_content)
-- temporary_spec.flush()
-- # get all source files from the specfile (including patches)
-- cmd = ('spectool', '-l', temporary_spec.name)
-- ret, stdout, _ = self._run_command(cmd, return_text=True, return_stdout=True)
-+ cmd = ['spectool', '-l', os.path.join(clone_dir, specfile_path)]
-+ # extract just '--define' arguments from rpmdefines
-+ for opt, val in zip(self.rpmdefines[0::2], self.rpmdefines[1::2]):
-+ if opt == '--define':
-+ cmd.extend((opt, val))
-+ ret, stdout, _ = self._run_command(cmd, cwd=clone_dir,
-+ return_text=True, return_stdout=True)
- if ret != 0:
- self.log.error('Command \'{0}\' failed. Push operation '
- 'was cancelled.'.format(' '.join(cmd)))
- self.log.warning(show_hint)
-- sys.exit(2)
-+ sys.exit(3)
-+ finally:
-+ self._cleanup_tmp_dir(clone_dir)
-
- source_files = []
- # extract source files from the spectool's output
-@@ -4490,22 +4501,16 @@ class Commands(object):
- sources_file_path_absolute = self.sources_filename
- # convert to relative path
- sources_file_path = os.path.relpath(sources_file_path_absolute, start=self.path)
-- sources_file_content = self.repo.git.cat_file(
-- '-p', '{0}:{1}'.format(ref, sources_file_path))
-+
-+ # parse 'sources' files content
-+ sourcesf = SourcesFile(sources_file_path, self.source_entry_type)
-+ sourcesf_entries = set(item.file for item in sourcesf.entries)
- except Exception:
- self.log.warning('\'sources\' file doesn\'t exist. Push operation continues.')
- # NOTE: check doesn't fail when 'sources' file doesn't exist. Just skips the rest.
- # it might be the case of the push without 'sources' = retiring the repository
- return
-
-- # load 'sources' file content from pushed branch and save it into a temporary file
-- with tempfile.NamedTemporaryFile(mode="w+") as temporary_sources_file:
-- temporary_sources_file.write(sources_file_content)
-- temporary_sources_file.flush()
-- # parse 'sources' files content
-- sourcesf = SourcesFile(temporary_sources_file.name, self.source_entry_type)
-- sourcesf_entries = set(item.file for item in sourcesf.entries)
--
- # list of all files (their relative paths) in the commit
- repo_entries = set(item.path for item in commit.tree.traverse() if item.type != "tree")
-
-@@ -4518,7 +4523,7 @@ class Commands(object):
- 'nor tracked in git. '
- 'Push operation was cancelled'.format(source_file))
- self.log.warning(show_hint)
-- sys.exit(3)
-+ sys.exit(4)
-
- # verify all file entries in 'sources' were uploaded to the lookaside cache
- for entry in sourcesf.entries:
-@@ -4532,6 +4537,6 @@ class Commands(object):
- self.log.error('Source file (or tarball) \'{}\' wasn\'t uploaded to the lookaside '
- 'cache. Push operation was cancelled.'.format(filename))
- self.log.warning(show_hint)
-- sys.exit(4)
-+ sys.exit(5)
-
- return 0 # The push operation continues
-diff --git a/tests/commands/test_pre_push_check.py b/tests/commands/test_pre_push_check.py
-index 5e314b9..ee151c1 100644
---- a/tests/commands/test_pre_push_check.py
-+++ b/tests/commands/test_pre_push_check.py
-@@ -37,6 +37,7 @@ class TestPrePushCheck(CommandTestCase):
- def setUp(self):
- super(TestPrePushCheck, self).setUp()
-
-+ self.dist = "rhel-8"
- self.make_new_git(self.module)
-
- moduledir = os.path.join(self.gitroot, self.module)
-@@ -87,7 +88,7 @@ Patch3: d.patch
- with self.assertRaises(SystemExit) as exc:
- self.cmd.pre_push_check("HEAD")
-
-- self.assertEqual(exc.exception.code, 3)
-+ self.assertEqual(exc.exception.code, 4)
- log_error.assert_called_once_with("Source file 'b.patch' was neither listed in the "
- "'sources' file nor tracked in git. Push operation "
- "was cancelled")
---
-2.39.2
-
diff --git a/0011-A-HEAD-query-into-a-lookaside-cache.patch b/0011-A-HEAD-query-into-a-lookaside-cache.patch
deleted file mode 100644
index a3281b2..0000000
--- a/0011-A-HEAD-query-into-a-lookaside-cache.patch
+++ /dev/null
@@ -1,97 +0,0 @@
-From 77cd608e596af94811c22a16ff58a265d9c7381e Mon Sep 17 00:00:00 2001
-From: Ondrej Nosek <onosek@redhat.com>
-Date: Fri, 31 Mar 2023 14:09:09 +0200
-Subject: [PATCH 11/12] A HEAD query into a lookaside cache
-
-A query about whether some file is present in the lookaside cache was
-under authentication and it prevented using command `pre-push-check`
-for those without the 'packager' permission.
-Added another method (based on HTTP HEAD), that allows the same check
-without authentication.
-
-JIRA: RHELCMP-11485
-Fixes: https://pagure.io/fedpkg/issue/513
-
-Signed-off-by: Ondrej Nosek <onosek@redhat.com>
----
- pyrpkg/__init__.py | 2 +-
- pyrpkg/lookaside.py | 36 ++++++++++++++++++++++++++++++++++--
- 2 files changed, 35 insertions(+), 3 deletions(-)
-
-diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
-index 584c141..15203b7 100644
---- a/pyrpkg/__init__.py
-+++ b/pyrpkg/__init__.py
-@@ -4529,7 +4529,7 @@ class Commands(object):
- for entry in sourcesf.entries:
- filename = entry.file
- hash = entry.hash
-- file_exists_in_lookaside = self.lookasidecache.remote_file_exists(
-+ file_exists_in_lookaside = self.lookasidecache.remote_file_exists_head(
- self.ns_repo_name if self.lookaside_namespaced else self.repo_name,
- filename,
- hash)
-diff --git a/pyrpkg/lookaside.py b/pyrpkg/lookaside.py
-index 90f0f1e..ecbf12b 100644
---- a/pyrpkg/lookaside.py
-+++ b/pyrpkg/lookaside.py
-@@ -22,7 +22,7 @@ import sys
-
- import pycurl
- import six
--from six.moves import http_client
-+from six.moves import http_client, urllib
-
- from .errors import (AlreadyUploadedError, DownloadError, InvalidHashType,
- UploadError)
-@@ -157,7 +157,7 @@ class CGILookasideCache(object):
- return
-
- self.log.info("Downloading %s", filename)
-- urled_file = filename.replace(' ', '%20')
-+ urled_file = urllib.parse.quote(filename)
- url = self.get_download_url(name, urled_file, hash, hashtype, **kwargs)
- if isinstance(url, six.text_type):
- url = url.encode('utf-8')
-@@ -200,6 +200,38 @@ class CGILookasideCache(object):
- if not self.file_is_valid(outfile, hash, hashtype=hashtype):
- raise DownloadError('%s failed checksum' % filename)
-
-+ def remote_file_exists_head(self, name, filename, hash):
-+ """Verify whether a file exists on the lookaside cache.
-+ Uses a HTTP HEAD request and doesn't require authentication.
-+
-+ :param str name: The name of the module. (usually the name of the
-+ SRPM). This can include the namespace as well (depending on what
-+ the server side expects).
-+ :param str filename: The name of the file to check for.
-+ :param str hash: The known good hash of the file.
-+ """
-+
-+ urled_file = urllib.parse.quote(filename)
-+ url = self.get_download_url(name, urled_file, hash, self.hashtype)
-+
-+ c = pycurl.Curl()
-+ c.setopt(pycurl.URL, url)
-+ c.setopt(pycurl.NOBODY, True)
-+ c.setopt(pycurl.FOLLOWLOCATION, 1)
-+
-+ try:
-+ c.perform()
-+ status = c.getinfo(pycurl.RESPONSE_CODE)
-+ except Exception as e:
-+ raise DownloadError(e)
-+ finally:
-+ c.close()
-+
-+ if status != 200:
-+ self.log.debug('Unavailable file \'%s\' at %s' % (filename, url))
-+ return False
-+ return True
-+
- def remote_file_exists(self, name, filename, hash):
- """Verify whether a file exists on the lookaside cache
-
---
-2.39.2
-
diff --git a/0012-pre-push-hook-script-contains-a-user-s-config.patch b/0012-pre-push-hook-script-contains-a-user-s-config.patch
deleted file mode 100644
index ff2676d..0000000
--- a/0012-pre-push-hook-script-contains-a-user-s-config.patch
+++ /dev/null
@@ -1,197 +0,0 @@
-From 1f03eb9102f765c36cc201a499d815732e67dd39 Mon Sep 17 00:00:00 2001
-From: Ondrej Nosek <onosek@redhat.com>
-Date: Mon, 27 Mar 2023 23:34:12 +0200
-Subject: [PATCH 12/12] pre-push hook script contains a user's config
-
-When the `clone` command is called with an argument
--C|--config <config_file>
-this argument is placed to the generated pre-push script.
-
-Fixes: #667
-JIRA: RHELCMP-11394
-
-Signed-off-by: Ondrej Nosek <onosek@redhat.com>
----
- pyrpkg/__init__.py | 23 ++++++++++++-------
- pyrpkg/cli.py | 6 +++--
- tests/commands/test_clone.py | 44 ++++++++++++++++++++++++++++++++++++
- 3 files changed, 63 insertions(+), 10 deletions(-)
-
-diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
-index 15203b7..9996402 100644
---- a/pyrpkg/__init__.py
-+++ b/pyrpkg/__init__.py
-@@ -1566,7 +1566,8 @@ class Commands(object):
- return
-
- def clone(self, repo, path=None, branch=None, bare_dir=None,
-- anon=False, target=None, depth=None, extra_args=None):
-+ anon=False, target=None, depth=None, extra_args=None,
-+ config_path=None):
- """Clone a repo, optionally check out a specific branch.
-
- :param str repo: the name of the repository to clone.
-@@ -1583,6 +1584,7 @@ class Commands(object):
- to the specified number of commits.
- :param list extra_args: additional arguments that are passed to
- the clone command.
-+ :param str config_path: path to the global config file
- """
-
- if not path:
-@@ -1638,7 +1640,7 @@ class Commands(object):
-
- if not bare_dir:
- self._add_git_excludes(os.path.join(path, git_dir))
-- self._add_git_pre_push_hook(os.path.join(path, git_dir))
-+ self._add_git_pre_push_hook(os.path.join(path, git_dir), config_path)
-
- return
-
-@@ -1654,7 +1656,7 @@ class Commands(object):
- return repo
-
- def clone_with_dirs(self, repo, anon=False, target=None, depth=None,
-- extra_args=None):
-+ extra_args=None, config_path=None):
- """Clone a repo old style with subdirs for each branch.
-
- :param str repo: name of the repository to clone.
-@@ -1666,6 +1668,7 @@ class Commands(object):
- to the specified number of commits.
- :param list extra_args: additional arguments that are passed to
- the clone command.
-+ :param str config_path: path to the global config file
- """
-
- self._push_url = None
-@@ -1724,7 +1727,7 @@ class Commands(object):
-
- # Add excludes
- self._add_git_excludes(branch_path)
-- self._add_git_pre_push_hook(branch_path)
-+ self._add_git_pre_push_hook(branch_path, config_path)
- except (git.GitCommandError, OSError) as e:
- raise rpkgError('Could not locally clone %s from %s: %s'
- % (branch, repo_path, e))
-@@ -1787,7 +1790,7 @@ class Commands(object):
- git_excludes.write()
- self.log.debug('Git-excludes patterns were added into %s' % git_excludes_path)
-
-- def _add_git_pre_push_hook(self, conf_dir):
-+ def _add_git_pre_push_hook(self, repo_dir, config_path=None):
- """
- Create pre-push hook script and write it in the location:
- <repository_directory>/.git/hooks/pre-push
-@@ -1803,6 +1806,10 @@ class Commands(object):
- self.log.debug('Pre-push hook script was NOT added - missing '
- 'the packaging tool like fedpkg, rhpkg, ...')
- return
-+
-+ # in case the clone command run with 'x-pkg -C <config_path> clone <repo_name>'
-+ config_arg = ' -C "{0}"'.format(os.path.realpath(config_path)) if config_path else ""
-+
- hook_content = textwrap.dedent("""
- #!/bin/bash
-
-@@ -1818,7 +1825,7 @@ class Commands(object):
- do
- command -v {0} >/dev/null 2>&1 || {{ echo >&2 "Warning: '{0}' is missing, \\
- pre-push check is omitted. See .git/hooks/pre-push"; exit 0; }}
-- {0} pre-push-check "$local_sha"
-+ {0}{1} pre-push-check "$local_sha"
- ret_code=$?
- if [ $ret_code -ne 0 ] && [ $exit_code -eq 0 ]; then
- exit_code=$ret_code
-@@ -1826,8 +1833,8 @@ class Commands(object):
- done
-
- exit $exit_code
-- """).strip().format(tool_name)
-- git_pre_push_hook_path = os.path.join(conf_dir, '.git/hooks/pre-push')
-+ """).strip().format(tool_name, config_arg)
-+ git_pre_push_hook_path = os.path.join(repo_dir, '.git/hooks/pre-push')
- if not os.path.exists(os.path.dirname(git_pre_push_hook_path)):
- # prepare ".git/hooks" directory if it is missing
- os.makedirs(os.path.dirname(git_pre_push_hook_path))
-diff --git a/pyrpkg/cli.py b/pyrpkg/cli.py
-index 1bcf6e4..3d8ce33 100644
---- a/pyrpkg/cli.py
-+++ b/pyrpkg/cli.py
-@@ -2182,14 +2182,16 @@ class cliClient(object):
- anon=self.args.anonymous,
- target=self.args.clone_target,
- depth=self.args.depth,
-- extra_args=self.extra_args)
-+ extra_args=self.extra_args,
-+ config_path=self.args.config)
- else:
- self.cmd.clone(self.args.repo[0],
- branch=self.args.branch,
- anon=self.args.anonymous,
- target=self.args.clone_target,
- depth=self.args.depth,
-- extra_args=self.extra_args)
-+ extra_args=self.extra_args,
-+ config_path=self.args.config)
-
- def commit(self):
- if self.args.with_changelog and not self.args.message:
-diff --git a/tests/commands/test_clone.py b/tests/commands/test_clone.py
-index f741864..6ef1300 100644
---- a/tests/commands/test_clone.py
-+++ b/tests/commands/test_clone.py
-@@ -95,6 +95,50 @@ class CommandCloneTestCase(CommandTestCase):
-
- shutil.rmtree(altpath)
-
-+ def test_clone_anonymous_pre_push_hook(self):
-+ self.make_new_git(self.module)
-+
-+ altpath = tempfile.mkdtemp(prefix='rpkg-tests.')
-+
-+ cmd = pyrpkg.Commands(self.path, self.lookaside, self.lookasidehash,
-+ self.lookaside_cgi, self.gitbaseurl,
-+ self.anongiturl, self.branchre, self.kojiprofile,
-+ self.build_client, self.user, self.dist,
-+ self.target, self.quiet)
-+ cmd.clone(self.module, anon=True, config_path=None)
-+
-+ moduledir = os.path.join(self.path, self.module)
-+ self.assertTrue(os.path.isfile(os.path.join(moduledir, '.git/hooks/pre-push')))
-+
-+ with open(os.path.join(moduledir, '.git/hooks/pre-push')) as git_hook_script:
-+ content = git_hook_script.read()
-+ pattern = '__main__.py pre-push-check "$local_sha"'
-+ self.assertIn(pattern, content)
-+
-+ shutil.rmtree(altpath)
-+
-+ def test_clone_anonymous_pre_push_hook_config(self):
-+ self.make_new_git(self.module)
-+
-+ altpath = tempfile.mkdtemp(prefix='rpkg-tests.')
-+
-+ cmd = pyrpkg.Commands(self.path, self.lookaside, self.lookasidehash,
-+ self.lookaside_cgi, self.gitbaseurl,
-+ self.anongiturl, self.branchre, self.kojiprofile,
-+ self.build_client, self.user, self.dist,
-+ self.target, self.quiet)
-+ cmd.clone(self.module, anon=True, config_path="/home/conf/rhpkg.conf")
-+
-+ moduledir = os.path.join(self.path, self.module)
-+ self.assertTrue(os.path.isfile(os.path.join(moduledir, '.git/hooks/pre-push')))
-+
-+ with open(os.path.join(moduledir, '.git/hooks/pre-push')) as git_hook_script:
-+ content = git_hook_script.read()
-+ pattern = '__main__.py -C "/home/conf/rhpkg.conf" pre-push-check "$local_sha"'
-+ self.assertIn(pattern, content)
-+
-+ shutil.rmtree(altpath)
-+
- def test_clone_anonymous_with_branch(self):
- self.make_new_git(self.module,
- branches=['rpkg-tests-1', 'rpkg-tests-2'])
---
-2.39.2
-
diff --git a/0013-Fix-unittests-for-clone-and-pre-push-hook-script.patch b/0013-Fix-unittests-for-clone-and-pre-push-hook-script.patch
deleted file mode 100644
index 991fb22..0000000
--- a/0013-Fix-unittests-for-clone-and-pre-push-hook-script.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-From 1d82b7eaf98e695689a7dc10bd308030e3c13eea Mon Sep 17 00:00:00 2001
-From: Ondrej Nosek <onosek@redhat.com>
-Date: Sat, 1 Apr 2023 01:34:34 +0200
-Subject: [PATCH] Fix unittests for `clone` and pre-push hook script
-
-Signed-off-by: Ondrej Nosek <onosek@redhat.com>
----
- tests/commands/test_clone.py | 8 ++++++--
- 1 file changed, 6 insertions(+), 2 deletions(-)
-
-diff --git a/tests/commands/test_clone.py b/tests/commands/test_clone.py
-index 6ef1300..85fdfd1 100644
---- a/tests/commands/test_clone.py
-+++ b/tests/commands/test_clone.py
-@@ -1,5 +1,6 @@
- import os
- import shutil
-+import sys
- import tempfile
-
- import git
-@@ -110,9 +111,10 @@ class CommandCloneTestCase(CommandTestCase):
- moduledir = os.path.join(self.path, self.module)
- self.assertTrue(os.path.isfile(os.path.join(moduledir, '.git/hooks/pre-push')))
-
-+ clonned_by = os.path.basename(sys.argv[0])
- with open(os.path.join(moduledir, '.git/hooks/pre-push')) as git_hook_script:
- content = git_hook_script.read()
-- pattern = '__main__.py pre-push-check "$local_sha"'
-+ pattern = '{0} pre-push-check "$local_sha"'.format(clonned_by)
- self.assertIn(pattern, content)
-
- shutil.rmtree(altpath)
-@@ -132,9 +134,11 @@ class CommandCloneTestCase(CommandTestCase):
- moduledir = os.path.join(self.path, self.module)
- self.assertTrue(os.path.isfile(os.path.join(moduledir, '.git/hooks/pre-push')))
-
-+ clonned_by = os.path.basename(sys.argv[0])
- with open(os.path.join(moduledir, '.git/hooks/pre-push')) as git_hook_script:
- content = git_hook_script.read()
-- pattern = '__main__.py -C "/home/conf/rhpkg.conf" pre-push-check "$local_sha"'
-+ pattern = '{0} -C "/home/conf/rhpkg.conf" pre-push-check ' \
-+ '"$local_sha"'.format(clonned_by)
- self.assertIn(pattern, content)
-
- shutil.rmtree(altpath)
---
-2.39.2
-
diff --git a/0014-import_srpm-allow-pre-generated-srpms.patch b/0014-import_srpm-allow-pre-generated-srpms.patch
deleted file mode 100644
index f596265..0000000
--- a/0014-import_srpm-allow-pre-generated-srpms.patch
+++ /dev/null
@@ -1,105 +0,0 @@
-From d87cb37fa2fea2ed535b9085a1f4c607083e1c2e Mon Sep 17 00:00:00 2001
-From: Ondrej Nosek <onosek@redhat.com>
-Date: Tue, 4 Apr 2023 01:40:23 +0200
-Subject: [PATCH 1/6] import_srpm: allow pre-generated srpms
-
-When active, do not care specfile in the srpm is processed by
-rpmautospec. Can be activated only directly via pyrpkg 'Commands'
-object.
-
-Relates: https://github.com/fedora-copr/copr/issues/2317
-Fixes: #655
-RHELCMP-11085
-
-Signed-off-by: Ondrej Nosek <onosek@redhat.com>
----
- pyrpkg/__init__.py | 6 +++++-
- tests/test_cli.py | 41 +++++++++++++++++++++++++++++++++++++++++
- 2 files changed, 46 insertions(+), 1 deletion(-)
-
-diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
-index 9996402..ecb99c9 100644
---- a/pyrpkg/__init__.py
-+++ b/pyrpkg/__init__.py
-@@ -110,7 +110,7 @@ class Commands(object):
- build_client, user=None,
- dist=None, target=None, quiet=False,
- distgit_namespaced=False, realms=None, lookaside_namespaced=False,
-- git_excludes=None, results_dir='root'):
-+ git_excludes=None, results_dir='root', allow_pre_generated_srpm=False):
- """Init the object and some configuration details."""
-
- # Path to operate on, most often pwd
-@@ -239,6 +239,9 @@ class Commands(object):
- # Layout setup
- self.layout = layout.build(self.path,
- 'resultsdir' if self.results_dir == 'subdir' else None)
-+ # A Configuration value used in 'import_srpm' command (comes from the Copr team)
-+ # If pre-generated srpms are allowed, don't care specfile is processed by rpmautospec
-+ self.allow_pre_generated_srpm = allow_pre_generated_srpm
-
- # Define properties here
- # Properties allow us to "lazy load" various attributes, which also means
-@@ -1471,6 +1474,7 @@ class Commands(object):
- # the dist-git repo without any specfiles - right after initialization) we are
- # not able determine which the main specfile is.
- if file.endswith('.spec') and not file.startswith('.') \
-+ and not self.allow_pre_generated_srpm \
- and spec_file_processed_by_rpmautospec(file, target_dir):
- raise rpkgError('SRPM was processed by rpmautospec '
- '(specfile "{}" was analyzed)'.format(file))
-diff --git a/tests/test_cli.py b/tests/test_cli.py
-index 868ad1f..02620ef 100644
---- a/tests/test_cli.py
-+++ b/tests/test_cli.py
-@@ -1784,6 +1784,47 @@ class TestImportSrpm(LookasideCacheMock, CliTestCase):
- self.assertFilesExist(['package.rpmlintrc'], search_dir=self.chaos_repo)
- self.assertFilesNotExist(['the_file_is_not_in_reserved.yaml'], search_dir=self.chaos_repo)
-
-+ @patch('pyrpkg.spec_file_processed_by_rpmautospec')
-+ def test_import_srpm_not_processed_by_rpmautospec(self, rpmautospec_processed):
-+ cli_cmd = ['rpkg', '--path', self.chaos_repo, '--name', 'docpkg',
-+ 'import', '--skip-diffs', self.srpm_file]
-+
-+ rpmautospec_processed.return_value = False
-+ with patch('sys.argv', new=cli_cmd):
-+ cli = self.new_cli()
-+ with patch('pyrpkg.lookaside.CGILookasideCache.upload', self.lookasidecache_upload):
-+ cli.import_srpm() # no exception should be raised
-+ rpmautospec_processed.assert_called_once()
-+
-+ @patch('pyrpkg.spec_file_processed_by_rpmautospec')
-+ def test_import_srpm_processed_by_rpmautospec(self, rpmautospec_processed):
-+ cli_cmd = ['rpkg', '--path', self.chaos_repo, '--name', 'docpkg',
-+ 'import', '--skip-diffs', self.srpm_file]
-+
-+ rpmautospec_processed.return_value = True
-+ with patch('sys.argv', new=cli_cmd):
-+ cli = self.new_cli()
-+ with patch('pyrpkg.lookaside.CGILookasideCache.upload', self.lookasidecache_upload):
-+ six.assertRaisesRegex(
-+ self,
-+ rpkgError,
-+ 'SRPM was processed by rpmautospec',
-+ cli.import_srpm)
-+ rpmautospec_processed.assert_called_once()
-+
-+ @patch('pyrpkg.spec_file_processed_by_rpmautospec')
-+ def test_import_srpm_processed_by_rpmautospec_allowed(self, rpmautospec_processed):
-+ cli_cmd = ['rpkg', '--path', self.chaos_repo, '--name', 'docpkg',
-+ 'import', '--skip-diffs', self.srpm_file]
-+
-+ rpmautospec_processed.return_value = True
-+ with patch('sys.argv', new=cli_cmd):
-+ cli = self.new_cli()
-+ cli.cmd.allow_pre_generated_srpm = True
-+ with patch('pyrpkg.lookaside.CGILookasideCache.upload', self.lookasidecache_upload):
-+ cli.import_srpm() # no exception should be raised
-+ rpmautospec_processed.assert_not_called()
-+
-
- class TestMockbuild(CliTestCase):
- """Test mockbuild command"""
---
-2.39.2
-
diff --git a/0015-Ignore-missing-spec-file-in-pre-push-hook.patch b/0015-Ignore-missing-spec-file-in-pre-push-hook.patch
deleted file mode 100644
index b32833c..0000000
--- a/0015-Ignore-missing-spec-file-in-pre-push-hook.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From 3ebfeae20c74de0ca4b26b22135e1996265ea4ce Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= <lsedlar@redhat.com>
-Date: Wed, 5 Apr 2023 11:41:23 +0200
-Subject: [PATCH 2/6] Ignore missing spec file in pre-push hook
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-For modules or containers there will be no spec file, and there is
-nothing to block the push on.
-
-Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
----
- pyrpkg/__init__.py | 7 ++++++-
- 1 file changed, 6 insertions(+), 1 deletion(-)
-
-diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
-index ecb99c9..d3a7a1c 100644
---- a/pyrpkg/__init__.py
-+++ b/pyrpkg/__init__.py
-@@ -4471,7 +4471,12 @@ class Commands(object):
- # Assume, that specfile names are same in the active branch
- # and in the pushed branch (git checkout f37 && git push origin rawhide)
- # in this case 'f37' is active branch and 'rawhide' is pushed branch.
-- specfile_path_absolute = os.path.join(self.layout.specdir, self.spec)
-+ try:
-+ specfile_path_absolute = os.path.join(self.layout.specdir, self.spec)
-+ except rpkgError:
-+ # No specfile found, nothing to check
-+ return
-+
- # convert to relative path
- specfile_path = os.path.relpath(specfile_path_absolute, start=self.path)
- cmd = ['spectool', '-l', os.path.join(clone_dir, specfile_path)]
---
-2.39.2
-
diff --git a/0016-Check-remote-file-with-correct-hash.patch b/0016-Check-remote-file-with-correct-hash.patch
deleted file mode 100644
index 9bf9eac..0000000
--- a/0016-Check-remote-file-with-correct-hash.patch
+++ /dev/null
@@ -1,61 +0,0 @@
-From 4bd4ab1823a7d4bc218b8057b7f00808fabf7648 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= <lsedlar@redhat.com>
-Date: Wed, 5 Apr 2023 09:34:33 +0200
-Subject: [PATCH 3/6] Check remote file with correct hash
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-The configured hashtype doesn't have to actually be used. There can be
-old repos that still use md5.
-
-JIRA: RHELCMP-11508
-Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
----
- pyrpkg/__init__.py | 3 ++-
- pyrpkg/lookaside.py | 5 +++--
- 2 files changed, 5 insertions(+), 3 deletions(-)
-
-diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
-index d3a7a1c..0b9a869 100644
---- a/pyrpkg/__init__.py
-+++ b/pyrpkg/__init__.py
-@@ -4548,7 +4548,8 @@ class Commands(object):
- file_exists_in_lookaside = self.lookasidecache.remote_file_exists_head(
- self.ns_repo_name if self.lookaside_namespaced else self.repo_name,
- filename,
-- hash)
-+ hash,
-+ hashtype=entry.hashtype)
- if not file_exists_in_lookaside:
- self.log.error('Source file (or tarball) \'{}\' wasn\'t uploaded to the lookaside '
- 'cache. Push operation was cancelled.'.format(filename))
-diff --git a/pyrpkg/lookaside.py b/pyrpkg/lookaside.py
-index ecbf12b..3efcd88 100644
---- a/pyrpkg/lookaside.py
-+++ b/pyrpkg/lookaside.py
-@@ -200,7 +200,7 @@ class CGILookasideCache(object):
- if not self.file_is_valid(outfile, hash, hashtype=hashtype):
- raise DownloadError('%s failed checksum' % filename)
-
-- def remote_file_exists_head(self, name, filename, hash):
-+ def remote_file_exists_head(self, name, filename, hash, hashtype):
- """Verify whether a file exists on the lookaside cache.
- Uses a HTTP HEAD request and doesn't require authentication.
-
-@@ -209,10 +209,11 @@ class CGILookasideCache(object):
- the server side expects).
- :param str filename: The name of the file to check for.
- :param str hash: The known good hash of the file.
-+ :param str hashtype: The type of hash
- """
-
- urled_file = urllib.parse.quote(filename)
-- url = self.get_download_url(name, urled_file, hash, self.hashtype)
-+ url = self.get_download_url(name, urled_file, hash, hashtype or self.hashtype)
-
- c = pycurl.Curl()
- c.setopt(pycurl.URL, url)
---
-2.39.2
-
diff --git a/0017-Allow-empty-commits-when-uses_rpmautospec.patch b/0017-Allow-empty-commits-when-uses_rpmautospec.patch
deleted file mode 100644
index 448cbc9..0000000
--- a/0017-Allow-empty-commits-when-uses_rpmautospec.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-From d2c63c32306732695b7fe5f9dda3deecb7899f4f Mon Sep 17 00:00:00 2001
-From: Jiri Kyjovsky <j1.kyjovsky@gmail.com>
-Date: Sat, 15 Apr 2023 13:46:21 +0200
-Subject: [PATCH 4/6] Allow empty commits when `uses_rpmautospec`
-
-To avoid situations where the command `commit` by default does
-commit when no change in repo is present.
-
-Fixes: #677
-JIRA: RHELCMP-11489
-Merges: https://pagure.io/rpkg/pull-request/688
-
-Signed-off-by: Jiri Kyjovsky <j1.kyjovsky@gmail.com>
----
- pyrpkg/__init__.py | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
-
-diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
-index 0b9a869..187796e 100644
---- a/pyrpkg/__init__.py
-+++ b/pyrpkg/__init__.py
-@@ -1867,7 +1867,9 @@ class Commands(object):
-
- # construct the git command
- # We do this via subprocess because the git module is terrible.
-- cmd = ['git', 'commit', '--allow-empty']
-+ cmd = ['git', 'commit']
-+ if not self.is_retired() and self.uses_rpmautospec:
-+ cmd.append('--allow-empty')
- if signoff:
- cmd.append('-s')
- if self.quiet:
---
-2.39.2
-
diff --git a/0018-Config-file-option-to-skip-the-hook-script-creation.patch b/0018-Config-file-option-to-skip-the-hook-script-creation.patch
deleted file mode 100644
index fa9aa01..0000000
--- a/0018-Config-file-option-to-skip-the-hook-script-creation.patch
+++ /dev/null
@@ -1,126 +0,0 @@
-From b48eb502d330ec7a543805d7f185ea270df75b90 Mon Sep 17 00:00:00 2001
-From: Ondrej Nosek <onosek@redhat.com>
-Date: Wed, 12 Apr 2023 00:42:04 +0200
-Subject: [PATCH 5/6] Config file option to skip the hook script creation
-
-A new option named "skip_hooks" can be added to the config file
-(into the main section). It accepts boolean values and when
-the option is present and set, it prevents creating the pre-push
-hook script during cloning a dist-git repository.
-
-Fixes: https://pagure.io/fedpkg/issue/515
-JIRA: RHELCMP-11491
-
-Signed-off-by: Ondrej Nosek <onosek@redhat.com>
----
- pyrpkg/__init__.py | 14 ++++++++++----
- pyrpkg/cli.py | 13 +++++++++++--
- 2 files changed, 21 insertions(+), 6 deletions(-)
-
-diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
-index 187796e..7fddff7 100644
---- a/pyrpkg/__init__.py
-+++ b/pyrpkg/__init__.py
-@@ -1571,7 +1571,7 @@ class Commands(object):
-
- def clone(self, repo, path=None, branch=None, bare_dir=None,
- anon=False, target=None, depth=None, extra_args=None,
-- config_path=None):
-+ config_path=None, skip_hooks=None):
- """Clone a repo, optionally check out a specific branch.
-
- :param str repo: the name of the repository to clone.
-@@ -1589,6 +1589,7 @@ class Commands(object):
- :param list extra_args: additional arguments that are passed to
- the clone command.
- :param str config_path: path to the global config file
-+ :param bool skip_hooks: skip creation pre-push hook script
- """
-
- if not path:
-@@ -1644,7 +1645,8 @@ class Commands(object):
-
- if not bare_dir:
- self._add_git_excludes(os.path.join(path, git_dir))
-- self._add_git_pre_push_hook(os.path.join(path, git_dir), config_path)
-+ if not skip_hooks:
-+ self._add_git_pre_push_hook(os.path.join(path, git_dir), config_path)
-
- return
-
-@@ -1660,7 +1662,7 @@ class Commands(object):
- return repo
-
- def clone_with_dirs(self, repo, anon=False, target=None, depth=None,
-- extra_args=None, config_path=None):
-+ extra_args=None, config_path=None, skip_hooks=None):
- """Clone a repo old style with subdirs for each branch.
-
- :param str repo: name of the repository to clone.
-@@ -1673,6 +1675,7 @@ class Commands(object):
- :param list extra_args: additional arguments that are passed to
- the clone command.
- :param str config_path: path to the global config file
-+ :param bool skip_hooks: skip creation pre-push hook script
- """
-
- self._push_url = None
-@@ -1731,7 +1734,8 @@ class Commands(object):
-
- # Add excludes
- self._add_git_excludes(branch_path)
-- self._add_git_pre_push_hook(branch_path, config_path)
-+ if not skip_hooks:
-+ self._add_git_pre_push_hook(branch_path, config_path)
- except (git.GitCommandError, OSError) as e:
- raise rpkgError('Could not locally clone %s from %s: %s'
- % (branch, repo_path, e))
-@@ -1820,6 +1824,8 @@ class Commands(object):
- # This file was generated by {0} when cloning the repository.
- # You can edit it to your liking or delete completely. It will not
- # be recreated.
-+ # Creating this file can be also prevented by adding an option
-+ # "skip_hooks = True" into the {0}'s config file; [{0}] section.
-
- _remote="$1"
- _url="$2"
-diff --git a/pyrpkg/cli.py b/pyrpkg/cli.py
-index 3d8ce33..a1f3f44 100644
---- a/pyrpkg/cli.py
-+++ b/pyrpkg/cli.py
-@@ -2177,13 +2177,21 @@ class cliClient(object):
- self.log.warning("Repo name should't contain '.git' suffix. "
- "Correcting the repo name: '%s'" % repo)
-
-+ skip_hooks = None
-+ if self.config.has_option(self.name, "skip_hooks"):
-+ try:
-+ skip_hooks = self.config.getboolean(self.name, "skip_hooks")
-+ except ValueError:
-+ self.log.error("Error: config file option 'skip_hooks'")
-+ raise
- if self.args.branches:
- self.cmd.clone_with_dirs(self.args.repo[0],
- anon=self.args.anonymous,
- target=self.args.clone_target,
- depth=self.args.depth,
- extra_args=self.extra_args,
-- config_path=self.args.config)
-+ config_path=self.args.config,
-+ skip_hooks=skip_hooks)
- else:
- self.cmd.clone(self.args.repo[0],
- branch=self.args.branch,
-@@ -2191,7 +2199,8 @@ class cliClient(object):
- target=self.args.clone_target,
- depth=self.args.depth,
- extra_args=self.extra_args,
-- config_path=self.args.config)
-+ config_path=self.args.config,
-+ skip_hooks=skip_hooks)
-
- def commit(self):
- if self.args.with_changelog and not self.args.message:
---
-2.39.2
-
diff --git a/0019-Pre-push-hook-won-t-check-private-branches.patch b/0019-Pre-push-hook-won-t-check-private-branches.patch
deleted file mode 100644
index 37a7c52..0000000
--- a/0019-Pre-push-hook-won-t-check-private-branches.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From 4553da364d7d8a974ab0c08834ee0a54320da2cb Mon Sep 17 00:00:00 2001
-From: Ondrej Nosek <onosek@redhat.com>
-Date: Tue, 18 Apr 2023 16:06:43 +0200
-Subject: [PATCH 6/6] Pre-push hook won't check private branches
-
-The pre-push hook script was failing the when user tried to push
-a private branch. It required using the --release argument with
-the pre-push-check command and passing additional arguments into
-the hook script. That was found unreliable and private branches
-won't be checked.
-
-Fixes: #683
-JIRA: RHELCMP-11528
-
-Signed-off-by: Ondrej Nosek <onosek@redhat.com>
----
- pyrpkg/__init__.py | 12 +++++++++---
- 1 file changed, 9 insertions(+), 3 deletions(-)
-
-diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
-index 7fddff7..3f934d3 100644
---- a/pyrpkg/__init__.py
-+++ b/pyrpkg/__init__.py
-@@ -4489,9 +4489,15 @@ class Commands(object):
- specfile_path = os.path.relpath(specfile_path_absolute, start=self.path)
- cmd = ['spectool', '-l', os.path.join(clone_dir, specfile_path)]
- # extract just '--define' arguments from rpmdefines
-- for opt, val in zip(self.rpmdefines[0::2], self.rpmdefines[1::2]):
-- if opt == '--define':
-- cmd.extend((opt, val))
-+ try:
-+ for opt, val in zip(self.rpmdefines[0::2], self.rpmdefines[1::2]):
-+ if opt == '--define':
-+ cmd.extend((opt, val))
-+ except rpkgError:
-+ # this exception was caused probably by using a private branch
-+ self.log.warning('The pre-push script can\'t check private branches. '
-+ 'Push operation continues.')
-+ return
- ret, stdout, _ = self._run_command(cmd, cwd=clone_dir,
- return_text=True, return_stdout=True)
- if ret != 0:
---
-2.39.2
-
diff --git a/0020-Use-release-s-rpmdefines-in-unused-sources-check.patch b/0020-Use-release-s-rpmdefines-in-unused-sources-check.patch
deleted file mode 100644
index 6be7cee..0000000
--- a/0020-Use-release-s-rpmdefines-in-unused-sources-check.patch
+++ /dev/null
@@ -1,170 +0,0 @@
-From 8667d5379161183b306bdd4a6733c666cd2ef310 Mon Sep 17 00:00:00 2001
-From: Otto Liljalaakso <otto.liljalaakso@iki.fi>
-Date: Sun, 2 Apr 2023 17:21:00 +0300
-Subject: [PATCH 1/2] Use release's rpmdefines in unused sources check
-
-Conditional Source: tags are problematic and, in fact, forbidden in at
-least Fedora. However, there are packages that conditionalize packages
-based on macros such as %{rhel} or %{fedora}. 'x-pkg sources' did not
-handle such packages correctly, because when the specfile was parsed
-to check for unused sources, values for those macros were not set. This
-was different from other commands which set such macros based on the
-value of --release parameter or Git branch name.
-
-Improve support for conditional Source: tags by using the standard set
-of rpmdefines when the specfile is parsed in 'fedpkg sources'.
-
-Fixes: #671
-JIRA: RHELCMP-11465
-Merges: https://pagure.io/rpkg/pull-request/678
-
-Signed-off-by: Otto Liljalaakso <otto.liljalaakso@iki.fi>
----
- pyrpkg/__init__.py | 21 +++++++++++++++------
- pyrpkg/spec.py | 12 +++++++-----
- tests/test_cli.py | 21 ++++++++++++++++++++-
- tests/test_spec.py | 8 ++++++--
- 4 files changed, 48 insertions(+), 14 deletions(-)
-
-diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
-index 3f934d3..817ef33 100644
---- a/pyrpkg/__init__.py
-+++ b/pyrpkg/__init__.py
-@@ -2261,13 +2261,22 @@ class Commands(object):
- sourcesf = SourcesFile(self.sources_filename, self.source_entry_type)
-
- try:
-- specf = SpecFile(os.path.join(self.layout.specdir, self.spec),
-- self.layout.sourcedir)
-- spec_parsed = True
-- except Exception:
-- self.log.warning("Parsing specfile for used sources failed. "
-- "Falling back to downloading all sources.")
-+ # Try resolving rpmdefines separately. This produces a clear error
-+ # message in the common failure case of custom branch name.
-+ self.rpmdefines
-+ except Exception as err:
-+ self.log.warning("Parsing specfile for used sources failed: %s" % err)
-+ self.log.warning("Falling back to downloading all sources.")
- spec_parsed = False
-+ else:
-+ try:
-+ specf = SpecFile(os.path.join(self.layout.specdir, self.spec),
-+ self.rpmdefines)
-+ spec_parsed = True
-+ except Exception:
-+ self.log.warning("Parsing specfile for used sources failed. "
-+ "Falling back to downloading all sources.")
-+ spec_parsed = False
-
- args = dict()
- if self.lookaside_request_params:
-diff --git a/pyrpkg/spec.py b/pyrpkg/spec.py
-index d72f1fb..5400de3 100644
---- a/pyrpkg/spec.py
-+++ b/pyrpkg/spec.py
-@@ -18,16 +18,16 @@ class SpecFile(object):
- r'^((source[0-9]*|patch[0-9]*)\s*:\s*(?P<val>.*))\s*$',
- re.IGNORECASE)
-
-- def __init__(self, spec, sourcedir):
-+ def __init__(self, spec, rpmdefines):
- self.spec = spec
-- self.sourcedir = sourcedir
-+ self.rpmdefines = rpmdefines
- self.sources = []
-
- self.parse()
-
- def parse(self):
- """Call rpmspec and find source tags from the result."""
-- stdout = run(self.spec, self.sourcedir)
-+ stdout = run(self.spec, self.rpmdefines)
- for line in stdout.splitlines():
- m = self.sourcefile_expression.match(line)
- if not m:
-@@ -38,8 +38,10 @@ class SpecFile(object):
- self.sources.append(val)
-
-
--def run(spec, sourcedir):
-- cmdline = ['rpmspec', '--define', "_sourcedir %s" % sourcedir, '-P', spec]
-+def run(spec, rpmdefines):
-+ cmdline = ['rpmspec']
-+ cmdline.extend(rpmdefines)
-+ cmdline.extend(['-P', spec])
- try:
- process = subprocess.Popen(cmdline,
- stdout=subprocess.PIPE,
-diff --git a/tests/test_cli.py b/tests/test_cli.py
-index 02620ef..58df047 100644
---- a/tests/test_cli.py
-+++ b/tests/test_cli.py
-@@ -1607,6 +1607,25 @@ class TestSources(LookasideCacheMock, CliTestCase):
- def test_unused_sources_are_not_downloaded(self):
- self._upload_unused()
-
-+ cli_cmd = ['rpkg', '--path', self.cloned_repo_path, 'sources']
-+ with patch('sys.argv', new=cli_cmd):
-+ with patch('pyrpkg.Commands.rpmdefines',
-+ new=['--define', '_sourcedir %s' % self.cloned_repo_path]):
-+ cli = self.new_cli()
-+ with patch('pyrpkg.lookaside.CGILookasideCache.download',
-+ new=self.lookasidecache_download):
-+ cli.sources()
-+
-+ path = os.path.join(self.cloned_repo_path, 'unused.patch')
-+ self.assertFalse(os.path.exists(path))
-+
-+ @patch('pyrpkg.Commands.load_rpmdefines')
-+ def test_download_sources_including_unused(self, rpmdefines):
-+ self._upload_unused()
-+ # SpecFile parsing executes 'rpmspec', that needs '--define' arguments from rpmdefines
-+ # when rpmdefines raises eception, SpecFile parsing fails --> all sources are downloaded.
-+ rpmdefines.side_effect = rpkgError
-+
- cli_cmd = ['rpkg', '--path', self.cloned_repo_path, 'sources']
- with patch('sys.argv', new=cli_cmd):
- cli = self.new_cli()
-@@ -1615,7 +1634,7 @@ class TestSources(LookasideCacheMock, CliTestCase):
- cli.sources()
-
- path = os.path.join(self.cloned_repo_path, 'unused.patch')
-- self.assertFalse(os.path.exists(path))
-+ self.assertTrue(os.path.exists(path))
-
- def test_force_option_downloads_unused_sources(self):
- self._upload_unused()
-diff --git a/tests/test_spec.py b/tests/test_spec.py
-index eefc475..0c7907a 100644
---- a/tests/test_spec.py
-+++ b/tests/test_spec.py
-@@ -10,6 +10,10 @@ from pyrpkg.errors import rpkgError
- class SpecFileTestCase(unittest.TestCase):
- def setUp(self):
- self.workdir = tempfile.mkdtemp(prefix='rpkg-tests.')
-+ self.rpmdefines = ["--define", "_sourcedir %s" % self.workdir,
-+ "--define", "_specdir %s" % self.workdir,
-+ "--define", "_builddir %s" % self.workdir,
-+ "--eval", "%%undefine rhel"]
- self.specfile = os.path.join(self.workdir, self._testMethodName)
-
- # Write common header
-@@ -43,7 +47,7 @@ class SpecFileTestCase(unittest.TestCase):
- "PAtch999: https://remote.patch-sourcce.org/another-patch.bz2\n")
- spec_fd.close()
-
-- s = spec.SpecFile(self.specfile, self.workdir)
-+ s = spec.SpecFile(self.specfile, self.rpmdefines)
- actual = s.sources
- expected = [
- "tarball.tar.gz",
-@@ -65,4 +69,4 @@ class SpecFileTestCase(unittest.TestCase):
- self.assertRaises(rpkgError,
- spec.SpecFile,
- self.specfile,
-- self.workdir)
-+ self.rpmdefines)
---
-2.40.0
-
diff --git a/0021-Do-not-require-sources-file-for-all-namespaces.patch b/0021-Do-not-require-sources-file-for-all-namespaces.patch
deleted file mode 100644
index a4c71aa..0000000
--- a/0021-Do-not-require-sources-file-for-all-namespaces.patch
+++ /dev/null
@@ -1,60 +0,0 @@
-From 079a64dde258f45e26fe35de86b1a0915f4973cd Mon Sep 17 00:00:00 2001
-From: Ondrej Nosek <onosek@redhat.com>
-Date: Thu, 27 Apr 2023 23:05:48 +0200
-Subject: [PATCH 2/2] Do not require 'sources' file for all namespaces
-
-Requirement for 'sources' file for all layouts except the RetiredLayout
-(and thus all namespaces) was too restrictive and unexpected.
-Partially reverts the commit 1108810bdefd0d880517b274acd6a3bd0d4156e0.
-
-Fixes: #684
-JIRA: RHELCMP-11529
-
-Signed-off-by: Ondrej Nosek <onosek@redhat.com>
----
- pyrpkg/__init__.py | 2 --
- pyrpkg/cli.py | 1 -
- tests/test_cli.py | 2 +-
- 3 files changed, 1 insertion(+), 4 deletions(-)
-
-diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
-index 817ef33..11b8dae 100644
---- a/pyrpkg/__init__.py
-+++ b/pyrpkg/__init__.py
-@@ -1168,8 +1168,6 @@ class Commands(object):
-
- @property
- def sources_filename(self):
-- if self.layout is None or isinstance(self.layout, layout.IncompleteLayout):
-- raise rpkgError('Spec file is not available')
- if isinstance(self.layout, layout.RetiredLayout):
- raise rpkgError('This package or module is retired. The action has stopped.')
- return os.path.join(
-diff --git a/pyrpkg/cli.py b/pyrpkg/cli.py
-index a1f3f44..dc1eb4e 100644
---- a/pyrpkg/cli.py
-+++ b/pyrpkg/cli.py
-@@ -2375,7 +2375,6 @@ class cliClient(object):
-
- def import_srpm(self):
- uploadfiles = self.cmd.import_srpm(self.args.srpm)
-- self.load_cmd() # to reload layouts - because a specfile could appear during import
- if uploadfiles:
- try:
- self.cmd.upload(uploadfiles, replace=True, offline=self.args.offline)
-diff --git a/tests/test_cli.py b/tests/test_cli.py
-index 58df047..6e4ec6a 100644
---- a/tests/test_cli.py
-+++ b/tests/test_cli.py
-@@ -1610,7 +1610,7 @@ class TestSources(LookasideCacheMock, CliTestCase):
- cli_cmd = ['rpkg', '--path', self.cloned_repo_path, 'sources']
- with patch('sys.argv', new=cli_cmd):
- with patch('pyrpkg.Commands.rpmdefines',
-- new=['--define', '_sourcedir %s' % self.cloned_repo_path]):
-+ new=['--define', '_sourcedir %s' % self.cloned_repo_path]):
- cli = self.new_cli()
- with patch('pyrpkg.lookaside.CGILookasideCache.download',
- new=self.lookasidecache_download):
---
-2.40.0
-
diff --git a/0022-copr-build-passes-extra_args-to-copr-cli-command.patch b/0022-copr-build-passes-extra_args-to-copr-cli-command.patch
deleted file mode 100644
index 966f0ef..0000000
--- a/0022-copr-build-passes-extra_args-to-copr-cli-command.patch
+++ /dev/null
@@ -1,113 +0,0 @@
-From ad67fa9069befef3e4ba5180eea6bf56b658e664 Mon Sep 17 00:00:00 2001
-From: Ondrej Nosek <onosek@redhat.com>
-Date: Wed, 3 May 2023 00:41:34 +0200
-Subject: [PATCH 01/17] `copr-build` passes extra_args to copr-cli command
-
-The right target for passing extra_args (arguments that are placed
-after '--' on the command line) is the command copr-cli instead
-of rpmbuild command.
-
-Fixes: https://pagure.io/fedpkg/issue/510
-JIRA: RHELCMP-11429
-
-Signed-off-by: Ondrej Nosek <onosek@redhat.com>
----
- pyrpkg/__init__.py | 5 ++++-
- pyrpkg/cli.py | 11 ++++++++++-
- tests/test_cli.py | 24 ++++++++++++++++++++++++
- 3 files changed, 38 insertions(+), 2 deletions(-)
-
-diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
-index 11b8dae..f14b055 100644
---- a/pyrpkg/__init__.py
-+++ b/pyrpkg/__init__.py
-@@ -3576,13 +3576,16 @@ class Commands(object):
- else:
- self.log.info('Nothing to be done')
-
-- def copr_build(self, project, srpm_name, nowait, config_file):
-+ def copr_build(self, project, srpm_name, nowait, config_file, extra_args=None):
- cmd = ['copr-cli']
- if config_file:
- cmd.extend(['--config', config_file])
- cmd.append('build')
- if nowait:
- cmd.append('--nowait')
-+ if extra_args:
-+ cmd.extend(extra_args)
-+ self.log.debug("Extra args '{0}' are passed to copr-cli command".format(extra_args))
- cmd.extend([project, srpm_name])
- self._run_command(cmd)
-
-diff --git a/pyrpkg/cli.py b/pyrpkg/cli.py
-index dc1eb4e..020a247 100644
---- a/pyrpkg/cli.py
-+++ b/pyrpkg/cli.py
-@@ -1561,6 +1561,10 @@ class cliClient(object):
- help="Don't wait on build")
- copr_parser.add_argument(
- 'project', nargs=1, help='Name of the project in format USER/PROJECT')
-+ copr_parser.add_argument(
-+ "extra_args", default=None, nargs=argparse.REMAINDER,
-+ help="Custom arguments that are passed to the 'copr-cli'. "
-+ "Use '--' to separate them from other arguments.")
- copr_parser.set_defaults(command=self.copr_build)
-
- def register_switch_branch(self):
-@@ -2354,12 +2358,17 @@ class cliClient(object):
- def copr_build(self):
- self.log.debug('Generating an srpm')
- self.args.hash = None
-+ # do not pass 'extra_args' to 'rpmbuild' command in 'srpm' method; Pass it to copr-cli.
-+ extra_args_backup = self.extra_args
-+ self.extra_args = None
- self.srpm()
-+ self.extra_args = extra_args_backup
- srpm_name = '%s.src.rpm' % self.cmd.nvr
- self.cmd.copr_build(self.args.project[0],
- srpm_name,
- self.args.nowait,
-- self.args.copr_config)
-+ self.args.copr_config,
-+ extra_args=self.extra_args)
-
- def diff(self):
- self.cmd.diff(self.args.cached, self.args.files)
-diff --git a/tests/test_cli.py b/tests/test_cli.py
-index 6e4ec6a..f2e68df 100644
---- a/tests/test_cli.py
-+++ b/tests/test_cli.py
-@@ -636,6 +636,30 @@ class TestClone(CliTestCase):
- output = sys.stderr.getvalue().strip()
- self.assertEqual('', output)
-
-+ @patch('sys.stderr', new=StringIO())
-+ @patch('pyrpkg.Commands._clone_config', new_callable=Mock())
-+ @patch('pyrpkg.Commands._run_command')
-+ def test_extra_args_copr(self, _run_command, _clone_config):
-+ # copr-build is the command that has two subcommands (rpmbuild and copr-cli)
-+ # that might accept the extra args. This tests requies extra_args at copr-cli.
-+ cli_cmd = ['rpkg', '--user', 'dude', '--path', self.cloned_repo_path,
-+ '--release', 'rhel-6', 'copr-build', 'COPR-REPO',
-+ '--', '--after-build-id', 'ID']
-+
-+ with patch('sys.argv', new=cli_cmd):
-+ cli = self.new_cli()
-+ cli.copr_build()
-+
-+ expected_cmd = ['copr-cli', 'build', '--after-build-id', 'ID', 'COPR-REPO']
-+ self.assertEqual(2, _run_command.call_count)
-+ copr_cli_call = _run_command.mock_calls[1]
-+ if 'args' in dir(copr_cli_call): # doesn't work in <=py36
-+ # strip the last argument - it contains dynamically generated src.rpm filename
-+ self.assertEqual(expected_cmd, copr_cli_call.args[0][:-1])
-+
-+ output = sys.stderr.getvalue().strip()
-+ self.assertEqual('', output)
-+
- @patch('sys.stderr', new=StringIO())
- @patch('pyrpkg.Commands._clone_config', new_callable=Mock())
- @patch('pyrpkg.Commands._run_command')
---
-2.43.0
-
diff --git a/0023-commit-command-fails-on-containers-namespace.patch b/0023-commit-command-fails-on-containers-namespace.patch
deleted file mode 100644
index 21ae8e3..0000000
--- a/0023-commit-command-fails-on-containers-namespace.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-From 7ade8c1f38efaa8817bd10df6b0928ef70822f6e Mon Sep 17 00:00:00 2001
-From: Ondrej Nosek <onosek@redhat.com>
-Date: Wed, 17 May 2023 00:32:47 +0200
-Subject: [PATCH 02/17] `commit` command fails on 'containers' namespace
-
-Commit failed when 'uses_rpmautospec' tried to search for a specfile.
-There is no specfile in 'containers' namespace repository.
-
-JIRA: RHELCMP-11734
-
-Signed-off-by: Ondrej Nosek <onosek@redhat.com>
----
- pyrpkg/__init__.py | 11 +++++++++--
- 1 file changed, 9 insertions(+), 2 deletions(-)
-
-diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
-index f14b055..b45ad8f 100644
---- a/pyrpkg/__init__.py
-+++ b/pyrpkg/__init__.py
-@@ -1872,8 +1872,15 @@ class Commands(object):
- # construct the git command
- # We do this via subprocess because the git module is terrible.
- cmd = ['git', 'commit']
-- if not self.is_retired() and self.uses_rpmautospec:
-- cmd.append('--allow-empty')
-+ if not self.is_retired():
-+ try:
-+ # raises exception when a specfile is missing
-+ # (for example when processing "containers" namespace repository)
-+ uses_rpmautospec = self.uses_rpmautospec
-+ except Exception:
-+ uses_rpmautospec = False
-+ if uses_rpmautospec:
-+ cmd.append('--allow-empty')
- if signoff:
- cmd.append('-s')
- if self.quiet:
---
-2.43.0
-
diff --git a/0024-Split-git-credential-data-on-first-only.patch b/0024-Split-git-credential-data-on-first-only.patch
deleted file mode 100644
index 8f7ab6b..0000000
--- a/0024-Split-git-credential-data-on-first-only.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From 75d42bad79b54654fca9770a2857e79e82d83c3e Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= <lsedlar@redhat.com>
-Date: Wed, 21 Jun 2023 10:42:45 +0200
-Subject: [PATCH 03/17] Split git credential data on first = only
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-The value itself can contain a = character, but we don't really care
-about that. We can treat the value of the key as opaque.
-
-Fixes: https://pagure.io/rpkg/issue/694
-Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
----
- pyrpkg/cli.py | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/pyrpkg/cli.py b/pyrpkg/cli.py
-index 020a247..1bd7979 100644
---- a/pyrpkg/cli.py
-+++ b/pyrpkg/cli.py
-@@ -824,7 +824,7 @@ class cliClient(object):
- """Parses the git-credential-helper IO format input."""
- inp = {}
- for line in sys.stdin:
-- vals = line.split('=', 2)
-+ vals = line.split('=', 1)
- if len(vals) != 2:
- print('Invalid input: %s' % line, file=sys.stderr)
- return False
---
-2.43.0
-
diff --git a/0025-Support-for-checking-exploded-sources-before-push.patch b/0025-Support-for-checking-exploded-sources-before-push.patch
deleted file mode 100644
index cd1e34a..0000000
--- a/0025-Support-for-checking-exploded-sources-before-push.patch
+++ /dev/null
@@ -1,71 +0,0 @@
-From 87d4995b40fbcddac88fb21191eb2d5d1f248550 Mon Sep 17 00:00:00 2001
-From: Ondrej Nosek <onosek@redhat.com>
-Date: Tue, 11 Jul 2023 17:00:48 +0200
-Subject: [PATCH 04/17] Support for checking exploded sources before push
-
-pre-push-check now includes test whether source files listed
-in a specfile come from additional sources.
-This functionality is relevant only for some x-pkg tools, others
-should not be affected.
-
-JIRA: RHELCMP-11777
-
-Signed-off-by: Ondrej Nosek <onosek@redhat.com>
----
- pyrpkg/__init__.py | 12 ++++++++++--
- tests/commands/test_pre_push_check.py | 4 ++--
- 2 files changed, 12 insertions(+), 4 deletions(-)
-
-diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
-index b45ad8f..bc669b9 100644
---- a/pyrpkg/__init__.py
-+++ b/pyrpkg/__init__.py
-@@ -4468,6 +4468,10 @@ class Commands(object):
-
- return self._repo_name, version, release
-
-+ # Works as virtual method. Other x-pkg tools can add their specific sources
-+ def additional_source_entries(self):
-+ return {}
-+
- def pre_push_check(self, ref):
- show_hint = ('Hint: this check (.git/hooks/pre-push script) can be bypassed by adding '
- 'the argument \'--no-verify\' argument to the push command.')
-@@ -4561,13 +4565,17 @@ class Commands(object):
- # list of all files (their relative paths) in the commit
- repo_entries = set(item.path for item in commit.tree.traverse() if item.type != "tree")
-
-+ # other x-pkg tools can add their specific sources
-+ additional_entries = set(self.additional_source_entries())
-+
- # check whether every source file is either listed in the 'sources' file or tracked in git
- for source_file in source_files:
- listed = source_file in sourcesf_entries
- tracked = source_file in repo_entries
-- if not (listed or tracked):
-+ listed_additional = source_file in additional_entries
-+ if not (listed or tracked or listed_additional):
- self.log.error('Source file \'{0}\' was neither listed in the \'sources\' file '
-- 'nor tracked in git. '
-+ 'nor tracked in git nor listed in additional sources. '
- 'Push operation was cancelled'.format(source_file))
- self.log.warning(show_hint)
- sys.exit(4)
-diff --git a/tests/commands/test_pre_push_check.py b/tests/commands/test_pre_push_check.py
-index ee151c1..79165ec 100644
---- a/tests/commands/test_pre_push_check.py
-+++ b/tests/commands/test_pre_push_check.py
-@@ -90,8 +90,8 @@ Patch3: d.patch
-
- self.assertEqual(exc.exception.code, 4)
- log_error.assert_called_once_with("Source file 'b.patch' was neither listed in the "
-- "'sources' file nor tracked in git. Push operation "
-- "was cancelled")
-+ "'sources' file nor tracked in git nor listed "
-+ "in additional sources. Push operation was cancelled")
-
- # Verify added files are committed but not pushed to origin
- local_repo = git.Repo(self.cloned_dir)
---
-2.43.0
-
diff --git a/0026-Fix-flake8-complaints.patch b/0026-Fix-flake8-complaints.patch
deleted file mode 100644
index 4955a49..0000000
--- a/0026-Fix-flake8-complaints.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-From 5c915a549ad2d10a3eb36c56801574d81a601670 Mon Sep 17 00:00:00 2001
-From: Ondrej Nosek <onosek@redhat.com>
-Date: Tue, 1 Aug 2023 23:26:43 +0200
-Subject: [PATCH 05/17] Fix flake8 complaints
-
-E721 do not compare types, for exact checks use `is` / `is not`, for
-instance checks use `isinstance()`
-Conditions in the method `_list_branches` were switched because:
-`issubclass(git.RemoteReference, git.Head)`
-
-Signed-off-by: Ondrej Nosek <onosek@redhat.com>
----
- pyrpkg/__init__.py | 8 ++++----
- 1 file changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
-index bc669b9..f69f2ce 100644
---- a/pyrpkg/__init__.py
-+++ b/pyrpkg/__init__.py
-@@ -1411,15 +1411,15 @@ class Commands(object):
- remotes = []
- locals = []
- for ref in refs:
-- if type(ref) == git.Head:
-- self.log.debug('Found local branch %s', ref.name)
-- locals.append(ref.name)
-- elif type(ref) == git.RemoteReference:
-+ if isinstance(ref, git.RemoteReference):
- if ref.remote_head == 'HEAD':
- self.log.debug('Skipping remote branch alias HEAD')
- continue # Not useful in this context
- self.log.debug('Found remote branch %s', ref.name)
- remotes.append(ref.name)
-+ elif isinstance(ref, git.Head):
-+ self.log.debug('Found local branch %s', ref.name)
-+ locals.append(ref.name)
- return (locals, remotes)
-
- def _srpmdetails(self, srpm):
---
-2.43.0
-
diff --git a/0027-Prepare-the-lookaside-cache-code-for-retries.patch b/0027-Prepare-the-lookaside-cache-code-for-retries.patch
deleted file mode 100644
index 48a5962..0000000
--- a/0027-Prepare-the-lookaside-cache-code-for-retries.patch
+++ /dev/null
@@ -1,148 +0,0 @@
-From 1a0601d29794cec1f735a10208364d11958c41ec Mon Sep 17 00:00:00 2001
-From: Ondrej Nosek <onosek@redhat.com>
-Date: Wed, 26 Jul 2023 01:30:12 +0200
-Subject: [PATCH 06/17] Prepare the lookaside cache code for retries
-
-These changes should not have an impact on the original functionality.
-
-JIRA: RHELCMP-11210
-
-Signed-off-by: Ondrej Nosek <onosek@redhat.com>
----
- pyrpkg/lookaside.py | 96 ++++++++++++++++++++++-----------------------
- 1 file changed, 48 insertions(+), 48 deletions(-)
-
-diff --git a/pyrpkg/lookaside.py b/pyrpkg/lookaside.py
-index 3efcd88..f94ffdb 100644
---- a/pyrpkg/lookaside.py
-+++ b/pyrpkg/lookaside.py
-@@ -163,17 +163,17 @@ class CGILookasideCache(object):
- url = url.encode('utf-8')
- self.log.debug("Full url: %s", url)
-
-+ c = pycurl.Curl()
-+ c.setopt(pycurl.URL, url)
-+ c.setopt(pycurl.HTTPHEADER, ['Pragma:'])
-+ c.setopt(pycurl.NOPROGRESS, False)
-+ c.setopt(pycurl.PROGRESSFUNCTION, self.print_progress)
-+ c.setopt(pycurl.OPT_FILETIME, True)
-+ c.setopt(pycurl.LOW_SPEED_LIMIT, 1000)
-+ c.setopt(pycurl.LOW_SPEED_TIME, 300)
-+ c.setopt(pycurl.FOLLOWLOCATION, 1)
- with open(outfile, 'wb') as f:
-- c = pycurl.Curl()
-- c.setopt(pycurl.URL, url)
-- c.setopt(pycurl.HTTPHEADER, ['Pragma:'])
-- c.setopt(pycurl.NOPROGRESS, False)
-- c.setopt(pycurl.PROGRESSFUNCTION, self.print_progress)
-- c.setopt(pycurl.OPT_FILETIME, True)
- c.setopt(pycurl.WRITEDATA, f)
-- c.setopt(pycurl.LOW_SPEED_LIMIT, 1000)
-- c.setopt(pycurl.LOW_SPEED_TIME, 300)
-- c.setopt(pycurl.FOLLOWLOCATION, 1)
- try:
- c.perform()
- tstamp = c.getinfo(pycurl.INFO_FILETIME)
-@@ -254,29 +254,29 @@ class CGILookasideCache(object):
- ('%ssum' % self.hashtype, hash),
- ('filename', filename)]
-
-- with io.BytesIO() as buf:
-- c = pycurl.Curl()
-- c.setopt(pycurl.URL, self.upload_url)
-- c.setopt(pycurl.WRITEFUNCTION, buf.write)
-- c.setopt(pycurl.HTTPPOST, post_data)
-- c.setopt(pycurl.FOLLOWLOCATION, 1)
-+ c = pycurl.Curl()
-+ c.setopt(pycurl.URL, self.upload_url)
-+ c.setopt(pycurl.HTTPPOST, post_data)
-+ c.setopt(pycurl.FOLLOWLOCATION, 1)
-
-- if self.client_cert is not None:
-- if os.path.exists(self.client_cert):
-- c.setopt(pycurl.SSLCERT, self.client_cert)
-- else:
-- self.log.warning("Missing certificate: %s"
-- % self.client_cert)
-+ if self.client_cert is not None:
-+ if os.path.exists(self.client_cert):
-+ c.setopt(pycurl.SSLCERT, self.client_cert)
-+ else:
-+ self.log.warning("Missing certificate: %s"
-+ % self.client_cert)
-
-- if self.ca_cert is not None:
-- if os.path.exists(self.ca_cert):
-- c.setopt(pycurl.CAINFO, self.ca_cert)
-- else:
-- self.log.warning("Missing certificate: %s", self.ca_cert)
-+ if self.ca_cert is not None:
-+ if os.path.exists(self.ca_cert):
-+ c.setopt(pycurl.CAINFO, self.ca_cert)
-+ else:
-+ self.log.warning("Missing certificate: %s", self.ca_cert)
-
-- c.setopt(pycurl.HTTPAUTH, pycurl.HTTPAUTH_GSSNEGOTIATE)
-- c.setopt(pycurl.USERPWD, ':')
-+ c.setopt(pycurl.HTTPAUTH, pycurl.HTTPAUTH_GSSNEGOTIATE)
-+ c.setopt(pycurl.USERPWD, ':')
-
-+ with io.BytesIO() as buf:
-+ c.setopt(pycurl.WRITEFUNCTION, buf.write)
- try:
- c.perform()
- status = c.getinfo(pycurl.RESPONSE_CODE)
-@@ -341,30 +341,30 @@ class CGILookasideCache(object):
- ('mtime', str(int(os.stat(filepath).st_mtime))),
- ]
-
-- with io.BytesIO() as buf:
-- c = pycurl.Curl()
-- c.setopt(pycurl.URL, self.upload_url)
-- c.setopt(pycurl.NOPROGRESS, False)
-- c.setopt(pycurl.PROGRESSFUNCTION, self.print_progress)
-- c.setopt(pycurl.WRITEFUNCTION, buf.write)
-- c.setopt(pycurl.HTTPPOST, post_data)
-- c.setopt(pycurl.FOLLOWLOCATION, 1)
-+ c = pycurl.Curl()
-+ c.setopt(pycurl.URL, self.upload_url)
-+ c.setopt(pycurl.NOPROGRESS, False)
-+ c.setopt(pycurl.PROGRESSFUNCTION, self.print_progress)
-+ c.setopt(pycurl.HTTPPOST, post_data)
-+ c.setopt(pycurl.FOLLOWLOCATION, 1)
-
-- if self.client_cert is not None:
-- if os.path.exists(self.client_cert):
-- c.setopt(pycurl.SSLCERT, self.client_cert)
-- else:
-- self.log.warning("Missing certificate: %s", self.client_cert)
-+ if self.client_cert is not None:
-+ if os.path.exists(self.client_cert):
-+ c.setopt(pycurl.SSLCERT, self.client_cert)
-+ else:
-+ self.log.warning("Missing certificate: %s", self.client_cert)
-
-- if self.ca_cert is not None:
-- if os.path.exists(self.ca_cert):
-- c.setopt(pycurl.CAINFO, self.ca_cert)
-- else:
-- self.log.warning("Missing certificate: %s", self.ca_cert)
-+ if self.ca_cert is not None:
-+ if os.path.exists(self.ca_cert):
-+ c.setopt(pycurl.CAINFO, self.ca_cert)
-+ else:
-+ self.log.warning("Missing certificate: %s", self.ca_cert)
-
-- c.setopt(pycurl.HTTPAUTH, pycurl.HTTPAUTH_GSSNEGOTIATE)
-- c.setopt(pycurl.USERPWD, ':')
-+ c.setopt(pycurl.HTTPAUTH, pycurl.HTTPAUTH_GSSNEGOTIATE)
-+ c.setopt(pycurl.USERPWD, ':')
-
-+ with io.BytesIO() as buf:
-+ c.setopt(pycurl.WRITEFUNCTION, buf.write)
- try:
- c.perform()
- status = c.getinfo(pycurl.RESPONSE_CODE)
---
-2.43.0
-
diff --git a/0028-Lookaside-cache-operations-retries.patch b/0028-Lookaside-cache-operations-retries.patch
deleted file mode 100644
index 82c98cd..0000000
--- a/0028-Lookaside-cache-operations-retries.patch
+++ /dev/null
@@ -1,278 +0,0 @@
-From 3a96293d2479a75348f424806028c9b640aff31c Mon Sep 17 00:00:00 2001
-From: Ondrej Nosek <onosek@redhat.com>
-Date: Tue, 22 Aug 2023 14:48:02 +0200
-Subject: [PATCH 07/17] Lookaside cache operations retries
-
-Both upload and download network operations might fail
-and in this case, a retry mechanism was implemented.
-In case of failure, there is a delay and another attempt(s).
-Delays are increasing with every attempt.
-
-JIRA: RHELCMP-11210
-
-Signed-off-by: Ondrej Nosek <onosek@redhat.com>
----
- pyrpkg/lookaside.py | 129 ++++++++++++++++++++++++++--------------
- tests/test_lookaside.py | 12 ++--
- 2 files changed, 89 insertions(+), 52 deletions(-)
-
-diff --git a/pyrpkg/lookaside.py b/pyrpkg/lookaside.py
-index f94ffdb..01eee4a 100644
---- a/pyrpkg/lookaside.py
-+++ b/pyrpkg/lookaside.py
-@@ -14,11 +14,13 @@ way it is done by Fedora, RHEL, and other distributions maintainers.
- """
-
-
-+import functools
- import hashlib
- import io
- import logging
- import os
- import sys
-+import time
-
- import pycurl
- import six
-@@ -31,7 +33,7 @@ from .errors import (AlreadyUploadedError, DownloadError, InvalidHashType,
- class CGILookasideCache(object):
- """A class to interact with a CGI-based lookaside cache"""
- def __init__(self, hashtype, download_url, upload_url,
-- client_cert=None, ca_cert=None):
-+ client_cert=None, ca_cert=None, attempts=None, delay=None):
- """Constructor
-
- :param str hashtype: The hash algorithm to use for uploads. (e.g 'md5')
-@@ -45,12 +47,18 @@ class CGILookasideCache(object):
- use for HTTPS connexions. (e.g if the server certificate is
- self-signed. It defaults to None, in which case the system CA
- bundle is used.
-+ :param int attempts: repeat network operations after failure. The param
-+ says how many tries to do. None = single attempt / no-retrying
-+ :param int delay: Initial delay between network operation attempts.
-+ Each attempt doubles the previous delay value. In seconds.
- """
- self.hashtype = hashtype
- self.download_url = download_url
- self.upload_url = upload_url
- self.client_cert = client_cert
- self.ca_cert = ca_cert
-+ self.attempts = attempts if attempts is not None and attempts > 1 else 1
-+ self.delay_between_attempts = delay if delay is not None and delay >= 0 else 15
-
- self.log = logging.getLogger(__name__)
-
-@@ -170,20 +178,13 @@ class CGILookasideCache(object):
- c.setopt(pycurl.PROGRESSFUNCTION, self.print_progress)
- c.setopt(pycurl.OPT_FILETIME, True)
- c.setopt(pycurl.LOW_SPEED_LIMIT, 1000)
-- c.setopt(pycurl.LOW_SPEED_TIME, 300)
-+ c.setopt(pycurl.LOW_SPEED_TIME, 60)
- c.setopt(pycurl.FOLLOWLOCATION, 1)
-- with open(outfile, 'wb') as f:
-- c.setopt(pycurl.WRITEDATA, f)
-- try:
-- c.perform()
-- tstamp = c.getinfo(pycurl.INFO_FILETIME)
-- status = c.getinfo(pycurl.RESPONSE_CODE)
--
-- except Exception as e:
-- raise DownloadError(e)
-
-- finally:
-- c.close()
-+ # call retry method directly instead of @retry decorator - this approach allows passing
-+ # object's internal variables into the retry method
-+ status, tstamp = self.retry(raises=DownloadError)(self.retry_download)(c, outfile)
-+ c.close()
-
- # Get back a new line, after displaying the download progress
- if sys.stdout.isatty():
-@@ -220,13 +221,8 @@ class CGILookasideCache(object):
- c.setopt(pycurl.NOBODY, True)
- c.setopt(pycurl.FOLLOWLOCATION, 1)
-
-- try:
-- c.perform()
-- status = c.getinfo(pycurl.RESPONSE_CODE)
-- except Exception as e:
-- raise DownloadError(e)
-- finally:
-- c.close()
-+ status = self.retry(raises=DownloadError)(self.retry_remote_file_exists_head)(c)
-+ c.close()
-
- if status != 200:
- self.log.debug('Unavailable file \'%s\' at %s' % (filename, url))
-@@ -275,19 +271,8 @@ class CGILookasideCache(object):
- c.setopt(pycurl.HTTPAUTH, pycurl.HTTPAUTH_GSSNEGOTIATE)
- c.setopt(pycurl.USERPWD, ':')
-
-- with io.BytesIO() as buf:
-- c.setopt(pycurl.WRITEFUNCTION, buf.write)
-- try:
-- c.perform()
-- status = c.getinfo(pycurl.RESPONSE_CODE)
--
-- except Exception as e:
-- raise UploadError(e)
--
-- finally:
-- c.close()
--
-- output = buf.getvalue().strip()
-+ status, output = self.retry(raises=UploadError)(self.retry_remote_file_exists)(c)
-+ c.close()
-
- if status != 200:
- self.raise_upload_error(status)
-@@ -363,19 +348,8 @@ class CGILookasideCache(object):
- c.setopt(pycurl.HTTPAUTH, pycurl.HTTPAUTH_GSSNEGOTIATE)
- c.setopt(pycurl.USERPWD, ':')
-
-- with io.BytesIO() as buf:
-- c.setopt(pycurl.WRITEFUNCTION, buf.write)
-- try:
-- c.perform()
-- status = c.getinfo(pycurl.RESPONSE_CODE)
--
-- except Exception as e:
-- raise UploadError(e)
--
-- finally:
-- c.close()
--
-- output = buf.getvalue().strip()
-+ status, output = self.retry(raises=UploadError)(self.retry_upload)(c)
-+ c.close()
-
- # Get back a new line, after displaying the download progress
- if sys.stdout.isatty():
-@@ -387,3 +361,66 @@ class CGILookasideCache(object):
-
- if output:
- self.log.debug(output)
-+
-+ def retry_download(self, curl, outfile):
-+ with open(outfile, 'wb') as f:
-+ curl.setopt(pycurl.WRITEDATA, f)
-+ curl.perform()
-+ tstamp = curl.getinfo(pycurl.INFO_FILETIME)
-+ status = curl.getinfo(pycurl.RESPONSE_CODE)
-+ return status, tstamp
-+
-+ def retry_remote_file_exists_head(self, curl):
-+ curl.perform()
-+ status = curl.getinfo(pycurl.RESPONSE_CODE)
-+ return status
-+
-+ def retry_remote_file_exists(self, curl):
-+ with io.BytesIO() as buf:
-+ curl.setopt(pycurl.WRITEFUNCTION, buf.write)
-+ curl.perform()
-+ status = curl.getinfo(pycurl.RESPONSE_CODE)
-+ output = buf.getvalue().strip()
-+ return status, output
-+
-+ def retry_upload(self, curl):
-+ with io.BytesIO() as buf:
-+ curl.setopt(pycurl.WRITEFUNCTION, buf.write)
-+ curl.perform()
-+ status = curl.getinfo(pycurl.RESPONSE_CODE)
-+ output = buf.getvalue().strip()
-+ return status, output
-+
-+ def retry(self, attempts=None, delay_between_attempts=None, wait_on=pycurl.error, raises=None):
-+ """A decorator that allows to retry a section of code until success or counter elapses
-+ """
-+
-+ def wrapper(function):
-+ @functools.wraps(function)
-+ def inner(*args, **kwargs):
-+
-+ attempts_all = attempts or self.attempts
-+ attempts_left = attempts_all
-+ delay = delay_between_attempts or self.delay_between_attempts
-+ while attempts_left > 0:
-+ try:
-+ return function(*args, **kwargs)
-+ except wait_on as e:
-+ self.log.warn("Network error: %s" % (e))
-+ attempts_left -= 1
-+ self.log.debug("Attempt %d/%d has failed."
-+ % (attempts_all - attempts_left, attempts_all))
-+ if attempts_left:
-+ self.log.info("The operation will be retried in %ds." % (delay))
-+ time.sleep(delay)
-+ delay *= 2
-+ self.log.info("Retrying ...")
-+ else:
-+ if raises is None:
-+ raise # This re-raises the last exception.
-+ else:
-+ raise raises(e)
-+
-+ return inner
-+
-+ return wrapper
-diff --git a/tests/test_lookaside.py b/tests/test_lookaside.py
-index 35d3499..2fe1bdb 100644
---- a/tests/test_lookaside.py
-+++ b/tests/test_lookaside.py
-@@ -175,7 +175,7 @@ class CGILookasideCacheTestCase(unittest.TestCase):
- return 200 if info == pycurl.RESPONSE_CODE else 0
-
- def mock_perform():
-- with open(self.filename) as f:
-+ with open(self.filename, "rb") as f:
- curlopts[pycurl.WRITEDATA].write(f.read())
-
- def mock_setopt(opt, value):
-@@ -200,7 +200,7 @@ class CGILookasideCacheTestCase(unittest.TestCase):
- @mock.patch('pyrpkg.lookaside.pycurl.Curl')
- def test_download_failed(self, mock_curl):
- curl = mock_curl.return_value
-- curl.perform.side_effect = Exception(
-+ curl.perform.side_effect = pycurl.error(
- 'Could not resolve host: example.com')
-
- with open(self.filename, 'wb') as f:
-@@ -219,7 +219,7 @@ class CGILookasideCacheTestCase(unittest.TestCase):
- return 500 if info == pycurl.RESPONSE_CODE else 0
-
- def mock_perform():
-- with open(self.filename) as f:
-+ with open(self.filename, "rb") as f:
- curlopts[pycurl.WRITEDATA].write(f.read())
-
- def mock_setopt(opt, value):
-@@ -424,7 +424,7 @@ class CGILookasideCacheTestCase(unittest.TestCase):
- @mock.patch('pyrpkg.lookaside.pycurl.Curl')
- def test_remote_file_exists_check_failed(self, mock_curl):
- curl = mock_curl.return_value
-- curl.perform.side_effect = Exception(
-+ curl.perform.side_effect = pycurl.error(
- 'Could not resolve host: example.com')
-
- lc = CGILookasideCache('_', '_', '_')
-@@ -452,7 +452,7 @@ class CGILookasideCacheTestCase(unittest.TestCase):
- @mock.patch('pyrpkg.lookaside.pycurl.Curl')
- def test_remote_file_exists_check_unexpected_error(self, mock_curl):
- def mock_perform():
-- curlopts[pycurl.WRITEFUNCTION]('Something unexpected')
-+ curlopts[pycurl.WRITEFUNCTION](b'Something unexpected')
-
- def mock_setopt(opt, value):
- curlopts[opt] = value
-@@ -590,7 +590,7 @@ class CGILookasideCacheTestCase(unittest.TestCase):
- @mock.patch('pyrpkg.lookaside.pycurl.Curl')
- def test_upload_failed(self, mock_curl):
- curl = mock_curl.return_value
-- curl.perform.side_effect = Exception(
-+ curl.perform.side_effect = pycurl.error(
- 'Could not resolve host: example.com')
-
- lc = CGILookasideCache('_', '_', '_')
---
-2.43.0
-
diff --git a/0029-Make-lookaside-cache-retries-configurable.patch b/0029-Make-lookaside-cache-retries-configurable.patch
deleted file mode 100644
index 61fc41c..0000000
--- a/0029-Make-lookaside-cache-retries-configurable.patch
+++ /dev/null
@@ -1,108 +0,0 @@
-From 08cebe5fae426c11b51e645754b87e4ec5737ef3 Mon Sep 17 00:00:00 2001
-From: Ondrej Nosek <onosek@redhat.com>
-Date: Tue, 22 Aug 2023 22:22:03 +0200
-Subject: [PATCH 08/17] Make lookaside cache retries configurable
-
-The number of attempts for lookaside cache network operations is now
-configurable - there are new keys 'lookaside_attempts'
-and 'lookaside_delay' in the configuration.
-The Former expresses a maximum number of attempts to try the operation.
-'0' or '1' is for a single try (no-retry).
-The latter means an initial delay between network operation attempts.
-Each attempt doubles the previous delay value. In seconds.
-
-JIRA: RHELCMP-11210
-
-Signed-off-by: Ondrej Nosek <onosek@redhat.com>
----
- pyrpkg/__init__.py | 10 ++++++++--
- pyrpkg/cli.py | 34 +++++++++++++++++++++++++++++++++-
- 2 files changed, 41 insertions(+), 3 deletions(-)
-
-diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
-index f69f2ce..5928d47 100644
---- a/pyrpkg/__init__.py
-+++ b/pyrpkg/__init__.py
-@@ -110,7 +110,8 @@ class Commands(object):
- build_client, user=None,
- dist=None, target=None, quiet=False,
- distgit_namespaced=False, realms=None, lookaside_namespaced=False,
-- git_excludes=None, results_dir='root', allow_pre_generated_srpm=False):
-+ git_excludes=None, results_dir='root', allow_pre_generated_srpm=False,
-+ lookaside_attempts=None, lookaside_delay=None):
- """Init the object and some configuration details."""
-
- # Path to operate on, most often pwd
-@@ -242,6 +243,10 @@ class Commands(object):
- # A Configuration value used in 'import_srpm' command (comes from the Copr team)
- # If pre-generated srpms are allowed, don't care specfile is processed by rpmautospec
- self.allow_pre_generated_srpm = allow_pre_generated_srpm
-+ # number of attempts for lookaside network operations
-+ self.lookaside_attempts = lookaside_attempts
-+ # initial delay between network operation attempts. In seconds.
-+ self.lookaside_delay = lookaside_delay
-
- # Define properties here
- # Properties allow us to "lazy load" various attributes, which also means
-@@ -262,7 +267,8 @@ class Commands(object):
- """
- return CGILookasideCache(
- self.lookasidehash, self.lookaside, self.lookaside_cgi,
-- client_cert=self.cert_file, ca_cert=self.ca_cert)
-+ client_cert=self.cert_file, ca_cert=self.ca_cert,
-+ attempts=self.lookaside_attempts, delay=self.lookaside_delay)
-
- @property
- def path(self):
-diff --git a/pyrpkg/cli.py b/pyrpkg/cli.py
-index 1bd7979..16298f0 100644
---- a/pyrpkg/cli.py
-+++ b/pyrpkg/cli.py
-@@ -261,7 +261,9 @@ class cliClient(object):
- realms=realms,
- lookaside_namespaced=la_namespaced,
- git_excludes=git_excludes,
-- results_dir=results_dir
-+ results_dir=results_dir,
-+ lookaside_attempts=self.lookaside_attempts,
-+ lookaside_delay=self.lookaside_delay
- )
-
- if self.args.repo_name:
-@@ -3087,3 +3089,33 @@ class cliClient(object):
-
- def pre_push_check(self):
- self.cmd.pre_push_check(self.args.ref)
-+
-+ @property
-+ def lookaside_attempts(self):
-+ """loads parameter 'lookaside_attempts' from the config file
-+ """
-+ val = None
-+ if self.config.has_option(self.name, 'lookaside_attempts'):
-+ val = self.config.get(self.name, 'lookaside_attempts')
-+ try:
-+ val = int(val)
-+ except Exception:
-+ self.log.error("Error: The config value 'lookaside_attempts' "
-+ "should be an integer.")
-+ val = None
-+ return val
-+
-+ @property
-+ def lookaside_delay(self):
-+ """loads parameter 'lookaside_delay' from the config file
-+ """
-+ val = None
-+ if self.config.has_option(self.name, 'lookaside_delay'):
-+ val = self.config.get(self.name, 'lookaside_delay')
-+ try:
-+ val = int(val)
-+ except Exception:
-+ self.log.error("Error: The config value 'lookaside_delay' "
-+ "should be an integer.")
-+ val = None
-+ return val
---
-2.43.0
-
diff --git a/0030-pkg-import-Don-t-delete-changelog-generated-by-rpmau.patch b/0030-pkg-import-Don-t-delete-changelog-generated-by-rpmau.patch
deleted file mode 100644
index f3bd9be..0000000
--- a/0030-pkg-import-Don-t-delete-changelog-generated-by-rpmau.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 2fdb7806aa947d4997aea6cb33f3e893a2b7d876 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
-Date: Thu, 5 Oct 2023 17:03:39 +0200
-Subject: [PATCH 09/17] *pkg import: Don't delete changelog generated by
- `rpmautospec convert`
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Signed-off-by: Miro Hrončok <miro@hroncok.cz>
----
- pyrpkg/__init__.py | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
-index 5928d47..b257fec 100644
---- a/pyrpkg/__init__.py
-+++ b/pyrpkg/__init__.py
-@@ -2040,7 +2040,7 @@ class Commands(object):
- # not be removed by import command.
- reserved_ourfiles = [
- 'README.md', 'gating.yaml', 'tests/*', '*.rpmlintrc',
-- '.fmf/*', '*.fmf']
-+ '.fmf/*', '*.fmf', 'changelog']
-
- # Get a list of files we're currently tracking
- ourfiles = self.repo.git.ls_files().split('\n')
---
-2.43.0
-
diff --git a/0031-pkg-import-Undo-rpmautospec-processing.patch b/0031-pkg-import-Undo-rpmautospec-processing.patch
deleted file mode 100644
index 2d1f9e4..0000000
--- a/0031-pkg-import-Undo-rpmautospec-processing.patch
+++ /dev/null
@@ -1,162 +0,0 @@
-From ebb5c4b82caec5160544fdbb2d539fd1b5a3abfb Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
-Date: Thu, 5 Oct 2023 16:59:22 +0200
-Subject: [PATCH 10/17] *pkg import: Undo rpmautospec processing
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Fixes https://pagure.io/fedpkg/issue/527
-
-Depends-on: https://pagure.io/fedora-infra/rpmautospec/pull-request/312
-
-Signed-off-by: Miro Hrončok <miro@hroncok.cz>
----
- pyrpkg/__init__.py | 22 ++++++-------
- pyrpkg/utils.py | 77 ++++++++++++++++++++++++++++++++++++++++------
- 2 files changed, 78 insertions(+), 21 deletions(-)
-
-diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
-index b257fec..f562e71 100644
---- a/pyrpkg/__init__.py
-+++ b/pyrpkg/__init__.py
-@@ -53,7 +53,7 @@ from pyrpkg.sources import SourcesFile
- from pyrpkg.spec import SpecFile
- from pyrpkg.utils import (cached_property, extract_srpm, find_me,
- is_file_tracked, is_lookaside_eligible_file,
-- log_result, spec_file_processed_by_rpmautospec)
-+ log_result, spec_file_undo_rpmautospec)
-
- from .gitignore import GitIgnore
-
-@@ -1473,16 +1473,6 @@ class Commands(object):
- uploadfiles.append(file)
- else:
- files.append(file)
--
-- # Check all specfiles in SRPM. At this point (the 'import' command can run under
-- # the dist-git repo without any specfiles - right after initialization) we are
-- # not able determine which the main specfile is.
-- if file.endswith('.spec') and not file.startswith('.') \
-- and not self.allow_pre_generated_srpm \
-- and spec_file_processed_by_rpmautospec(file, target_dir):
-- raise rpkgError('SRPM was processed by rpmautospec '
-- '(specfile "{}" was analyzed)'.format(file))
--
- finally:
- shutil.rmtree(target_dir)
-
-@@ -2081,6 +2071,16 @@ class Commands(object):
- os.chdir(oldpath)
- raise rpkgError("Got an error from rpm2cpio: %s" % err)
-
-+ # Undo rpmautospec from all the spec files.
-+ # At this point (the 'import' command can run under the dist-git repo
-+ # without any specfiles - right after initialization) we are
-+ # not able determine which the main specfile is.
-+ if not self.allow_pre_generated_srpm:
-+ for file in files:
-+ if file.endswith('.spec') and not file.startswith('.'):
-+ if spec_file_undo_rpmautospec(file):
-+ self.log.debug("rpmautospec processing removed from {0}".format(file))
-+
- # And finally add all the files we know about (and our stock files)
- for file in ('.gitignore', 'sources'):
- if not os.path.exists(file):
-diff --git a/pyrpkg/utils.py b/pyrpkg/utils.py
-index 3337bdb..f3c8b25 100644
---- a/pyrpkg/utils.py
-+++ b/pyrpkg/utils.py
-@@ -336,22 +336,79 @@ def is_lookaside_eligible_file(file_name, dir_path=None):
- return encoding == "binary"
-
-
--def spec_file_processed_by_rpmautospec(file_name, dir_path=None):
-+def _replace_lines(lines, startline, endline, replacement_lines=None, strip_endline=False):
-+ replacement_lines = replacement_lines or []
-+ try:
-+ start = lines.index(startline)
-+ end = lines.index(endline, start)
-+ except ValueError:
-+ # if both are missing, nothing to do, all good
-+ # if only one of them is present, we better not touch it
-+ return lines, False
-+ else:
-+ # rpmautospec adds an empty line after the end
-+ # we want to remove it, but only if it is actually empty
-+ if strip_endline and lines[end+1] == "\n":
-+ end += 1
-+ lines = lines[:start] + replacement_lines + lines[end+1:]
-+ return lines, True
-+
-+
-+def spec_file_undo_rpmautospec(file_name, dir_path=None):
-+ """
-+ Given a path to specfile, undo changes generated by rpmautospec.
-+ Iff there is something to undo, the specfile will be overwritten.
-+
-+ Namely:
-+
-+ 1. Removes everything between the following lines:
-+ ## START: Set by rpmautospec
-+ ## END: Set by rpmautospec
-+ 2. Replaces everything between the following lines with %autochangelog:
-+ ## START: Generated by rpmautospec
-+ ## END: Generated by rpmautospec
-+
-+ Both of the steps only happen once. If the specfile contains multiple such sections,
-+ only the first one is removed/replaced.
-+
-+ The saved spec file is not guaranteed to be bit-by-bit identical with the original
-+ spec file used as an input to rpmautospec.
-+ However, subsequent repeated conversions there and back should be quite stable.
-+
-+ The return value says whether the specfile was overwritten.
-+ """
- file_path = os.path.join(dir_path or "", file_name)
-
- try:
-- contents = open(file_path).readlines()
-+ with open(file_path) as f:
-+ contents = f.readlines()
- except Exception:
-- # if we can't read it, let's assume the answer is "no".
-+ # if we can't read it, let's do nothing
- return False
-
-- # Check for the %autorelease header prepended to the file
-- if any('START: Set by rpmautospec' in line for line in contents[:10]):
-+ # remove the generated macro section near the beginning of the specfile
-+ contents, was_removed = _replace_lines(
-+ contents,
-+ '## START: Set by rpmautospec\n',
-+ '## END: Set by rpmautospec\n',
-+ strip_endline=True)
-+
-+ # replace the generated changelog with %autochangelog
-+ # note that this does not generally produce content identical to the original
-+ # e.g. the macro could have been conditionalized or in curly brackets
-+ # most importantly, the %changelog section might have been omitted entirely
-+ # however, this should be Good Enough for most of us
-+ contents, was_replaced = _replace_lines(
-+ contents,
-+ '## START: Generated by rpmautospec\n',
-+ '## END: Generated by rpmautospec\n',
-+ ['%autochangelog\n'])
-+
-+ # finally, replace the spec if needed
-+ # if we cannot write it, better blow up
-+ if was_removed or was_replaced:
-+ with open(file_path, 'w') as f:
-+ f.writelines(contents)
- return True
-
-- # It seems that currently there's no mechanism to detect
-- # %autochangelog processing. But most packages would use both
-- # %autochangelog and %autorelease together, so we should catch
-- # most cases by checking for %autorelease only.
-- # https://pagure.io/fedora-infra/rpmautospec/issue/269
- return False
---
-2.43.0
-
diff --git a/0032-Unittests-for-Undo-rpmautospec-processing.patch b/0032-Unittests-for-Undo-rpmautospec-processing.patch
deleted file mode 100644
index f806c1c..0000000
--- a/0032-Unittests-for-Undo-rpmautospec-processing.patch
+++ /dev/null
@@ -1,289 +0,0 @@
-From 2bd726d20f3e5d1502a2191d0d263d0b6132982b Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Ond=C5=99ej=20Nosek?= <onosek@redhat.com>
-Date: Thu, 12 Oct 2023 01:40:36 +0200
-Subject: [PATCH] Unittests for "Undo rpmautospec processing"
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Merges: https://pagure.io/rpkg/pull-request/699
-Signed-off-by: Ondřej Nosek <onosek@redhat.com>
----
- Jenkinsfile | 2 +-
- jenkins_test.dockerfile | 3 +-
- pyrpkg/utils.py | 6 +--
- tests/fixtures/docpkg/docpkg-rpmautospec.spec | 53 +++++++++++++++++++
- tests/test_cli.py | 40 +++++++-------
- tests/test_utils.py | 36 ++++++++++++-
- 6 files changed, 116 insertions(+), 24 deletions(-)
- create mode 100644 tests/fixtures/docpkg/docpkg-rpmautospec.spec
-
-diff --git a/Jenkinsfile b/Jenkinsfile
-index 7b6742f..e6d6394 100644
---- a/Jenkinsfile
-+++ b/Jenkinsfile
-@@ -50,7 +50,7 @@ git fetch proposed
- git checkout "origin/$params.BRANCH_TO"
- git merge --no-ff "proposed/$params.BRANCH" -m "Merge PR"
-
--podman run --rm -v .:/src:Z quay.io/exd-guild-source-tools/rpkg-test:latest tox -e py36,py39,flake8,bandit --workdir /tmp/tox ${TOX_POSARGS}
-+podman run --rm -v .:/src:Z quay.io/exd-guild-source-tools/rpkg-test:latest tox -e py36,py39,py311,flake8,bandit --workdir /tmp/tox ${TOX_POSARGS}
- # disabled py27 environment for now; keep just flake8 for Python 2
- podman run --rm -v .:/src:Z quay.io/exd-guild-source-tools/rpkg-test-py2:latest tox -e flake8python2 --workdir /tmp/tox ${TOX_POSARGS}
- """
-diff --git a/jenkins_test.dockerfile b/jenkins_test.dockerfile
-index df8762e..d217a55 100644
---- a/jenkins_test.dockerfile
-+++ b/jenkins_test.dockerfile
-@@ -1,4 +1,4 @@
--FROM fedora:37
-+FROM fedora:38
- LABEL \
- name="rpkg test" \
- description="Run tests using tox with Python 3" \
-@@ -9,6 +9,7 @@ RUN dnf -y update && dnf -y install \
- python3-devel \
- python3-openidc-client \
- python3-libmodulemd \
-+ python3-rpmautospec \
- python3-setuptools \
- rpmlint \
- rpm-build \
-diff --git a/pyrpkg/utils.py b/pyrpkg/utils.py
-index f3c8b25..fc01c7d 100644
---- a/pyrpkg/utils.py
-+++ b/pyrpkg/utils.py
-@@ -104,7 +104,7 @@ def log_result(log_func, result, level=0, indent=2):
- elif isinstance(result, dict):
- for key, value in result.items():
- _log_value(log_func, key, level, indent, ':')
-- log_result(log_func, value, level+1)
-+ log_result(log_func, value, level + 1)
- else:
- _log_value(log_func, result, level, indent)
-
-@@ -348,9 +348,9 @@ def _replace_lines(lines, startline, endline, replacement_lines=None, strip_endl
- else:
- # rpmautospec adds an empty line after the end
- # we want to remove it, but only if it is actually empty
-- if strip_endline and lines[end+1] == "\n":
-+ if strip_endline and lines[end + 1] == "\n":
- end += 1
-- lines = lines[:start] + replacement_lines + lines[end+1:]
-+ lines = lines[:start] + replacement_lines + lines[end + 1:]
- return lines, True
-
-
-diff --git a/tests/fixtures/docpkg/docpkg-rpmautospec.spec b/tests/fixtures/docpkg/docpkg-rpmautospec.spec
-new file mode 100644
-index 0000000..5974b57
---- /dev/null
-+++ b/tests/fixtures/docpkg/docpkg-rpmautospec.spec
-@@ -0,0 +1,53 @@
-+## START: Set by rpmautospec
-+## (rpmautospec version 0.3.5)
-+## RPMAUTOSPEC: autorelease, autochangelog
-+%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
-+ release_number = 8;
-+ base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
-+ print(release_number + base_release_number - 1);
-+}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
-+## END: Set by rpmautospec
-+
-+# autogenerated specfile
-+Summary: Dummy summary
-+Name: docpkg-rpmautospec
-+Version: 0.2
-+Release: 1%{dist}
-+License: GPL
-+Group: Applications/Productivity
-+
-+BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
-+Source0: hello-world.txt
-+Source1: docpkg.tar.gz
-+Source2: source-without-extension
-+# added empty dir just to test import srpm `fedpkg import`. It should skip the dir.
-+Source3: EMPTY_DIR
-+
-+%description
-+This is a dummy description.
-+
-+%prep
-+cp %{SOURCE0} .
-+
-+%build
-+
-+%clean
-+rm -rf $$RPM_BUILD_ROOT
-+%install
-+rm -rf $RPM_BUILD_ROOT
-+mkdir $RPM_BUILD_ROOT
-+mkdir -p $RPM_BUILD_ROOT/usr/share/doc
-+cp %{SOURCE0} $RPM_BUILD_ROOT/usr/share/doc/hello-world.txt
-+
-+%files
-+%doc "/usr/share/doc/hello-world.txt"
-+
-+%changelog
-+## START: Generated by rpmautospec
-+* Sun Jan 1 2006 tester <tester@example.com> - 0.2-1
-+- - New release 0.2-1
-+
-+* Sun Jan 1 2006 John Doe <jdoe@example.com> - 0.2-1
-+- Initial version
-+
-+## END: Generated by rpmautospec
-diff --git a/tests/test_cli.py b/tests/test_cli.py
-index f2e68df..3d90f36 100644
---- a/tests/test_cli.py
-+++ b/tests/test_cli.py
-@@ -1706,10 +1706,10 @@ class TestFailureImportSrpm(CliTestCase):
- class TestImportSrpm(LookasideCacheMock, CliTestCase):
-
- @staticmethod
-- def build_srpm(srcrpmdir):
-+ def build_srpm(srcrpmdir, specfile_name='docpkg.spec'):
- """Build a fake SRPM used by this test case"""
- docpkg_dir = os.path.join(fixtures_dir, 'docpkg')
-- specfile = os.path.join(docpkg_dir, 'docpkg.spec')
-+ specfile = os.path.join(docpkg_dir, specfile_name)
- rpmbuild = [
- 'rpmbuild', '-bs',
- '--define', '_topdir {0}'.format(srcrpmdir),
-@@ -1735,6 +1735,9 @@ class TestImportSrpm(LookasideCacheMock, CliTestCase):
-
- self.srcrpmdir = tempfile.mkdtemp(prefix='test-import-srpm-topdir-')
- self.srpm_file = TestImportSrpm.build_srpm(self.srcrpmdir)
-+ self.srpm_file_rpmautospec = TestImportSrpm.build_srpm(
-+ self.srcrpmdir,
-+ specfile_name='docpkg-rpmautospec.spec')
-
- self.chaos_repo = tempfile.mkdtemp(prefix='rpkg-tests-chaos-repo-')
- cmds = (
-@@ -1827,40 +1830,29 @@ class TestImportSrpm(LookasideCacheMock, CliTestCase):
- self.assertFilesExist(['package.rpmlintrc'], search_dir=self.chaos_repo)
- self.assertFilesNotExist(['the_file_is_not_in_reserved.yaml'], search_dir=self.chaos_repo)
-
-- @patch('pyrpkg.spec_file_processed_by_rpmautospec')
-- def test_import_srpm_not_processed_by_rpmautospec(self, rpmautospec_processed):
-+ def test_import_srpm_not_processed_by_rpmautospec(self):
- cli_cmd = ['rpkg', '--path', self.chaos_repo, '--name', 'docpkg',
- 'import', '--skip-diffs', self.srpm_file]
-
-- rpmautospec_processed.return_value = False
- with patch('sys.argv', new=cli_cmd):
- cli = self.new_cli()
- with patch('pyrpkg.lookaside.CGILookasideCache.upload', self.lookasidecache_upload):
- cli.import_srpm() # no exception should be raised
-- rpmautospec_processed.assert_called_once()
-
-- @patch('pyrpkg.spec_file_processed_by_rpmautospec')
-- def test_import_srpm_processed_by_rpmautospec(self, rpmautospec_processed):
-+ def test_import_srpm_processed_by_rpmautospec(self):
- cli_cmd = ['rpkg', '--path', self.chaos_repo, '--name', 'docpkg',
-- 'import', '--skip-diffs', self.srpm_file]
-+ 'import', '--skip-diffs', self.srpm_file_rpmautospec]
-
-- rpmautospec_processed.return_value = True
- with patch('sys.argv', new=cli_cmd):
- cli = self.new_cli()
- with patch('pyrpkg.lookaside.CGILookasideCache.upload', self.lookasidecache_upload):
-- six.assertRaisesRegex(
-- self,
-- rpkgError,
-- 'SRPM was processed by rpmautospec',
-- cli.import_srpm)
-- rpmautospec_processed.assert_called_once()
-+ cli.import_srpm()
-
-- @patch('pyrpkg.spec_file_processed_by_rpmautospec')
-+ @patch('pyrpkg.spec_file_undo_rpmautospec')
- def test_import_srpm_processed_by_rpmautospec_allowed(self, rpmautospec_processed):
- cli_cmd = ['rpkg', '--path', self.chaos_repo, '--name', 'docpkg',
- 'import', '--skip-diffs', self.srpm_file]
-
-- rpmautospec_processed.return_value = True
- with patch('sys.argv', new=cli_cmd):
- cli = self.new_cli()
- cli.cmd.allow_pre_generated_srpm = True
-@@ -1868,6 +1860,18 @@ class TestImportSrpm(LookasideCacheMock, CliTestCase):
- cli.import_srpm() # no exception should be raised
- rpmautospec_processed.assert_not_called()
-
-+ @patch('pyrpkg.spec_file_undo_rpmautospec')
-+ def test_import_srpm_processed_by_rpmautospec_not_allowed(self, rpmautospec_processed):
-+ cli_cmd = ['rpkg', '--path', self.chaos_repo, '--name', 'docpkg',
-+ 'import', '--skip-diffs', self.srpm_file]
-+
-+ with patch('sys.argv', new=cli_cmd):
-+ cli = self.new_cli()
-+ cli.cmd.allow_pre_generated_srpm = False # or None
-+ with patch('pyrpkg.lookaside.CGILookasideCache.upload', self.lookasidecache_upload):
-+ cli.import_srpm() # no exception should be raised
-+ rpmautospec_processed.assert_called_once()
-+
-
- class TestMockbuild(CliTestCase):
- """Test mockbuild command"""
-diff --git a/tests/test_utils.py b/tests/test_utils.py
-index 34188c5..0cd62d8 100644
---- a/tests/test_utils.py
-+++ b/tests/test_utils.py
-@@ -1,15 +1,22 @@
- import os
-+import shutil
- import tempfile
- import unittest
- import warnings
-
-+try:
-+ import rpmautospec
-+except ImportError:
-+ rpmautospec = None
-+
- try:
- from unittest import mock
- except ImportError:
- import mock
-
- from pyrpkg.utils import (cached_property, is_file_in_directory,
-- is_file_tracked, log_result, warn_deprecated)
-+ is_file_tracked, log_result,
-+ spec_file_undo_rpmautospec, warn_deprecated)
-
- from utils import CommandTestCase
-
-@@ -287,3 +294,30 @@ class FileTrackedTestCase(CommandTestCase):
- self.repo_path
- )
- )
-+
-+
-+@unittest.skipIf(
-+ rpmautospec is None,
-+ "Skip test on releases where rpmautospec is not available (RHEL)")
-+class SpecFileUndoRpmautospec(CommandTestCase):
-+ def test_remove_autospec_from_specfile(self):
-+ fixtures_dir = os.path.join(os.path.dirname(__file__), "fixtures", "docpkg")
-+
-+ specfile_without_rpmautospec = os.path.join(fixtures_dir, "docpkg.spec")
-+ specfile_without_rpmautospec_copy = os.path.join(self.repo_path, "docpkg.spec")
-+ shutil.copy2(specfile_without_rpmautospec, specfile_without_rpmautospec_copy)
-+ self.assertFalse(rpmautospec.specfile_uses_rpmautospec(specfile_without_rpmautospec_copy))
-+ self.assertFalse(spec_file_undo_rpmautospec(specfile_without_rpmautospec_copy))
-+ self.assertFalse(rpmautospec.specfile_uses_rpmautospec(specfile_without_rpmautospec_copy))
-+ os.remove(specfile_without_rpmautospec_copy)
-+
-+ specfile_with_rpmautospec = os.path.join(fixtures_dir, "docpkg-rpmautospec.spec")
-+ specfile_with_rpmautospec_copy = os.path.join(self.repo_path, "docpkg-rpmautospec.spec")
-+ shutil.copy2(specfile_with_rpmautospec, specfile_with_rpmautospec_copy)
-+ # returns True if the specfile was modified
-+ self.assertTrue(spec_file_undo_rpmautospec(specfile_with_rpmautospec_copy))
-+ self.assertFalse(rpmautospec.specfile_uses_rpmautospec(
-+ specfile_with_rpmautospec_copy, check_autochangelog=False, check_autorelease=True))
-+ self.assertTrue(rpmautospec.specfile_uses_rpmautospec(
-+ specfile_with_rpmautospec_copy, check_autochangelog=True, check_autorelease=False))
-+ os.remove(specfile_with_rpmautospec_copy)
---
-2.43.0
-
diff --git a/0033-Update-docker-image-for-Jenkinks-tests.patch b/0033-Update-docker-image-for-Jenkinks-tests.patch
deleted file mode 100644
index 06d747d..0000000
--- a/0033-Update-docker-image-for-Jenkinks-tests.patch
+++ /dev/null
@@ -1,73 +0,0 @@
-From 898b2c61506e72847bae00aa8ffe228aebb69547 Mon Sep 17 00:00:00 2001
-From: Ondrej Nosek <onosek@redhat.com>
-Date: Tue, 7 Mar 2023 19:15:28 +0100
-Subject: [PATCH] Update docker image for Jenkinks tests
-
-Regenerate the docker image: Fedora 35 --> Fedora 37.
-Jenkinsfile as a pipeline script is unified with fedpkg.
-
-JIRA: RHELCMP-11391
-Signed-off-by: Ondrej Nosek <onosek@redhat.com>
----
- Jenkinsfile | 14 +++++++++-----
- jenkins_test.dockerfile | 2 +-
- 2 files changed, 10 insertions(+), 6 deletions(-)
-
-diff --git a/Jenkinsfile b/Jenkinsfile
-index b67b9a7..7b6742f 100644
---- a/Jenkinsfile
-+++ b/Jenkinsfile
-@@ -23,7 +23,7 @@ pipeline {
- }
- try {
- echo "Requesting duffy node ..."
-- def session_str = sh returnStdout: true, script: "set +x; duffy client --url https://duffy.ci.centos.org/api/v1 --auth-name fedora-infra --auth-key $CICO_API_KEY request-session pool=virt-ec2-t2-centos-9s-x86_64,quantity=1"
-+ def session_str = sh returnStdout: true, script: "set +x; duffy client --url https://duffy.ci.centos.org/api/v1 --auth-name fedora-infra --auth-key $CICO_API_KEY request-session pool=virt-ec2-t2-centos-8s-x86_64,quantity=1"
- def session = readJSON text: session_str
- DUFFY_SESSION_ID= session.session.id
- def hostname = session.session.nodes[0].hostname
-@@ -31,7 +31,7 @@ pipeline {
- def remote_dir = "/tmp/$JENKINS_AGENT_NAME"
- echo "remote_dir: $remote_dir"
- // this makes tests run in parallel if needed: "--parallel=auto --parallel-live"
-- def TOX_POSARGS =
-+ def TOX_POSARGS = ""
- writeFile file: 'job.sh', text: """
- set -xe
- dnf install -y git podman
-@@ -40,15 +40,19 @@ git config --global user.name "jenkins"
- cd $remote_dir
- git clone https://pagure.io/rpkg.git -b master
- cd rpkg
--git remote rm proposed || true
-+# remove remote only if exists
-+remotes=\$(git remote)
-+if echo "\$remotes" | grep -q "^proposed\$"; then
-+ git remote rm proposed || true
-+fi
- git remote add proposed "$params.REPO"
- git fetch proposed
- git checkout "origin/$params.BRANCH_TO"
- git merge --no-ff "proposed/$params.BRANCH" -m "Merge PR"
-
--podman run --rm -v .:/src:Z quay.io/exd-guild-source-tools/rpkg-test tox -e py36,py39,flake8,bandit --workdir /tmp/tox ${TOX_POSARGS}
-+podman run --rm -v .:/src:Z quay.io/exd-guild-source-tools/rpkg-test:latest tox -e py36,py39,flake8,bandit --workdir /tmp/tox ${TOX_POSARGS}
- # disabled py27 environment for now; keep just flake8 for Python 2
--podman run --rm -v .:/src:Z quay.io/exd-guild-source-tools/rpkg-test-py2 tox -e flake8python2 --workdir /tmp/tox ${TOX_POSARGS}
-+podman run --rm -v .:/src:Z quay.io/exd-guild-source-tools/rpkg-test-py2:latest tox -e flake8python2 --workdir /tmp/tox ${TOX_POSARGS}
- """
- sh "cat job.sh"
- sh "ssh -o StrictHostKeyChecking=no root@$hostname mkdir $remote_dir"
-diff --git a/jenkins_test.dockerfile b/jenkins_test.dockerfile
-index 43245b1..df8762e 100644
---- a/jenkins_test.dockerfile
-+++ b/jenkins_test.dockerfile
-@@ -1,4 +1,4 @@
--FROM fedora:35
-+FROM fedora:37
- LABEL \
- name="rpkg test" \
- description="Run tests using tox with Python 3" \
---
-2.43.0
-
diff --git a/0034-mockbuild-new-argument-extra-pkgs.patch b/0034-mockbuild-new-argument-extra-pkgs.patch
deleted file mode 100644
index 9579dd3..0000000
--- a/0034-mockbuild-new-argument-extra-pkgs.patch
+++ /dev/null
@@ -1,68 +0,0 @@
-From 89d3bb0d34250fe24eed5bc63edd992e932a622a Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Ond=C5=99ej=20Nosek?= <onosek@redhat.com>
-Date: Wed, 15 Nov 2023 02:53:10 +0100
-Subject: [PATCH 14/17] `mockbuild`: new argument --extra-pkgs
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Added the new argument `--extra-pkgs` to `mockbuild` command.
-It installs additional packages to mock's chroot. In some cases is
-possible to use the current mechanism of extra args placed
-after `--` at the end of the command line instead of `--extra-pkgs`.
-
- Example: fedpkg mockbuild -- --additional-package <pkg>
-
-Argument(s) `additional-package` is passed to `mock`.
-`additional-package` can't be used together with `--shell`.
-
-JIRA: RHELCMP-11017
-Fixes: https://pagure.io/fedpkg/issue/498
-
-Signed-off-by: Ondřej Nosek <onosek@redhat.com>
----
- pyrpkg/cli.py | 21 +++++++++++++++++++++
- 1 file changed, 21 insertions(+)
-
-diff --git a/pyrpkg/cli.py b/pyrpkg/cli.py
-index 6fd6df0..06f4c1a 100644
---- a/pyrpkg/cli.py
-+++ b/pyrpkg/cli.py
-@@ -1152,6 +1152,9 @@ class cliClient(object):
- '--use-local-mock-config', default=None, dest="local_mock_config",
- action='store_true',
- help="Enforce use of local Mock configuration.")
-+ mockbuild_parser.add_argument(
-+ '--extra-pkgs', action='append', nargs='*',
-+ help="Install additional packages into chroot")
-
- mockbuild_parser.set_defaults(command=self.mockbuild)
-
-@@ -2514,6 +2517,24 @@ class cliClient(object):
- "%s-%s-%s.src.rpm"
- % (self.cmd.repo_name, self.cmd.ver, self.cmd.rel))
- self.log.debug('Srpm generated: {0}'.format(self.cmd.srpmname))
-+ if self.args.extra_pkgs:
-+ mockargs_extra_pkgs = []
-+ list_extra_pkgs = []
-+ # process possible multiple argument's occurrences
-+ for arg_arr in self.args.extra_pkgs:
-+ for additional_package in arg_arr:
-+ mockargs_extra_pkgs.extend(['--additional-package', additional_package])
-+ list_extra_pkgs.append(additional_package)
-+ # installation will run in separated mock process, so do not clean prepared chroot
-+ # before the main mock run
-+ mockargs_extra_pkgs.extend(['--no-cleanup-after'])
-+ self.log.info('Installing extra packages into the mock chroot: {}'.format(
-+ ', '.join(list_extra_pkgs)))
-+ self.cmd.mockbuild(mockargs_extra_pkgs, self.args.root,
-+ hashtype=self.args.hash,
-+ shell=None, # nosec
-+ force_local_mock_config=self.args.local_mock_config)
-+
- self.cmd.mockbuild(mockargs, self.args.root,
- hashtype=self.args.hash,
- shell=self.args.shell, # nosec
---
-2.43.0
-
diff --git a/0035-Add-option-to-mockbuild-use-default-resultdir-of-moc.patch b/0035-Add-option-to-mockbuild-use-default-resultdir-of-moc.patch
deleted file mode 100644
index 9f8f4a0..0000000
--- a/0035-Add-option-to-mockbuild-use-default-resultdir-of-moc.patch
+++ /dev/null
@@ -1,69 +0,0 @@
-From 446b80ad746771dbfa938476504e13c829f2e7f6 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?S=C3=A9rgio=20M=2E=20Basto?= <sergio@serjux.com>
-Date: Mon, 3 Oct 2022 01:11:20 +0100
-Subject: [PATCH 17/17] Add option to mockbuild use default resultdir of mock
- (v3)
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Merges: https://pagure.io/rpkg/pull-request/637
-
-Signed-off-by: Sérgio M. Basto <sergio@serjux.com>
----
- pyrpkg/__init__.py | 6 ++++--
- pyrpkg/cli.py | 7 ++++++-
- 2 files changed, 10 insertions(+), 3 deletions(-)
-
-diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
-index d2d8c8a..4c56169 100644
---- a/pyrpkg/__init__.py
-+++ b/pyrpkg/__init__.py
-@@ -3127,7 +3127,7 @@ class Commands(object):
- return root, config_dir
-
- def mockbuild(self, mockargs=[], root=None, hashtype=None, shell=None,
-- force_local_mock_config=None, srpm_mock=False):
-+ force_local_mock_config=None, srpm_mock=False, default_mock_resultdir=False):
- """Build the package in mock, using mockargs
-
- Log the output and returns nothing
-@@ -3167,7 +3167,9 @@ class Commands(object):
- if config_dir:
- cmd.extend(['--configdir', config_dir])
-
-- cmd += ['-r', root, '--resultdir', self.mock_results_dir]
-+ cmd += ['-r', root]
-+ if default_mock_resultdir is not True:
-+ cmd += ['--resultdir', self.mock_results_dir]
-
- if shell:
- cmd.append('--shell')
-diff --git a/pyrpkg/cli.py b/pyrpkg/cli.py
-index b6adaad..621df32 100644
---- a/pyrpkg/cli.py
-+++ b/pyrpkg/cli.py
-@@ -1154,6 +1154,10 @@ class cliClient(object):
- '--use-local-mock-config', default=None, dest="local_mock_config",
- action='store_true',
- help="Enforce use of local Mock configuration.")
-+ mockbuild_parser.add_argument(
-+ '--default-mock-resultdir', default=None, dest="default_mock_resultdir",
-+ action='store_true',
-+ help="Don't modify Mock resultdir.")
- mockbuild_parser.add_argument(
- '--extra-pkgs', action='append', nargs='*',
- help="Install additional packages into chroot")
-@@ -2544,7 +2548,8 @@ class cliClient(object):
- self.cmd.mockbuild(mockargs, self.args.root,
- hashtype=self.args.hash,
- shell=self.args.shell, # nosec
-- force_local_mock_config=self.args.local_mock_config)
-+ force_local_mock_config=self.args.local_mock_config,
-+ default_mock_resultdir=self.args.default_mock_resultdir)
- except Exception as e:
- raise rpkgError(e)
-
---
-2.43.0
-
diff --git a/0036-Fix-compatibility-with-Python-3.13-rhbz-2276896.patch b/0036-Fix-compatibility-with-Python-3.13-rhbz-2276896.patch
deleted file mode 100644
index 3897d5d..0000000
--- a/0036-Fix-compatibility-with-Python-3.13-rhbz-2276896.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From 8abedc57b1f5b396ea1acdf9b476a299e8141eab Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Ond=C5=99ej=20Nosek?= <onosek@redhat.com>
-Date: Thu, 23 May 2024 11:23:03 +0000
-Subject: [PATCH] Fix compatibility with Python 3.13+ - rhbz#2276896
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Signed-off-by: Ondřej Nosek <onosek@redhat.com>
----
- pyrpkg/lookaside.py | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/pyrpkg/lookaside.py b/pyrpkg/lookaside.py
-index 01eee4a..dc84b1d 100644
---- a/pyrpkg/lookaside.py
-+++ b/pyrpkg/lookaside.py
-@@ -406,7 +406,7 @@ class CGILookasideCache(object):
- try:
- return function(*args, **kwargs)
- except wait_on as e:
-- self.log.warn("Network error: %s" % (e))
-+ self.log.warning("Network error: %s" % (e))
- attempts_left -= 1
- self.log.debug("Attempt %d/%d has failed."
- % (attempts_all - attempts_left, attempts_all))
---
-2.43.2
-
diff --git a/rpkg.spec b/rpkg.spec
index 87eb197..eebbe47 100644
--- a/rpkg.spec
+++ b/rpkg.spec
@@ -1,6 +1,6 @@
Name: rpkg
-Version: 1.66
-Release: 19%{?dist}
+Version: 1.67
+Release: 1%{?dist}
Summary: Python library for interacting with rpm+git
License: GPLv2+ and LGPLv2
@@ -37,39 +37,7 @@ Patch2: 0002-Remove-pytest-coverage-execution.patch
%if 0%{?with_python2}
Patch3: 0003-Remove-Environment-Markers-syntax.patch
%endif
-Patch4: 0004-Process-source-URLs-with-fragment-in-pre-push-hook.patch
-Patch5: 0005-container-build-update-signing-intent-help-for-OSBS-.patch
-Patch6: 0033-Update-docker-image-for-Jenkinks-tests.patch
-Patch7: 0006-Do-not-generate-pre-push-hook-script-in-some-cases.patch
-Patch8: 0007-More-robust-spec-file-presence-checking.patch
-Patch9: 0008-Update-to-spec-file-presence-checking.patch
-Patch10: 0009-Add-more-information-about-pre-push-hook.patch
-Patch11: 0010-pre-push-check-have-to-use-spectool-with-define.patch
-Patch12: 0011-A-HEAD-query-into-a-lookaside-cache.patch
-Patch13: 0012-pre-push-hook-script-contains-a-user-s-config.patch
-Patch14: 0013-Fix-unittests-for-clone-and-pre-push-hook-script.patch
-Patch15: 0014-import_srpm-allow-pre-generated-srpms.patch
-Patch16: 0015-Ignore-missing-spec-file-in-pre-push-hook.patch
-Patch17: 0016-Check-remote-file-with-correct-hash.patch
-Patch18: 0017-Allow-empty-commits-when-uses_rpmautospec.patch
-Patch19: 0018-Config-file-option-to-skip-the-hook-script-creation.patch
-Patch20: 0019-Pre-push-hook-won-t-check-private-branches.patch
-Patch21: 0020-Use-release-s-rpmdefines-in-unused-sources-check.patch
-Patch22: 0021-Do-not-require-sources-file-for-all-namespaces.patch
-Patch23: 0022-copr-build-passes-extra_args-to-copr-cli-command.patch
-Patch24: 0023-commit-command-fails-on-containers-namespace.patch
-Patch25: 0024-Split-git-credential-data-on-first-only.patch
-Patch26: 0025-Support-for-checking-exploded-sources-before-push.patch
-Patch27: 0026-Fix-flake8-complaints.patch
-Patch28: 0027-Prepare-the-lookaside-cache-code-for-retries.patch
-Patch29: 0028-Lookaside-cache-operations-retries.patch
-Patch30: 0029-Make-lookaside-cache-retries-configurable.patch
-Patch31: 0030-pkg-import-Don-t-delete-changelog-generated-by-rpmau.patch
-Patch32: 0031-pkg-import-Undo-rpmautospec-processing.patch
-Patch33: 0032-Unittests-for-Undo-rpmautospec-processing.patch
-Patch34: 0034-mockbuild-new-argument-extra-pkgs.patch
-Patch35: 0035-Add-option-to-mockbuild-use-default-resultdir-of-moc.patch
-Patch36: 0036-Fix-compatibility-with-Python-3.13-rhbz-2276896.patch
+
%description
Python library for interacting with rpm+git
@@ -91,7 +59,7 @@ BuildRequires: PyYAML
BuildRequires: GitPython
BuildRequires: python-pycurl
BuildRequires: python-requests
-BuildRequires: python-requests-kerberos
+BuildRequires: python-requests-gssapi
BuildRequires: python-six >= 1.9.0
BuildRequires: python2-argcomplete
BuildRequires: python2-mock
@@ -110,7 +78,7 @@ Requires: PyYAML
Requires: GitPython >= 0.2.0
Requires: python-pycurl
Requires: python-requests
-Requires: python-requests-kerberos
+Requires: python-requests-gssapi
Requires: python-six >= 1.9.0
Requires: rpm-python
@@ -145,7 +113,7 @@ BuildRequires: python3-koji >= 1.24
%if 0%{?rhel}
BuildRequires: python3-gobject-base
BuildRequires: libmodulemd
-BuildRequires: python3-requests-kerberos
+BuildRequires: python3-requests-gssapi
%else
BuildRequires: python3-libmodulemd
%endif
@@ -174,7 +142,7 @@ Requires: python3-koji >= 1.24
%if 0%{?rhel}
Requires: python3-gobject-base
Requires: libmodulemd
-Requires: python3-requests-kerberos
+Requires: python3-requests-gssapi
%else
Requires: python3-libmodulemd
Requires: python3-rpmautospec >= 0.3.8
@@ -286,9 +254,62 @@ example_cli_dir=$RPM_BUILD_ROOT%{_datadir}/%{name}/examples/cli
%changelog
+* Tue Jun 25 2024 Ondřej Nosek <onosek@redhat.com> - 1.67-1
+- Include URL in upload/download (walters)
+- Use python-requests-gssapi instead of -kerberos (lsedlar)
+- man page generator: use $SOURCE_DATE_EPOCH if specified (zbyszek)
+- do not block tag --clog due autospec usage (msuchy)
+- Processing of another return message from lookaside cache (onosek)
+- Allow setting --force for sources command by env var (lsedlar)
+- Update docker image for Jenkinks tests (onosek)
+- '_set_token' method moved to a shared place (onosek)
+- Fix copr-build command with results_dir=subdir option (otto.liljalaakso)
+- mockbuild: use results/mock_* when results_dir=subdir (tmz)
+- Add option to mockbuild use default resultdir of mock (v3) (sergio)
+- Restrict completion to .src.rpm files for import - #706 (orion)
+- `remote add` command: create a non-anonymous remote - #599 (onosek)
+- `mockbuild`: new argument --extra-pkgs - 498 (onosek)
+- *pkg import: check specfile matches the repo name - 529 (onosek)
+- Fixes syntax issues reported by flake8 (onosek)
+- Unittests for "Undo rpmautospec processing" (onosek)
+- *pkg import: Undo rpmautospec processing - 527 (miro)
+- *pkg import: Don't delete changelog generated by `rpmautospec convert` (miro)
+- Make lookaside cache retries configurable (onosek)
+- Lookaside cache operations retries (onosek)
+- Prepare the lookaside cache code for retries (onosek)
+- Fix flake8 complaints (onosek)
+- Support for checking exploded sources before push (onosek)
+- Split git credential data on first = only - 694 (lsedlar)
+- `commit` command fails on 'containers' namespace (onosek)
+- `copr-build` passes extra_args to copr-cli command - 510 (onosek)
+- Do not require 'sources' file for all namespaces - #684 (onosek)
+- Use release's rpmdefines in unused sources check - #671 (otto.liljalaakso)
+- Pre-push hook won't check private branches - #683 (onosek)
+- Config file option to skip the hook script creation - 515 (onosek)
+- Allow empty commits when `uses_rpmautospec` - #677 (j1.kyjovsky)
+- Check remote file with correct hash (lsedlar)
+- Ignore missing spec file in pre-push hook (lsedlar)
+- import_srpm: allow pre-generated srpms - #655 (onosek)
+- Fix unittests for `clone` and pre-push hook script (onosek)
+- pre-push hook script contains a user's config - #667 (onosek)
+- A HEAD query into a lookaside cache - 513 (onosek)
+- `pre-push-check` have to use spectool with --define - #672 (onosek)
+- Add more information about pre-push hook (lsedlar)
+- Update to spec file presence checking - #663 (onosek)
+- More robust spec file presence checking - #663 (onosek)
+- Do not generate pre-push hook script in some cases - #665 (onosek)
+- Avoid calling repo_name from load_nameverrel - #657 (otto.liljalaakso)
+- Move warnings from missing Git repo to debug level - #659 (otto.liljalaakso)
+- Update docker image for Jenkinks tests (onosek)
+- container-build: update --signing-intent help for OSBS 2 (kdreyer)
+- Process source URLs with fragment in pre-push hook (lsedlar)
+
* Sun Jun 09 2024 Python Maint <python-maint@redhat.com> - 1.66-19
- Rebuilt for Python 3.13
+* Tue May 28 2024 Ondřej Nosek <onosek@redhat.com> - 1.66-16
+- Patch: Use python-requests-gssapi instead of -kerberos
+
* Thu May 23 2024 Ondřej Nosek <onosek@redhat.com> - 1.66-18
- Fix compatibility with Python 3.13+ - rhbz#2276896
diff --git a/sources b/sources
index d98b3f9..e7e9a14 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-SHA512 (rpkg-1.66.tar.gz) = 14a6947146cd5a8f9baa2d3fba0a37bb0d7ab5bd69e29c04282c882e1f249831c8faf443d4dd94adfe1bf385f6525cefef84b10d44a3949d815fd293d5f5fccc
+SHA512 (rpkg-1.67.tar.gz) = 64ae09c980203cd7033e280ff7e89a3e54dd40be8d09414d928d57e23f1514516520c69dcf8c2bbc0c3253a4ffa556ba21adb0c2f590e2245a706dcd264fe18b
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-08-10 21:44 UTC | newest]
Thread overview: (only message) (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: New release 1.67
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox