public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
To: git-commits@fedoraproject.org
Subject: [rpms/rpkg] 1.70-1: Patch: `fedpkg local` does not show rpmbuild output
Date: Mon, 10 Aug 2026 21:44:29 GMT [thread overview]
Message-ID: <178639826998.1.17369720335160040335.rpms-rpkg-ffb60e839e58@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : rpms/rpkg
Branch : 1.70-1
Commit : ffb60e839e582edaa3d744f756964b06ba579633
Author : Ondřej Nosek <onosek@redhat.com>
Date : 2022-09-07T18:23:24+00:00
Stats : +119/-1 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/rpkg/c/ffb60e839e582edaa3d744f756964b06ba579633?branch=1.70-1
Log:
Patch: `fedpkg local` does not show rpmbuild output
Signed-off-by: Ondřej Nosek <onosek@redhat.com>
---
diff --git a/0004-fedpkg-local-does-not-show-rpmbuild-output.patch b/0004-fedpkg-local-does-not-show-rpmbuild-output.patch
new file mode 100644
index 0000000..30f3e8e
--- /dev/null
+++ b/0004-fedpkg-local-does-not-show-rpmbuild-output.patch
@@ -0,0 +1,114 @@
+From fef9715d4acb690dff1cc9f08545721d69bf208d Mon Sep 17 00:00:00 2001
+From: Ondrej Nosek <onosek@redhat.com>
+Date: Wed, 7 Sep 2022 19:53:05 +0200
+Subject: [PATCH] `fedpkg local` does not show rpmbuild output
+
+subprocess.communicate() method didn't allow a direct pipe output
+to the shell and therefore wasn't shown to the user. Switched to
+check_call method.
+Additionally, the correct exit code is returned when the first part
+of the command fails.
+
+Resolves: rhbz#2124809
+JIRA: RHELCMP-9960
+
+Signed-off-by: Ondrej Nosek <onosek@redhat.com>
+---
+ pyrpkg/__init__.py | 12 +++++-------
+ tests/test_cli.py | 26 ++++++++++++++------------
+ 2 files changed, 19 insertions(+), 19 deletions(-)
+
+diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
+index a672dd2..1b6a0c4 100644
+--- a/pyrpkg/__init__.py
++++ b/pyrpkg/__init__.py
+@@ -2818,14 +2818,12 @@ class Commands(object):
+ stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT
+ )
+- tee = subprocess.Popen(
++ subprocess.check_call(
+ ("tee", logfile),
+- stdin=rpmbuild.stdout,
+- stdout=subprocess.PIPE)
+- rpmbuild.stdout.close()
+- tee.communicate()
+-
+- except subprocess.SubprocessError:
++ stdin=rpmbuild.stdout)
++ rpmbuild.communicate() # without this, 'returncode' is None (=unfinished process)
++ sys.exit(rpmbuild.returncode)
++ except subprocess.CalledProcessError:
+ raise rpkgError(debug_cmd)
+ finally:
+ self._cleanup_tmp_dir(tmpdir)
+diff --git a/tests/test_cli.py b/tests/test_cli.py
+index 254bfac..97ae0ce 100644
+--- a/tests/test_cli.py
++++ b/tests/test_cli.py
+@@ -846,10 +846,12 @@ class TestLocal(CliTestCase):
+
+ create_repo_per_test = False
+
++ @patch('sys.exit')
++ @patch('pyrpkg.subprocess.check_call')
+ @patch('subprocess.Popen')
+ @patch('pyrpkg.Commands.rel')
+ @patch('pyrpkg.Commands.ver')
+- def test_local(self, ver, rel, popen):
++ def test_local(self, ver, rel, popen, check_call, system_exit):
+ cli_cmd = ['rpkg', '--path', self.cloned_repo_path, '--release', 'rhel-6', 'local']
+
+ rel.__str__ = Mock()
+@@ -868,20 +870,21 @@ class TestLocal(CliTestCase):
+ popen.assert_has_calls([
+ # at the beginning of this list, there are other calls from load_nameverrel
+ call(rpmbuild, stdout=-1, stderr=-2),
+- # I can't match this call - stdin=Mock has it's dynamic id. Therefore any_oreder=True
+- # call(tee, stdin=Mock(), stdout=-1), # check call [-3] separately
+- call().stdout.close(),
+ call().communicate(),
+- ], any_order=True)
++ ], any_order=False)
+
+- tee_call_arg = popen.mock_calls[-3]
++ tee_call_arg = check_call.mock_calls[0]
+ if 'args' in dir(tee_call_arg): # doesn't work in <=py36
+ self.assertEqual(tee, tee_call_arg.args[0])
+
++ system_exit.assert_called_once()
++
++ @patch('sys.exit')
++ @patch('pyrpkg.subprocess.check_call')
+ @patch('subprocess.Popen')
+ @patch('pyrpkg.Commands.rel')
+ @patch('pyrpkg.Commands.ver')
+- def test_local_with_options(self, ver, rel, popen):
++ def test_local_with_options(self, ver, rel, popen, check_call, system_exit):
+ builddir = os.path.join(self.cloned_repo_path, 'this-builddir')
+ buildrootdir = os.path.join(self.cloned_repo_path, 'this-buildrootdir')
+
+@@ -913,16 +916,15 @@ class TestLocal(CliTestCase):
+ popen.assert_has_calls([
+ # at the beginning of this list, there are other calls from load_nameverrel
+ call(rpmbuild, stdout=-1, stderr=-2),
+- # I can't match this call - stdin=Mock has it's dynamic id. Therefore any_oreder=True
+- # call(tee, stdin=Mock(), stdout=-1), # check call [-3] separately
+- call().stdout.close(),
+ call().communicate(),
+- ], any_order=True)
++ ], any_order=False)
+
+- tee_call_arg = popen.mock_calls[-3]
++ tee_call_arg = check_call.mock_calls[0]
+ if 'args' in dir(tee_call_arg): # doesn't work in <=py36
+ self.assertEqual(tee, tee_call_arg.args[0])
+
++ system_exit.assert_called_once()
++
+
+ class TestVerifyFiles(CliTestCase):
+
+--
+2.37.2
+
diff --git a/rpkg.spec b/rpkg.spec
index 6731ec3..223f116 100644
--- a/rpkg.spec
+++ b/rpkg.spec
@@ -1,6 +1,6 @@
Name: rpkg
Version: 1.65
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: Python library for interacting with rpm+git
License: GPLv2+ and LGPLv2
@@ -37,6 +37,7 @@ Patch2: 0002-Remove-pytest-coverage-execution.patch
%if 0%{?with_python2}
Patch3: 0003-Remove-Environment-Markers-syntax.patch
%endif
+Patch4: 0004-fedpkg-local-does-not-show-rpmbuild-output.patch
%description
Python library for interacting with rpm+git
@@ -249,6 +250,9 @@ example_cli_dir=$RPM_BUILD_ROOT%{_datadir}/%{name}/examples/cli
%changelog
+* Wed Sep 7 2022 Ondřej Nosek <onosek@redhat.com> - 1.65-2
+- Patch: `fedpkg local` does not show rpmbuild output
+
* Wed Sep 7 2022 Ondřej Nosek <onosek@redhat.com> - 1.65-1
- Extra arguments now use shell-escaping - revert (onosek
- Remove pytest warnings (onosek)
reply other threads:[~2026-08-10 21:44 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=178639826998.1.17369720335160040335.rpms-rpkg-ffb60e839e58@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