summaryrefslogtreecommitdiff
path: root/0021-Do-not-require-sources-file-for-all-namespaces.patch
diff options
context:
space:
mode:
Diffstat (limited to '0021-Do-not-require-sources-file-for-all-namespaces.patch')
-rw-r--r--0021-Do-not-require-sources-file-for-all-namespaces.patch60
1 files changed, 60 insertions, 0 deletions
diff --git a/0021-Do-not-require-sources-file-for-all-namespaces.patch b/0021-Do-not-require-sources-file-for-all-namespaces.patch
new file mode 100644
index 0000000..a4c71aa
--- /dev/null
+++ b/0021-Do-not-require-sources-file-for-all-namespaces.patch
@@ -0,0 +1,60 @@
+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
+