public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
To: git-commits@fedoraproject.org
Subject: [rpms/rpkg] 1.70-1: Allow using namespace in --module-name
Date: Mon, 10 Aug 2026 21:43:44 GMT	[thread overview]
Message-ID: <178639822479.1.7392057953170080442.rpms-rpkg-31f7c36d749f@fedoraproject.org> (raw)

A new commit has been pushed.

Repo   : rpms/rpkg
Branch : 1.70-1
Commit : 31f7c36d749fa14555735875c42e187806b9eeec
Author : Lubomír Sedlář <lsedlar@redhat.com>
Date   : 2017-06-29T13:56:05+02:00
Stats  : +134/-1 in 3 file(s)
URL    : https://src.fedoraproject.org/rpms/rpkg/c/31f7c36d749fa14555735875c42e187806b9eeec?branch=1.70-1

Log:
Allow using namespace in --module-name

---
diff --git a/0001-Make-module-name-work-with-namespaces.patch b/0001-Make-module-name-work-with-namespaces.patch
new file mode 100644
index 0000000..87eafa2
--- /dev/null
+++ b/0001-Make-module-name-work-with-namespaces.patch
@@ -0,0 +1,47 @@
+From 913b547a0df8433924531739506e1b8975e50b8b Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= <lsedlar@redhat.com>
+Date: Wed, 17 May 2017 15:30:45 +0200
+Subject: [PATCH 1/3] Make --module-name work with namespaces
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Allow the user to specify module name including a namespace, and when no
+namespace is included, assume 'rpms'.
+
+Fixes: #216
+Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
+---
+ pyrpkg/cli.py | 16 +++++++++++++++-
+ 1 file changed, 15 insertions(+), 1 deletion(-)
+
+diff --git a/pyrpkg/cli.py b/pyrpkg/cli.py
+index 7395fd1..856883a 100644
+--- a/pyrpkg/cli.py
++++ b/pyrpkg/cli.py
+@@ -138,7 +138,21 @@ class cliClient(object):
+                                        realms=realms
+                                        )
+ 
+-        self._cmd.module_name = self.args.module_name
++        if self.args.module_name:
++            # Module name was specified via argument
++            if '/' not in self.args.module_name:
++                # No slash, assume rpms namespace
++                self._cmd.module_name = self.args.module_name
++                self._cmd.ns_module_name = 'rpms/%s' % self.args.module_name
++            else:
++                self._cmd.ns_module_name = self.args.module_name
++                try:
++                    _, self._cmd.module_name = self.args.module_name.split('/')
++                    # Exactly one slash, let's continue on
++                except ValueError:
++                    # Too many segments, report an error
++                    self.parser.error('Argument to --module-name can contain '
++                                      'at most one / character')
+         self._cmd.password = self.args.password
+         self._cmd.runas = self.args.runas
+         self._cmd.debug = self.args.debug
+-- 
+2.9.4
+

diff --git a/0003-Allow-explicit-namespaces-with-slashes.patch b/0003-Allow-explicit-namespaces-with-slashes.patch
new file mode 100644
index 0000000..b862523
--- /dev/null
+++ b/0003-Allow-explicit-namespaces-with-slashes.patch
@@ -0,0 +1,79 @@
+From 9b2c92ad7a58eefffffcdf35e564993d196b9966 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= <lsedlar@redhat.com>
+Date: Thu, 18 May 2017 15:02:33 +0200
+Subject: [PATCH 3/3] Allow explicit namespaces with slashes
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+COPR uses module names in the form of user/project/package, so their
+namespaces contain multiple slashes.
+
+Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
+---
+ pyrpkg/cli.py     |  8 +-------
+ tests/test_cli.py | 29 +++++++++++++++++++++++++++++
+ 2 files changed, 30 insertions(+), 7 deletions(-)
+
+diff --git a/pyrpkg/cli.py b/pyrpkg/cli.py
+index 856883a..34512a9 100644
+--- a/pyrpkg/cli.py
++++ b/pyrpkg/cli.py
+@@ -146,13 +146,7 @@ class cliClient(object):
+                 self._cmd.ns_module_name = 'rpms/%s' % self.args.module_name
+             else:
+                 self._cmd.ns_module_name = self.args.module_name
+-                try:
+-                    _, self._cmd.module_name = self.args.module_name.split('/')
+-                    # Exactly one slash, let's continue on
+-                except ValueError:
+-                    # Too many segments, report an error
+-                    self.parser.error('Argument to --module-name can contain '
+-                                      'at most one / character')
++                _, self._cmd.module_name = self.args.module_name.rsplit('/', 1)
+         self._cmd.password = self.args.password
+         self._cmd.runas = self.args.runas
+         self._cmd.debug = self.args.debug
+diff --git a/tests/test_cli.py b/tests/test_cli.py
+index 29b1e2e..126b59b 100644
+--- a/tests/test_cli.py
++++ b/tests/test_cli.py
+@@ -68,6 +68,35 @@ class CliTestCase(CommandTestCase):
+             map(lambda cmd: self.run_cmd(cmd, cwd=repo_path), cmds)
+ 
+ 
++class TestModuleNameOption(CliTestCase):
++
++    def get_cmd(self, module_name):
++        cmd = ['rpkg', '--path', self.cloned_repo_path, '--module-name', module_name, 'verrel']
++        with patch('sys.argv', new=cmd):
++            cli = self.new_cli()
++        return cli.cmd
++
++    def test_just_module_name(self):
++        cmd = self.get_cmd('foo')
++        self.assertEqual(cmd._module_name, 'foo')
++        self.assertEqual(cmd._ns_module_name, 'rpms/foo')
++
++    def test_explicit_default(self):
++        cmd = self.get_cmd('rpms/foo')
++        self.assertEqual(cmd._module_name, 'foo')
++        self.assertEqual(cmd._ns_module_name, 'rpms/foo')
++
++    def test_with_namespace(self):
++        cmd = self.get_cmd('container/foo')
++        self.assertEqual(cmd._module_name, 'foo')
++        self.assertEqual(cmd._ns_module_name, 'container/foo')
++
++    def test_with_nested_namespace(self):
++        cmd = self.get_cmd('user/project/foo')
++        self.assertEqual(cmd._module_name, 'foo')
++        self.assertEqual(cmd._ns_module_name, 'user/project/foo')
++
++
+ class TestClog(CliTestCase):
+ 
+     def setUp(self):
+-- 
+2.9.4
+

diff --git a/rpkg.spec b/rpkg.spec
index 562bc4f..7e97871 100644
--- a/rpkg.spec
+++ b/rpkg.spec
@@ -3,7 +3,7 @@
 
 Name:           rpkg
 Version:        1.49
-Release:        4%{?dist}
+Release:        5%{?dist}
 
 Summary:        Python library for interacting with rpm+git
 License:        GPLv2+ and LGPLv2
@@ -11,6 +11,8 @@ URL:            https://pagure.io/rpkg
 Source0:        https://pagure.io/releases/rpkg/%{name}-%{version}.tar.gz
 Patch0:         0001-make-osbs-dependency-optional.patch
 Patch1:         0002-Make-osbs-support-optional.patch
+Patch2:         0001-Make-module-name-work-with-namespaces.patch
+Patch3:         0003-Allow-explicit-namespaces-with-slashes.patch
 BuildArch:      noarch
 
 Requires:       mock
@@ -70,6 +72,8 @@ A python library for managing RPM package sources in a git repository.
 %setup -q
 %patch0 -p1
 %patch1 -p1
+%patch2 -p1
+%patch3 -p1
 
 
 %build
@@ -109,6 +113,9 @@ rm -rf $RPM_BUILD_ROOT
 %{_datadir}/%{name}
 
 %changelog
+* Thu Jun 29 2017 Lubomír Sedlář <lsedlar@redhat.com> - 1.49-5
+- Allow using namespace in --module-name attribute
+
 * Thu Jun 22 2017 Chenxiong Qi <cqi@redhat.com> - 1.49-4
 - Remove python-osbs-client
 

                 reply	other threads:[~2026-08-10 21:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178639822479.1.7392057953170080442.rpms-rpkg-31f7c36d749f@fedoraproject.org \
    --to=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox