public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
To: git-commits@fedoraproject.org
Subject: [rpms/fedpkg] 1.48-1: Patch: Improve invalid branch name error message
Date: Mon, 10 Aug 2026 21:46:07 GMT [thread overview]
Message-ID: <178639836729.1.4093282232279314458.rpms-fedpkg-fac437bc5fb0@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : rpms/fedpkg
Branch : 1.48-1
Commit : fac437bc5fb02f1034c6be801e2a05a5d7c173ed
Author : Ondřej Nosek <onosek@redhat.com>
Date : 2023-04-28T12:20:22+00:00
Stats : +89/-5 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/fedpkg/c/fac437bc5fb02f1034c6be801e2a05a5d7c173ed?branch=1.48-1
Log:
Patch: Improve invalid branch name error message
Signed-off-by: Ondřej Nosek <onosek@redhat.com>
---
diff --git a/0005-Improve-invalid-branch-name-error-message.patch b/0005-Improve-invalid-branch-name-error-message.patch
new file mode 100644
index 0000000..7349b1b
--- /dev/null
+++ b/0005-Improve-invalid-branch-name-error-message.patch
@@ -0,0 +1,80 @@
+From 6a381fd9cabcf9bc86efe8761f818ae00ae39bdc Mon Sep 17 00:00:00 2001
+From: Otto Liljalaakso <otto.liljalaakso@iki.fi>
+Date: Fri, 21 Apr 2023 12:33:56 +0300
+Subject: [PATCH] Improve invalid branch name error message
+
+Currently, if the resolved release name does not match any supported
+pattern ('rawhide', 'f38' or so), the following error is printed:
+
+ (foo) $ fedpkg prep
+ Could not execute prep: Could not find the release/dist from branch name foo
+ Please specify with --release
+
+This is fine when the current Git branch name was used when resolving
+the release. However, the exact same error is printed even if the
+'--release' option was used, like this:
+
+ $ fedpkg --release foo prep
+ Could not execute prep: Could not find the release/dist from branch name foo
+ Please specify with --release
+
+The error message is split into two cases depending on if --release was
+used (detected by checking if 'self.dist' is truthy):
+
+ (foo) $ fedpkg prep
+ Could not execute prep: Could not find release from branch name 'foo'. Please specify with --release.
+ $ fedpkg --release foo prep
+ Could not execute prep: Invalid release 'foo'.
+
+JIRA: RHELCMP-11465
+Fixes: https://pagure.io/rpkg/issue/671
+Merges: https://pagure.io/fedpkg/pull-request/518
+
+Signed-off-by: Otto Liljalaakso <otto.liljalaakso@iki.fi>
+---
+ fedpkg/__init__.py | 10 +++++++---
+ test/test_cli.py | 5 +++--
+ 2 files changed, 10 insertions(+), 5 deletions(-)
+
+diff --git a/fedpkg/__init__.py b/fedpkg/__init__.py
+index 9973286..b01ca73 100644
+--- a/fedpkg/__init__.py
++++ b/fedpkg/__init__.py
+@@ -138,9 +138,13 @@ class Commands(pyrpkg.Commands):
+ self._distunset = 'rhel'
+ # If we don't match one of the above, punt
+ else:
+- raise pyrpkg.rpkgError('Could not find the release/dist from branch name '
+- '%s\nPlease specify with --release' %
+- self.branch_merge)
++ if self.dist:
++ msg = 'Invalid release \'%s\'.' % self.branch_merge
++ else:
++ msg = ('Could not find release from branch name \'%s\'. '
++ 'Please specify with --release.' % self.branch_merge)
++ raise pyrpkg.rpkgError(msg)
++
+ self._rpmdefines = ["--define", "_sourcedir %s" % self.layout.sourcedir,
+ "--define", "_specdir %s" % self.layout.specdir,
+ "--define", "_builddir %s" % self.layout.builddir,
+diff --git a/test/test_cli.py b/test/test_cli.py
+index ecc279d..e0a1918 100644
+--- a/test/test_cli.py
++++ b/test/test_cli.py
+@@ -2310,10 +2310,11 @@ class TestReadReleasesFromLocalConfig(CliTestCase):
+ @patch('pyrpkg.utils.validate_path')
+ def test_no_config_file_is_create(self, validate_path):
+ error_msg = 'given path \'{0}\' doesn\'t exist'.format(self.cloned_repo_path)
+- validate_path.side_effect=argparse.ArgumentTypeError(error_msg)
++ validate_path.side_effect = argparse.ArgumentTypeError(error_msg)
+ with patch('sys.argv', new=self.fake_cmd):
+ with patch('sys.stderr', new=six.StringIO()):
+- with self.assertRaises(SystemExit): # argparse.ArgumentTypeError turns to SystemExit
++ # argparse.ArgumentTypeError turns to SystemExit
++ with self.assertRaises(SystemExit):
+ self.new_cli()
+ validate_path.assert_called_once_with(self.cloned_repo_path)
+ output = sys.stderr.getvalue().strip()
+--
+2.40.0
+
diff --git a/fedpkg.spec b/fedpkg.spec
index 6493acc..9bcd207 100644
--- a/fedpkg.spec
+++ b/fedpkg.spec
@@ -5,7 +5,7 @@
Name: fedpkg
Version: 1.44
-Release: 3%{?dist}
+Release: 4%{?dist}
Summary: Fedora utility for working with dist-git
License: GPLv2+
@@ -26,6 +26,7 @@ Patch2: 0002-Remove-pytest-coverage-execution.patch
Patch3: 0003-Remove-Environment-Markers-syntax.patch
%endif
Patch4: 0004-Fix-unittests-after-path-argument-is-validated.patch
+Patch5: 0005-Improve-invalid-branch-name-error-message.patch
BuildRequires: pkgconfig
BuildRequires: bash-completion
@@ -40,7 +41,7 @@ Requires: redhat-rpm-config
BuildRequires: python2-devel
# We br these things for man page generation due to imports
-BuildRequires: python2-rpkg >= 1.66-5
+BuildRequires: python2-rpkg >= 1.66-7
BuildRequires: python2-distro
BuildRequires: python2-fedora
# For testing
@@ -54,7 +55,7 @@ BuildRequires: python-bugzilla
Requires: bodhi-client >= 2.0
Requires: python-bugzilla
-Requires: python2-rpkg >= 1.66-5
+Requires: python2-rpkg >= 1.66-7
Requires: python2-distro
Requires: python2-fedora
Requires: python2-openidc-client >= 0.6.0
@@ -66,7 +67,7 @@ Requires: fedora-packager
%global __python %{__python3}
BuildRequires: python3-devel
-BuildRequires: python3-rpkg >= 1.66-5
+BuildRequires: python3-rpkg >= 1.66-7
BuildRequires: python3-distro
BuildRequires: python3-fedora
# For testing
@@ -78,7 +79,7 @@ BuildRequires: python3-bodhi-client
Requires: python3-bugzilla
-Requires: python3-rpkg >= 1.66-5
+Requires: python3-rpkg >= 1.66-7
Requires: python3-distro
Requires: python3-fedora
Requires: python3-openidc-client >= 0.6.0
@@ -148,6 +149,9 @@ mv %{buildroot}%{compdir}/fedpkg.bash %{buildroot}%{compdir}/fedpkg
%changelog
+* Fri Apr 28 2023 Ondřej Nosek <onosek@redhat.com> - 1.44-4
+- Patch: Improve invalid branch name error message
+
* Mon Apr 3 2023 Ondřej Nosek <onosek@redhat.com> - 1.44-3
- Patch: Fix unittests after '--path' argument is validated
reply other threads:[~2026-08-10 21:46 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=178639836729.1.4093282232279314458.rpms-fedpkg-fac437bc5fb0@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