From 26974bf508dc7f5648927da7d84b04ccc98f56e9 Mon Sep 17 00:00:00 2001 From: Aleš Matěj Date: Nov 13 2019 07:57:10 +0000 Subject: Backport patches to revert scriptlets and fix parenthesis (RhBug:1724779) --- diff --git a/0002-Revert-Fix-messages-for-starting-and-failing-scriptlets.patch b/0002-Revert-Fix-messages-for-starting-and-failing-scriptlets.patch new file mode 100644 index 0000000..da645e2 --- /dev/null +++ b/0002-Revert-Fix-messages-for-starting-and-failing-scriptlets.patch @@ -0,0 +1,72 @@ +From d57aa8f75350d3dfde54e419465a1a84ca72e164 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= +Date: Mon, 11 Nov 2019 14:14:32 +0100 +Subject: [PATCH] Revert "Fix messages for starting and failing scriptlets + (RhBug:1724779)" + +This reverts commit 14c0a778def2a8a821177ebb54c9f32787bff11b. +--- + dnf/yum/rpmtrans.py | 36 +++++------------------------------- + 1 file changed, 5 insertions(+), 31 deletions(-) + +diff --git a/dnf/yum/rpmtrans.py b/dnf/yum/rpmtrans.py +index 58c6101895..57f71e69bf 100644 +--- a/dnf/yum/rpmtrans.py ++++ b/dnf/yum/rpmtrans.py +@@ -391,21 +391,9 @@ def _scriptError(self, amount, total, key): + scriptlet_name = rpm.tagnames.get(amount, "") + + transaction_list = self._extract_cbkey(key) +- pkg_currenly_being_handled = transaction_list[0].pkg ++ name = transaction_list[0].pkg.name + +- if hasattr(key, "name"): +- pkg_which_owns_this_scriptlet_name = key.name +- else: +- pkg_which_owns_this_scriptlet_name = key +- +- # In case rpm trigger runs scriptlet of some other package +- if pkg_which_owns_this_scriptlet_name != pkg_currenly_being_handled.name: +- msg = ("Error in %s scriptlet in rpm package %s triggered by rpm package %s" +- % (scriptlet_name, pkg_which_owns_this_scriptlet_name, +- pkg_currenly_being_handled)) +- else: +- msg = ("Error in %s scriptlet in rpm package %s" +- % (scriptlet_name, pkg_currenly_being_handled)) ++ msg = ("Error in %s scriptlet in rpm package %s" % (scriptlet_name, name)) + + for display in self.displays: + display.error(msg) +@@ -414,29 +402,15 @@ def _script_start(self, key): + # TODO: this doesn't fit into libdnf TransactionItem use cases + action = dnf.transaction.PKG_SCRIPTLET + if key is None and self._te_list == []: +- pkg_currenly_being_handled = 'None' ++ pkg = 'None' + else: + transaction_list = self._extract_cbkey(key) +- pkg_currenly_being_handled = transaction_list[0].pkg ++ pkg = transaction_list[0].pkg + complete = self.complete_actions if self.total_actions != 0 and self.complete_actions != 0 \ + else 1 + total = self.total_actions if self.total_actions != 0 and self.complete_actions != 0 else 1 +- +- if hasattr(key, "name"): +- pkg_which_owns_this_scriptlet_name = key.name +- else: +- pkg_which_owns_this_scriptlet_name = key +- +- # In case rpm trigger runs scriptlet of some other package +- if pkg_which_owns_this_scriptlet_name != pkg_currenly_being_handled.name: +- # Show only the pkg name, because we don't have the full nevra +- # and if we search for the pkg we could show misleding information +- pkg_or_key = pkg_which_owns_this_scriptlet_name +- else: +- pkg_or_key = pkg_currenly_being_handled +- + for display in self.displays: +- display.progress(pkg_or_key, action, 100, 100, complete, total) ++ display.progress(pkg, action, 100, 100, complete, total) + + def _scriptStop(self): + self._scriptout() diff --git a/0003-Fix-misplaced-parenthesis.patch b/0003-Fix-misplaced-parenthesis.patch new file mode 100644 index 0000000..9cac8fa --- /dev/null +++ b/0003-Fix-misplaced-parenthesis.patch @@ -0,0 +1,61 @@ +From 76e8e5c4b6408400e3b3e7503f97b550660a3760 Mon Sep 17 00:00:00 2001 +From: Marek Blaha +Date: Thu, 7 Nov 2019 11:19:35 +0100 +Subject: [PATCH] Fix misplaced parenthesis + +This can cause nice traceback when trying to install package with +fileconflict: + +Running transaction test +The downloaded packages were saved in cache until the next successful transaction. +You can remove cached packages by executing '{prog} clean packages'. +Traceback (most recent call last): + File "/usr/lib/python3.7/site-packages/dnf/cli/main.py", line 65, in main + return _main(base, args, cli_class, option_parser_class) + File "/usr/lib/python3.7/site-packages/dnf/cli/main.py", line 98, in _main + return cli_run(cli, base) + File "/usr/lib/python3.7/site-packages/dnf/cli/main.py", line 122, in cli_run + ret = resolving(cli, base) + File "/usr/lib/python3.7/site-packages/dnf/cli/main.py", line 166, in resolving + base.do_transaction(display=displays) + File "/usr/lib/python3.7/site-packages/dnf/cli/cli.py", line 243, in do_transaction + tid = super(BaseCli, self).do_transaction(display) + File "/usr/lib/python3.7/site-packages/dnf/base.py", line 856, in do_transaction + raise dnf.exceptions.Error(errstring) +dnf.exceptions.Error: Transaction test error: + file /usr/bin/nitrate from install of python3-nitrate-1.5-1.fc30.noarch conflicts with file from package python2-nitrate-1.4-2.fc30.noarch + file /usr/share/man/man1/python-nitrate.1.gz from install of python3-nitrate-1.5-1.fc30.noarch conflicts with file from package python2-nitrate-1.4-2.fc30.noarch + +During handling of the above exception, another exception occurred: + +Traceback (most recent call last): + File "/usr/bin/dnf", line 58, in + main.user_main(sys.argv[1:], exit_code=True) + File "/usr/lib/python3.7/site-packages/dnf/cli/main.py", line 191, in user_main + errcode = main(args) + File "/usr/lib/python3.7/site-packages/dnf/cli/main.py", line 65, in main + return _main(base, args, cli_class, option_parser_class) + File "/usr/lib/python3.7/site-packages/dnf/base.py", line 123, in __exit__ + self.close() + File "/usr/lib/python3.7/site-packages/dnf/base.py", line 466, in close + self._finalize_base() + File "/usr/lib/python3.7/site-packages/dnf/base.py", line 445, in _finalize_base + "'%s'."), "{prog} clean packages").format(prog=dnf.util.MAIN_PROG) +AttributeError: 'NoneType' object has no attribute 'format' +--- + dnf/base.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/dnf/base.py b/dnf/base.py +index 59b93c3cb1..0443443d51 100644 +--- a/dnf/base.py ++++ b/dnf/base.py +@@ -442,7 +442,7 @@ def _finalize_base(self): + logger.info(_("The downloaded packages were saved in cache " + "until the next successful transaction.")) + logger.info(_("You can remove cached packages by executing " +- "'%s'."), "{prog} clean packages").format(prog=dnf.util.MAIN_PROG) ++ "'%s'."), "{prog} clean packages".format(prog=dnf.util.MAIN_PROG)) + + # Do not trigger the lazy creation: + if self._history is not None: diff --git a/dnf.spec b/dnf.spec index fa158c9..ea3cfb5 100644 --- a/dnf.spec +++ b/dnf.spec @@ -82,12 +82,16 @@ It supports RPMs, modules and comps groups & environments. Name: dnf Version: 4.2.15 -Release: 1%{?dist} +Release: 2%{?dist} Summary: %{pkg_summary} # For a breakdown of the licensing, see PACKAGE-LICENSING License: GPLv2+ and GPLv2 and GPL URL: https://github.com/rpm-software-management/dnf Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz +# Temporary patch until revert is merged upstream, the fix has to be reverted because it break API +Patch0002: 0002-Revert-Fix-messages-for-starting-and-failing-scriptlets.patch +# Temporary patch until fix is newly released +Patch0003: 0003-Fix-misplaced-parenthesis.patch BuildArch: noarch BuildRequires: cmake @@ -511,6 +515,10 @@ ln -sr %{buildroot}%{confdir}/vars %{buildroot}%{_sysconfdir}/yum/vars %endif %changelog +* Tue Nov 12 2019 Ales Matej - 4.2.15-2 +- Revert: Fix messages for starting and failing scriptlets (RhBug:1724779) +- Fix traceback when trying to install package with fileconflict + * Wed Nov 06 2019 Pavla Kratochvilova - 4.2.15-1 - Update to 4.2.15 - Fix downloading local packages into destdir (RhBug:1727137)