diff --git a/.gitignore b/.gitignore index 1732947..a1d80bd 100644 --- a/.gitignore +++ b/.gitignore @@ -58,3 +58,4 @@ /rpkg-1.60.tar.gz /rpkg-1.61.tar.gz /rpkg-1.62.tar.gz +/rpkg-1.63.tar.gz diff --git a/0001-Do-not-use-pytest-related-dependencies-temporarily.patch b/0001-Do-not-use-pytest-related-dependencies-temporarily.patch index aa12d44..70d12b0 100644 --- a/0001-Do-not-use-pytest-related-dependencies-temporarily.patch +++ b/0001-Do-not-use-pytest-related-dependencies-temporarily.patch @@ -1,25 +1,25 @@ -From a1127c74e6280b891028b0662316c8653511f0bd Mon Sep 17 00:00:00 2001 -From: Ondrej Nosek -Date: Wed, 9 Sep 2020 01:30:54 +0200 -Subject: [PATCH] Do not use pytest-related dependencies temporarily +From 50caf547ff288d8146ea5e277ab7bfcf7e8b095c Mon Sep 17 00:00:00 2001 +From: Dominik Rumian +Date: Tue, 24 Aug 2021 16:24:47 +0200 +Subject: [PATCH] [PATCH] Do not use pytest-related dependencies temporarily -Signed-off-by: Ondrej Nosek +Signed-off-by: Dominik Rumian --- setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.py b/setup.py -index f18ff4f..7681578 100755 +index 9c6d881..557cf5f 100755 --- a/setup.py +++ b/setup.py -@@ -59,7 +59,6 @@ setup( +@@ -49,7 +49,6 @@ setup( license="GPLv2+", url="https://pagure.io/rpkg", packages=find_packages(), - setup_requires=['setuptools_scm', 'pytest-runner'], install_requires=install_requires, - extras_require={ - ':python_version=="2.6"': [ + tests_require=tests_require, + dependency_links=dep_links, -- -2.26.2 +2.31.1 diff --git a/0002-Use-six-library-in-tests.patch b/0002-Use-six-library-in-tests.patch new file mode 100644 index 0000000..03c1ead --- /dev/null +++ b/0002-Use-six-library-in-tests.patch @@ -0,0 +1,53 @@ +From e40fdf22124f9dbcc5f91578c9fd9f9b14625726 Mon Sep 17 00:00:00 2001 +From: Dominik Rumian +Date: Tue, 24 Aug 2021 13:54:38 +0200 +Subject: [PATCH] [PATCH] Use 'six' library in tests + +Signed-off-by: Dominik Rumian +--- + tests/test_cli.py | 4 ++-- + tests/test_lookaside.py | 6 ++++-- + 2 files changed, 6 insertions(+), 4 deletions(-) + +diff --git a/tests/test_cli.py b/tests/test_cli.py +index 735f4d7..cf4e5b3 100644 +--- a/tests/test_cli.py ++++ b/tests/test_cli.py +@@ -1534,8 +1534,8 @@ class TestImportSrpm(LookasideCacheMock, CliTestCase): + # Exception is not a functionality issue. There is no problem with + # uploading same file twice in a test however, the upload method checks + # if file has been already uploaded. +- self.assertRaisesRegex(AlreadyUploadedError, r'File already uploaded', +- self.assert_import_srpm, self.cloned_repo_path) ++ six.assertRaisesRegex(self, AlreadyUploadedError, r'File already uploaded', ++ self.assert_import_srpm, self.cloned_repo_path) + + def test_import_gating_and_rpmlintrc_exception(self): + # Add three additional files to the repo. Former gating.yaml and package.rpmlintrc are +diff --git a/tests/test_lookaside.py b/tests/test_lookaside.py +index 6946b79..5ad3e7b 100644 +--- a/tests/test_lookaside.py ++++ b/tests/test_lookaside.py +@@ -15,6 +15,8 @@ import unittest + + import mock + import pycurl ++import six ++ + from pyrpkg.errors import (AlreadyUploadedError, DownloadError, + InvalidHashType, UploadError) + from pyrpkg.lookaside import CGILookasideCache +@@ -512,8 +514,8 @@ class CGILookasideCacheTestCase(unittest.TestCase): + with mock.patch.object(lc, 'remote_file_exists', lambda *x: True): + # self.assertRaises(AlreadyUploadedError, lc.upload, 'pyrpkg', + # 'pyrpkg-0.tar.xz', hash) +- self.assertRaisesRegex(AlreadyUploadedError, r'File already uploaded', +- lc.upload, 'pyrpkg', 'pyrpkg-0.tar.xz', hash) ++ six.assertRaisesRegex(self, AlreadyUploadedError, r'File already uploaded', ++ lc.upload, 'pyrpkg', 'pyrpkg-0.tar.xz', hash) + + self.assertEqual(curl.perform.call_count, 0) + self.assertEqual(curl.setopt.call_count, 0) +-- +2.31.1 + diff --git a/0002-ca-cert-was-removed-on-koji-1.24.0.patch b/0002-ca-cert-was-removed-on-koji-1.24.0.patch deleted file mode 100644 index cc93a16..0000000 --- a/0002-ca-cert-was-removed-on-koji-1.24.0.patch +++ /dev/null @@ -1,51 +0,0 @@ -From a7521f9ee9627c80282fa59fffd8a43d8af94fb3 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?S=C3=A9rgio=20M=2E=20Basto?= -Date: Tue, 23 Feb 2021 22:12:27 +0000 -Subject: [PATCH] ca cert was removed on koji-1.24.0 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: Sérgio M. Basto ---- - pyrpkg/__init__.py | 2 +- - tests/test_commands.py | 3 +-- - 2 files changed, 2 insertions(+), 3 deletions(-) - -diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py -index a3f5edd..126f0db 100644 ---- a/pyrpkg/__init__.py -+++ b/pyrpkg/__init__.py -@@ -276,7 +276,7 @@ class Commands(object): - if authtype == 'ssl' or os.path.isfile(koji_config['cert']) and authtype is None: - try: - session.ssl_login(koji_config['cert'], -- koji_config['ca'], -+ None, - koji_config['serverca'], - proxyuser=self.runas) - except Exception as e: -diff --git a/tests/test_commands.py b/tests/test_commands.py -index c0ac6b3..e82a5d2 100644 ---- a/tests/test_commands.py -+++ b/tests/test_commands.py -@@ -625,7 +625,6 @@ class TestLoginKojiSession(CommandTestCase): - 'authtype': 'ssl', - 'server': 'http://localhost/kojihub', - 'cert': '/path/to/cert', -- 'ca': '/path/to/ca', - 'serverca': '/path/to/serverca', - } - self.session = Mock() -@@ -649,7 +648,7 @@ class TestLoginKojiSession(CommandTestCase): - - self.session.ssl_login.assert_called_once_with( - self.koji_config['cert'], -- self.koji_config['ca'], -+ None, - self.koji_config['serverca'], - proxyuser=None, - ) --- -2.29.2 - diff --git a/0003-Add-support-for-side-tag-suffix.patch b/0003-Add-support-for-side-tag-suffix.patch deleted file mode 100644 index c1baaa5..0000000 --- a/0003-Add-support-for-side-tag-suffix.patch +++ /dev/null @@ -1,104 +0,0 @@ -From c6d5a68627033570995645e574d39ff7d2bbef82 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= -Date: Thu, 25 Feb 2021 14:43:20 +0100 -Subject: [PATCH] Add support for side tag suffix -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This requires changes in the side-tag plugin in Koji. With that it would -be possible to use a set of preconfigured suffixes for the tags. - -JIRA: RHELCMP-4332 -Signed-off-by: Lubomír Sedlář ---- - pyrpkg/__init__.py | 8 ++++++-- - pyrpkg/cli.py | 11 ++++++++++- - tests/test_side_tag.py | 17 +++++++++++++++++ - 3 files changed, 33 insertions(+), 3 deletions(-) - -diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py -index afc525a..a479851 100644 ---- a/pyrpkg/__init__.py -+++ b/pyrpkg/__init__.py -@@ -3214,14 +3214,18 @@ class Commands(object): - def remove_side_tag(self, tag): - self.kojisession.removeSideTag(tag) - -- def request_side_tag(self, base_tag=None): -+ def request_side_tag(self, base_tag=None, suffix=None): - if not base_tag: - build_target = self.kojisession.getBuildTarget(self.target) - if not build_target: - raise rpkgError("Unknown build target: %s" % self.target) - base_tag = build_target["build_tag_name"] - -- return self.kojisession.createSideTag(base_tag) -+ kwargs = {} -+ if suffix: -+ kwargs["suffix"] = suffix -+ -+ return self.kojisession.createSideTag(base_tag, **kwargs) - - def is_retired(self): - """ -diff --git a/pyrpkg/cli.py b/pyrpkg/cli.py -index 55d111c..002a1a0 100644 ---- a/pyrpkg/cli.py -+++ b/pyrpkg/cli.py -@@ -1369,6 +1369,13 @@ class cliClient(object): - "request-side-tag", help="Create a new side tag" - ) - parser.add_argument("--base-tag", help="name of base tag") -+ parser.add_argument( -+ "--suffix", -+ help=( -+ "A suffix to be appended to the side tag name. " -+ "The suffix must be allowed in Koji configuration." -+ ) -+ ) - parser.set_defaults(command=self.request_side_tag) - - def register_retire(self): -@@ -2565,7 +2572,9 @@ class cliClient(object): - print("Tag deleted.") - - def request_side_tag(self): -- tag_info = self.cmd.request_side_tag(base_tag=self.args.base_tag) -+ tag_info = self.cmd.request_side_tag( -+ base_tag=self.args.base_tag, suffix=self.args.suffix -+ ) - print("Side tag '%(name)s' (id %(id)d) created." % tag_info) - print("Use '%s build --target=%s' to use it." % (self.name, tag_info["name"])) - print( -diff --git a/tests/test_side_tag.py b/tests/test_side_tag.py -index e4dbe3a..8507062 100644 ---- a/tests/test_side_tag.py -+++ b/tests/test_side_tag.py -@@ -83,6 +83,23 @@ class RequestSideTagTestCase(BaseCase): - - self.assertIn("a problem", str(ctx.exception)) - -+ def test_suffix(self): -+ cli = self.new_cli( -+ ["request-side-tag", "--base-tag=f30-build", "--suffix=stack-gate"] -+ ) -+ cli.cmd._kojisession.createSideTag.return_value = {"name": "side", "id": 123} -+ with mock.patch("sys.stdout", new_callable=StringIO) as mock_out: -+ cli.request_side_tag() -+ -+ output = mock_out.getvalue() -+ self.assertIn("Side tag 'side' (id 123) created.", output) -+ self.assertIn("Use 'rpkg build --target=side' to use it.", output) -+ -+ self.assertEqual( -+ cli.cmd._kojisession.createSideTag.call_args_list, -+ [mock.call("f30-build", suffix="stack-gate")], -+ ) -+ - - class ListSideTagTestCase(BaseCase): - def test_list_all(self): --- -2.30.2 - diff --git a/0004-Skip-NVR-check-if-the-autorelease-macro-is-used.patch b/0004-Skip-NVR-check-if-the-autorelease-macro-is-used.patch deleted file mode 100644 index 307cd3e..0000000 --- a/0004-Skip-NVR-check-if-the-autorelease-macro-is-used.patch +++ /dev/null @@ -1,149 +0,0 @@ -From 215d809233446c29646ca34dd860cb59b07642db Mon Sep 17 00:00:00 2001 -From: Nils Philippsen -Date: Thu, 27 May 2021 13:29:58 +0200 -Subject: [PATCH 1/2] Don't access unset variable - -If an exception happens, `err` can't be set. Only log the attempted -command instead. - -Signed-off-by: Nils Philippsen ---- - pyrpkg/__init__.py | 6 ++---- - 1 file changed, 2 insertions(+), 4 deletions(-) - -diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py -index a559fd6..3622e7a 100644 ---- a/pyrpkg/__init__.py -+++ b/pyrpkg/__init__.py -@@ -694,10 +694,8 @@ class Commands(object): - stderr=subprocess.PIPE) - output, err = proc.communicate() - except Exception as e: -- if err: -- self.log.debug('Errors occoured while running following command to get N-V-R-E:') -- self.log.debug(joined_cmd) -- self.log.error(err) -+ self.log.debug('Errors occoured while running following command to get N-V-R-E:') -+ self.log.debug(joined_cmd) - raise rpkgError('Could not query n-v-r of %s: %s' - % (self.repo_name, e)) - if err: --- -2.31.1 - - -From 6a568d704601eb271685db3d4789657686252bc4 Mon Sep 17 00:00:00 2001 -From: Nils Philippsen -Date: Tue, 20 Apr 2021 18:29:15 +0200 -Subject: [PATCH 2/2] Skip NVR check if the %autorelease macro is used - -If a spec file sets the release field to the %autorelease macro, don't -even attempt to check if the build exists already, as using the macro -ensures that a new release number is used. - -Fixes: https://pagure.io/fedora-infra/rpmautospec/issue/109 - -Signed-off-by: Nils Philippsen ---- - pyrpkg/__init__.py | 33 ++++++++++++++++++++++++++++----- - tests/test_cli.py | 5 ++++- - 2 files changed, 32 insertions(+), 6 deletions(-) - -diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py -index 3622e7a..8f10957 100644 ---- a/pyrpkg/__init__.py -+++ b/pyrpkg/__init__.py -@@ -67,6 +67,11 @@ else: - # The SafeConfigParser class has been renamed to ConfigParser in Python 3.2. - ConfigParser = configparser.ConfigParser - -+try: -+ from rpmautospec import specfile_uses_rpmautospec -+except ImportError: -+ specfile_uses_rpmautospec = None -+ - - class NullHandler(logging.Handler): - """Null logger to avoid spurious messages, add a handler in app code""" -@@ -156,6 +161,8 @@ class Commands(object): - self._nvr = None - # The rpm release of the cloned package - self._rel = None -+ # Whether the spec file uses %autorelease -+ self._uses_autorelease = None - # The cloned repo object - self._repo = None - # The rpm defines used when calling rpm -@@ -672,20 +679,36 @@ class Commands(object): - @property - def rel(self): - """This property ensures the rel attribute""" -- if not self._rel: -+ if self._rel is None: - self.load_nameverrel() - return(self._rel) - -+ @property -+ def uses_autorelease(self): -+ if self._uses_autorelease is None: -+ self.load_nameverrel() -+ return self._uses_autorelease -+ - def load_nameverrel(self): - """Set the release of a package.""" - -+ specfile_path = os.path.join(self.path, self.spec) -+ -+ if specfile_uses_rpmautospec: -+ self._uses_autorelease = specfile_uses_rpmautospec( -+ specfile_path, check_autorelease=True, check_autochangelog=False -+ ) -+ else: -+ # Set to 0 so it evaluates false-ish but differs from (unset) None. -+ self._uses_autorelease = 0 -+ - cmd = ['rpm'] - cmd.extend(self.rpmdefines) - # We make sure there is a space at the end of our query so that - # we can split it later. When there are subpackages, we get a - # listing for each subpackage. We only care about the first. - cmd.extend(['-q', '--qf', '"??%{NAME} %{EPOCH} %{VERSION} %{RELEASE}??"', -- '--specfile', '"%s"' % os.path.join(self.path, self.spec)]) -+ '--specfile', '"%s"' % specfile_path]) - joined_cmd = ' '.join(cmd) - try: - proc = subprocess.Popen(joined_cmd, shell=True, -@@ -2273,9 +2296,9 @@ class Commands(object): - ' in following messages.') - build_reference = self.repo_name - -- # see if this build has been done. Does not check builds within -- # a chain -- if nvr_check and not scratch and not url.endswith('.src.rpm'): -+ # See if this build has been done. Does not check builds within -+ # a chain, or if the %autorelease macro is used. -+ if (nvr_check or self.uses_autorelease) and not scratch and not url.endswith('.src.rpm'): - build = self.kojisession.getBuild(self.nvr) - if build: - if build['state'] == 1: -diff --git a/tests/test_cli.py b/tests/test_cli.py -index 0fda4f1..66144f7 100644 ---- a/tests/test_cli.py -+++ b/tests/test_cli.py -@@ -3617,9 +3617,12 @@ class TestBuildPackage(FakeKojiCreds, CliTestCase): - commithash.return_value = '45678' - nvr.return_value = 'docpkg-0.1-1.fc28' - -- Popen.return_value.communicate.side_effect = [ -+ proc = Popen.return_value -+ proc.communicate.side_effect = [ - ('12345', ''), -+ ('??docpkg (none) 1.2 2.el7??', ''), - ] -+ proc.returncode = 0 - - self.assert_build( - 'chain-build', --- -2.31.1 - diff --git a/0005-Preprocess-spec-files-using-rpmautospec-features.patch b/0005-Preprocess-spec-files-using-rpmautospec-features.patch deleted file mode 100644 index 859b825..0000000 --- a/0005-Preprocess-spec-files-using-rpmautospec-features.patch +++ /dev/null @@ -1,352 +0,0 @@ -From 3826ee826c06e849d99c2a3a54ba9ec1f29a0de5 Mon Sep 17 00:00:00 2001 -From: Nils Philippsen -Date: Tue, 6 Jul 2021 16:18:06 +0200 -Subject: [PATCH 1/5] Fix remaining Python3 SafeConfigParser warnings - -Signed-off-by: Nils Philippsen ---- - bin/rpkg | 7 ++++++- - tests/test_retire.py | 7 ++++++- - 2 files changed, 12 insertions(+), 2 deletions(-) - -diff --git a/bin/rpkg b/bin/rpkg -index 363a011..26cf0d2 100755 ---- a/bin/rpkg -+++ b/bin/rpkg -@@ -15,6 +15,7 @@ import logging - import os - import sys - -+import six - from six.moves import configparser - - import pyrpkg -@@ -34,7 +35,11 @@ if not os.path.exists(args.config) and not other[-1] in ['--help', '-h']: - sys.exit(1) - - # Setup a configuration object and read config file data --config = configparser.SafeConfigParser() -+if six.PY2: -+ config = configparser.SafeConfigParser() -+else: -+ # The SafeConfigParser class has been renamed to ConfigParser in Python 3.2. -+ config = configparser.ConfigParser() - config.read(args.config) - - client = pyrpkg.cli.cliClient(config) -diff --git a/tests/test_retire.py b/tests/test_retire.py -index 02c6976..3f68a2a 100644 ---- a/tests/test_retire.py -+++ b/tests/test_retire.py -@@ -6,6 +6,7 @@ import subprocess - import tempfile - - import mock -+import six - from six.moves import configparser - - import pyrpkg.cli -@@ -52,7 +53,11 @@ class RetireTestCase(unittest.TestCase): - return out.strip() - - def _fake_client(self, args): -- config = configparser.SafeConfigParser() -+ if six.PY2: -+ config = configparser.SafeConfigParser() -+ else: -+ # The SafeConfigParser class has been renamed to ConfigParser in Python 3.2. -+ config = configparser.ConfigParser() - config.read(TEST_CONFIG) - with mock.patch('sys.argv', new=args): - client = pyrpkg.cli.cliClient(config, name='rpkg') --- -2.31.1 - - -From 6fad855280aabe5c3091137486094cf4e77e41d5 Mon Sep 17 00:00:00 2001 -From: Nils Philippsen -Date: Tue, 15 Jun 2021 19:04:13 +0200 -Subject: [PATCH 2/5] Detect generic use of rpmautospec features - -Signed-off-by: Nils Philippsen ---- - pyrpkg/__init__.py | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py -index 55ec8a1..2376990 100644 ---- a/pyrpkg/__init__.py -+++ b/pyrpkg/__init__.py -@@ -161,6 +161,8 @@ class Commands(object): - self._rel = None - # Whether the spec file uses %autorelease - self._uses_autorelease = None -+ # Whether the spec file uses rpmautospec features (at all) -+ self._uses_rpmautospec = None - # The cloned repo object - self._repo = None - # The rpm defines used when calling rpm -@@ -646,6 +648,12 @@ class Commands(object): - self.load_nameverrel() - return self._uses_autorelease - -+ @property -+ def uses_rpmautospec(self): -+ if self._uses_rpmautospec is None: -+ self.load_nameverrel() -+ return self._uses_rpmautospec -+ - def load_nameverrel(self): - """Set the release of a package.""" - -@@ -655,9 +663,11 @@ class Commands(object): - self._uses_autorelease = specfile_uses_rpmautospec( - specfile_path, check_autorelease=True, check_autochangelog=False - ) -+ self._uses_rpmautospec = specfile_uses_rpmautospec(specfile_path) - else: - # Set to 0 so it evaluates false-ish but differs from (unset) None. - self._uses_autorelease = 0 -+ self._uses_rpmautospec = 0 - - cmd = ['rpm'] - cmd.extend(self.rpmdefines) --- -2.31.1 - - -From 938d5bdfc0d7c032b20e5da3325f0d93bdb5c4c8 Mon Sep 17 00:00:00 2001 -From: Nils Philippsen -Date: Tue, 15 Jun 2021 19:05:40 +0200 -Subject: [PATCH 3/5] Preprocess spec files using rpmautospec features - -If spec files use rpmautospec features, preprocess them into a temporary -directory and point rpmbuild at the pre-processed spec file. - -Signed-off-by: Nils Philippsen ---- - pyrpkg/__init__.py | 55 ++++++++++++++++++++++++++++++++++------------ - 1 file changed, 41 insertions(+), 14 deletions(-) - -diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py -index 2376990..1ede227 100644 ---- a/pyrpkg/__init__.py -+++ b/pyrpkg/__init__.py -@@ -72,6 +72,11 @@ try: - except ImportError: - specfile_uses_rpmautospec = None - -+try: -+ from rpmautospec import process_distgit as rpmautospec_process_distgit -+except ImportError: -+ rpmautospec_process_distgit = None -+ - - class NullHandler(logging.Handler): - """Null logger to avoid spurious messages, add a handler in app code""" -@@ -2585,19 +2590,30 @@ class Commands(object): - % hashtype, - "--define '_binary_filedigest_algorithm %s'" - % hashtype]) -- cmd.extend(['-ba', os.path.join(self.path, self.spec)]) -- logfile = '.build-%s-%s.log' % (self.ver, self.rel) -- -- cmd = '%s 2>&1 | tee %s' % (' '.join(cmd), logfile) -+ specpath = os.path.join(self.path, self.spec) -+ tmpdir = None - try: -- # Since zsh is a widely used, which is supported by fedpkg -- # actually, pipestatus is for checking the first command when zsh -- # is used. -- subprocess.check_call( -- '%s; exit "${PIPESTATUS[0]} ${pipestatus[1]}"' % cmd, -- shell=True) -- except subprocess.CalledProcessError: -- raise rpkgError(cmd) -+ if not self.uses_rpmautospec or not rpmautospec_process_distgit: -+ cmd.extend(['-ba', specpath]) -+ else: -+ tmpdir = tempfile.mkdtemp(prefix="rpkg-rpmautospec") -+ tmpspecpath = os.path.join(tmpdir, self.spec) -+ rpmautospec_process_distgit(specpath, tmpspecpath) -+ cmd.extend(['-ba', tmpspecpath]) -+ logfile = '.build-%s-%s.log' % (self.ver, self.rel) -+ -+ cmd = '%s 2>&1 | tee %s' % (' '.join(cmd), logfile) -+ try: -+ # Since zsh is a widely used, which is supported by fedpkg -+ # actually, pipestatus is for checking the first command when zsh -+ # is used. -+ subprocess.check_call( -+ '%s; exit "${PIPESTATUS[0]} ${pipestatus[1]}"' % cmd, -+ shell=True) -+ except subprocess.CalledProcessError: -+ raise rpkgError(cmd) -+ finally: -+ self._cleanup_tmp_dir(tmpdir) - - # Not to be confused with mockconfig the property - def mock_config(self, target=None, arch=None): -@@ -2960,8 +2976,19 @@ class Commands(object): - % hashtype, - "--define '_binary_filedigest_algorithm %s'" - % hashtype]) -- cmd.extend(['--nodeps', '-bs', os.path.join(self.path, self.spec)]) -- self._run_command(cmd, shell=True) -+ specpath = os.path.join(self.path, self.spec) -+ tmpdir = None -+ try: -+ if not self.uses_rpmautospec or not rpmautospec_process_distgit: -+ cmd.extend(['--nodeps', '-bs', specpath]) -+ else: -+ tmpdir = tempfile.mkdtemp(prefix="rpkg-rpmautospec") -+ tmpspecpath = os.path.join(tmpdir, self.spec) -+ rpmautospec_process_distgit(specpath, tmpspecpath) -+ cmd.extend(['--nodeps', '-bs', tmpspecpath]) -+ self._run_command(cmd, shell=True) -+ finally: -+ self._cleanup_tmp_dir(tmpdir) - - def unused_patches(self): - """Discover patches checked into source control that are not used --- -2.31.1 - - -From 7edb51c2e7d3c5582bea5e7123a2f2e3bb5f3d9c Mon Sep 17 00:00:00 2001 -From: Nils Philippsen -Date: Wed, 16 Jun 2021 13:17:30 +0200 -Subject: [PATCH 4/5] Reflect %autorelease when parsing spec files - -If the %autorelease macro is used, calculate the release number and pass -it to the macro when parsing the spec file. - -Signed-off-by: Nils Philippsen ---- - pyrpkg/__init__.py | 10 ++++++++-- - 1 file changed, 8 insertions(+), 2 deletions(-) - -diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py -index 1ede227..a7d834d 100644 ---- a/pyrpkg/__init__.py -+++ b/pyrpkg/__init__.py -@@ -74,8 +74,10 @@ except ImportError: - - try: - from rpmautospec import process_distgit as rpmautospec_process_distgit -+ from rpmautospec import calculate_release_number as rpmautospec_calculate_release_number - except ImportError: - rpmautospec_process_distgit = None -+ rpmautospec_calculate_release_number = None - - - class NullHandler(logging.Handler): -@@ -662,6 +664,9 @@ class Commands(object): - def load_nameverrel(self): - """Set the release of a package.""" - -+ cmd = ['rpm'] -+ cmd.extend(self.rpmdefines) -+ - specfile_path = os.path.join(self.path, self.spec) - - if specfile_uses_rpmautospec: -@@ -669,13 +674,14 @@ class Commands(object): - specfile_path, check_autorelease=True, check_autochangelog=False - ) - self._uses_rpmautospec = specfile_uses_rpmautospec(specfile_path) -+ if self._uses_rpmautospec and rpmautospec_calculate_release_number: -+ release_number = rpmautospec_calculate_release_number(specfile_path) -+ cmd.append("--define '_rpmautospec_release_number %d'" % release_number) - else: - # Set to 0 so it evaluates false-ish but differs from (unset) None. - self._uses_autorelease = 0 - self._uses_rpmautospec = 0 - -- cmd = ['rpm'] -- cmd.extend(self.rpmdefines) - # We make sure there is a space at the end of our query so that - # we can split it later. When there are subpackages, we get a - # listing for each subpackage. We only care about the first. --- -2.31.1 - - -From fb9876cda299f7f5fb9788488d28d2f5052d878e Mon Sep 17 00:00:00 2001 -From: Nils Philippsen -Date: Tue, 6 Jul 2021 17:05:02 +0200 -Subject: [PATCH 5/5] Add and augment tests for rpmautospec - -Signed-off-by: Nils Philippsen ---- - tests/test_commands.py | 37 +++++++++++++++++++++++++++++++++++++ - 1 file changed, 37 insertions(+) - -diff --git a/tests/test_commands.py b/tests/test_commands.py -index 57b3bc8..2575dc6 100644 ---- a/tests/test_commands.py -+++ b/tests/test_commands.py -@@ -74,9 +74,20 @@ class LoadNameVerRelTest(CommandTestCase): - self.cmd = self.make_commands() - self.checkout_branch(self.cmd.repo, 'eng-rhel-6') - self.tempdir = tempfile.mkdtemp(prefix='rpkg_test_') -+ self._patchers = { -+ name: patch("pyrpkg.%s" % name) for name in ( -+ "specfile_uses_rpmautospec", -+ "rpmautospec_process_distgit", -+ "rpmautospec_calculate_release_number", -+ ) -+ } -+ self.mocks = {name: patcher.start() for name, patcher in self._patchers.items()} -+ self.mocks["specfile_uses_rpmautospec"].return_value = False - - def tearDown(self): - super(LoadNameVerRelTest, self).tearDown() -+ for patcher in self._patchers.values(): -+ patcher.stop() - shutil.rmtree(self.tempdir) - - def test_load_from_spec(self): -@@ -118,6 +129,8 @@ class LoadNameVerRelTest(CommandTestCase): - self.assertEqual('0', cmd._epoch) - self.assertEqual('1.2', cmd._ver) - self.assertEqual('2.el6', cmd._rel) -+ self.assertIs(False, cmd._uses_autorelease) -+ self.assertIs(False, cmd._uses_rpmautospec) - - @patch('pyrpkg.Commands.load_rpmdefines', new=mock_load_rpmdefines) - @patch('pyrpkg.Commands.load_spec', -@@ -145,6 +158,30 @@ class LoadNameVerRelTest(CommandTestCase): - self.assertEqual('1.2', self.cmd._ver) - self.assertEqual('2.el6', self.cmd._rel) - -+ @patch("pyrpkg.specfile_uses_rpmautospec", new=None) -+ @patch("pyrpkg.rpmautospec_process_distgit", new=None) -+ @patch("pyrpkg.rpmautospec_calculate_release_number", new=None) -+ def test_load_with_rpmautospec_pkg_missing(self): -+ self.cmd.load_nameverrel() -+ self.assertIs(0, self.cmd._uses_autorelease) -+ self.assertIs(0, self.cmd._uses_rpmautospec) -+ -+ @patch("subprocess.Popen", wraps=subprocess.Popen) -+ def test_load_with_rpmautospec(self, wrapped_popen): -+ test_release_number = 123 -+ -+ self.mocks["specfile_uses_rpmautospec"].return_value = True -+ self.mocks["rpmautospec_process_distgit"].return_value = True -+ self.mocks["rpmautospec_calculate_release_number"].return_value = test_release_number -+ -+ self.cmd.load_nameverrel() -+ -+ self.assertIs(True, self.cmd._uses_autorelease) -+ self.assertIs(True, self.cmd._uses_rpmautospec) -+ self.assertEqual(1, wrapped_popen.call_count) -+ args, kwargs = wrapped_popen.call_args -+ self.assertIn("--define '_rpmautospec_release_number %d'" % test_release_number, args[0]) -+ - - class LoadBranchMergeTest(CommandTestCase): - """Test case for testing Commands.load_branch_merge""" --- -2.31.1 - diff --git a/remove-koji-and-rpm-py-installer-from-requires.patch b/remove-koji-and-rpm-py-installer-from-requires.patch index fd4188f..90adee0 100644 --- a/remove-koji-and-rpm-py-installer-from-requires.patch +++ b/remove-koji-and-rpm-py-installer-from-requires.patch @@ -1,19 +1,20 @@ -From fe994884ad31feece96ccc05f1b1aa10c067ab94 Mon Sep 17 00:00:00 2001 -From: Ondrej Nosek -Date: Fri, 26 Apr 2019 21:38:06 +0200 -Subject: [PATCH] remove koji and rpm-py-installer from requires +From ec0c8b368fd560b319c6603f35dda803fe4b2e99 Mon Sep 17 00:00:00 2001 +From: Dominik Rumian +Date: Tue, 24 Aug 2021 12:51:17 +0200 +Subject: [PATCH] [PATCH] remove koji and rpm-py-installer from requires +Signed-off-by: Dominik Rumian --- setup.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/setup.py b/setup.py -index e29a640..a96e972 100755 +index 9c6d881..8c92aae 100755 --- a/setup.py +++ b/setup.py -@@ -44,6 +44,11 @@ if ver[0] <= 2 and ver[1] < 7: - 'unittest2' - ] +@@ -34,6 +34,11 @@ install_requires, dep_links = read_requirements(pypi_txt) + tests_require, test_dep_links = read_requirements(test_pypi_txt) + dep_links += test_dep_links +install_requires = [ + item for item in install_requires @@ -24,5 +25,5 @@ index e29a640..a96e972 100755 with open(readme_rst, 'r') as readme: long_description = readme.read().rstrip() -- -2.20.1 +2.31.1 diff --git a/rpkg.spec b/rpkg.spec index e772df1..6e68f2a 100644 --- a/rpkg.spec +++ b/rpkg.spec @@ -1,6 +1,6 @@ Name: rpkg -Version: 1.62 -Release: 7%{?dist} +Version: 1.63 +Release: 1%{?dist} Summary: Python library for interacting with rpm+git License: GPLv2+ and LGPLv2 @@ -18,10 +18,7 @@ Source0: https://pagure.io/releases/rpkg/%{name}-%{version}.tar.gz # remove rpm-py-installer for now. Patch0: remove-koji-and-rpm-py-installer-from-requires.patch Patch1: 0001-Do-not-use-pytest-related-dependencies-temporarily.patch -Patch2: 0002-ca-cert-was-removed-on-koji-1.24.0.patch -Patch3: 0003-Add-support-for-side-tag-suffix.patch -Patch4: 0004-Skip-NVR-check-if-the-autorelease-macro-is-used.patch -Patch5: 0005-Preprocess-spec-files-using-rpmautospec-features.patch +Patch2: 0002-Use-six-library-in-tests.patch # RHEL7 is currently the only release that is built for Python 2. %if 0%{?fedora} || 0%{?rhel} > 7 @@ -241,6 +238,46 @@ example_cli_dir=$RPM_BUILD_ROOT%{_datadir}/%{name}/examples/cli %changelog +* Tue Aug 24 2021 Dominik Rumian - 1.63-1 +- Do not download unused sources during command 'sources' - #559 (oturpe) +- Added 'x-pkg verrel' for containers - #547 (jkunstle) +- container-build: improve help text for --signing-intent argument (kdreyer) +- Make sure all commits have a proper subject (sgallagh) +- Fix unittest for previous commit (onosek) +- better new-sources output when all sources already exist Fixes: #533 JIRA: + RHELCMP-5529 (drumian) +- Added 'remote' to rpkg from rhpkg - 439 (jkunstle) +- Add --offline cli argument for new-sources (oturpe) +- Tests: Fix setting branch name with old git (nils) +- Add and augment tests for rpmautospec (nils) +- Reflect %autorelease when parsing spec files (nils) +- Preprocess spec files using rpmautospec features (nils) +- Detect generic use of rpmautospec features (nils) +- Fix remaining Python3 SafeConfigParser warnings (nils) +- Tests: specify branch name on `git init` (nils) +- Remove leftover deprecated arguments (abisoi) +- Remove deprecated arguments --dist and --module-name (abisoi) +- Skip NVR check if the %autorelease macro is used - 109 (nils) +- Don't access unset variable (nils) +- Improve help in fedpkg clone command - #367 (abisoi) +- Fix rpkg container-build ignoring values when same argument is specified + multiple times - #537 (abisoi) +- list-side-tags: show creator of the tag - 358 (onosek) +- Drop Python 2.6 support (onosek) +- Enable flatpak tests that require libmodulemd (onosek) +- Added .rpmlintrc to the list of files ignored by fedpkg import + - rhbz#1946688 (abisoi) +- Jenkins unittests run in docker container (onosek) +- Add support for side tag suffix (lsedlar) +- Check whether sources file is not a directory - #541 (onosek) +- Add config option for writing dist-git build results to a subdirectory + (oturpe) +- ca cert was removed on koji-1.24.0 (sergio) +- Improve automatic test suite (oturpe) +- Better hint when running 'prep' on detached branch - rhbz#1907964 (onosek) +- Update description of the clean command - rhbz#1909461 (onosek) +- Add --skip-nvr-check to the scratch-build command - rhbz#1671012 (onosek) + * Fri Jul 23 2021 Fedora Release Engineering - 1.62-7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild diff --git a/sources b/sources index 50c86e7..699f2cf 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (rpkg-1.62.tar.gz) = 7d661a5289cad131917dfaa8c744222b2b57dbd3bfff110ee5dd64cd406f64545d8924ddeb505d78d558696c7d6840a88a4e77d6aa920a0c6b33d9939f05ca24 +SHA512 (rpkg-1.63.tar.gz) = 60d276404a585b760edd3e306873e12843c656f3ba80962b198c804bad0d773125cc38878bb8e51e3581ee2f6407409cfb9ec452da1efb859354695d20442892