Notification time stamped 2021-11-29 02:18:13 UTC
From fc0d2a16d7b2e8bf056971c78125a8a720348493 Mon Sep 17 00:00:00 2001
From: Ondřej Nosek <onosek(a)redhat.com>
Date: Nov 29 2021 01:44:55 +0000
Subject: Patch: Fixes import fail with sources already imported
Signed-off-by: Ondřej Nosek <onosek(a)redhat.com>
---
diff --git a/0005-Fixes-import-fail-with-sources-already-imported.patch
b/0005-Fixes-import-fail-with-sources-already-imported.patch
new file mode 100644
index 0000000..c80ff60
--- /dev/null
+++ b/0005-Fixes-import-fail-with-sources-already-imported.patch
@@ -0,0 +1,50 @@
+From f1f74e256cde220f04c41d6c86460d64cd3026b2 Mon Sep 17 00:00:00 2001
+From: Dominik Rumian <drumian(a)redhat.com>
+Date: Wed, 15 Sep 2021 12:10:03 +0200
+Subject: [PATCH] Fixes import fail with sources already imported
+
+Fixes: #573
+JIRA: RHELCMP-6481
+
+Signed-off-by: Dominik Rumian <drumian(a)redhat.com>
+---
+ pyrpkg/cli.py | 5 ++++-
+ tests/test_cli.py | 6 +-----
+ 2 files changed, 5 insertions(+), 6 deletions(-)
+
+diff --git a/pyrpkg/cli.py b/pyrpkg/cli.py
+index 6aa8f27..fafada6 100644
+--- a/pyrpkg/cli.py
++++ b/pyrpkg/cli.py
+@@ -2144,7 +2144,10 @@ class cliClient(object):
+ def import_srpm(self):
+ uploadfiles = self.cmd.import_srpm(self.args.srpm)
+ if uploadfiles:
+- self.cmd.upload(uploadfiles, replace=True, offline=self.args.offline)
++ try:
++ self.cmd.upload(uploadfiles, replace=True, offline=self.args.offline)
++ except AlreadyUploadedError:
++ self.log.info("All sources were already uploaded.")
+ if not self.args.skip_diffs:
+ self.cmd.diff(cached=True)
+ self.log.info('--------------------------------------------')
+diff --git a/tests/test_cli.py b/tests/test_cli.py
+index 887917c..90c2067 100644
+--- a/tests/test_cli.py
++++ b/tests/test_cli.py
+@@ -1531,11 +1531,7 @@ class TestImportSrpm(LookasideCacheMock, CliTestCase):
+
+ def test_import(self):
+ self.assert_import_srpm(self.chaos_repo)
+- # 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.
+- six.assertRaisesRegex(self, AlreadyUploadedError, r'File already
uploaded',
+- self.assert_import_srpm, self.cloned_repo_path)
++ 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
+--
+2.31.1
+
diff --git a/rpkg.spec b/rpkg.spec
index f91a0c6..11d1df9 100644
--- a/rpkg.spec
+++ b/rpkg.spec
@@ -1,6 +1,6 @@
Name: rpkg
Version: 1.63
-Release: 3%{?dist}
+Release: 4%{?dist}
Summary: Python library for interacting with rpm+git
License: GPLv2+ and LGPLv2
@@ -21,6 +21,7 @@ Patch1:
0001-Do-not-use-pytest-related-dependencies-temporarily.patch
Patch2: 0002-Use-six-library-in-tests.patch
Patch3: 0003-Pass-sourcedir-to-rpmspec-when-specfile-is-parsed.patch
Patch4: 0004-Print-SpecFile-parsing-debug-info.patch
+Patch5: 0005-Fixes-import-fail-with-sources-already-imported.patch
# RHEL7 is currently the only release that is built for Python 2.
%if 0%{?fedora} || 0%{?rhel} > 7
@@ -244,6 +245,9 @@ example_cli_dir=$RPM_BUILD_ROOT%{_datadir}/%{name}/examples/cli
%changelog
+* Mon Nov 29 2021 Ondřej Nosek <onosek(a)redhat.com> - 1.63-4
+- Patch: Fixes import fail with sources already imported
+
* Mon Sep 13 2021 Ondřej Nosek <onosek(a)redhat.com> - 1.63-3
- Add python-requests-kerberos as a new dependency for RHEL packages
- Patch: Print SpecFile parsing debug info
https://src.fedoraproject.org/rpms/rpkg/c/fc0d2a16d7b2e8bf056971c78125a8a...