New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't print pkg that triggered scriptlet as pkg whose the scriptlet is (RhBug:1724779) #1471
Conversation
There was an error while running a copr build. You can re-trigger copr build by adding a comment ( |
9af3722
to
1d2c1b4
Compare
There was an error while running a copr build. You can re-trigger copr build by adding a comment ( |
dnf/yum/rpmtrans.py
Outdated
@@ -409,6 +414,12 @@ def _script_start(self, key): | |||
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 | |||
|
|||
# In case rpm trigger runs scriptlet of some other package that is not in the transaction | |||
if isinstance(key, str) and key != pkg.name: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use dnf.util.is_string_type() instead
dnf/yum/rpmtrans.py
Outdated
# In case rpm trigger runs scriptlet of some other package that is not in the transaction | ||
if isinstance(key, str) and key != pkg.name: | ||
# TODO(amatej): This is bad I think, but we have only the name :( | ||
pkg = self.base._sack.query().installed().filterm(name=key)[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_sack() returns list of installed packages that were installed before the transactions
it's not changing during the transaction
consider just printing the package name without any lookups
1d2c1b4
to
33b1717
Compare
33b1717
to
6f03264
Compare
6f03264
to
a81bb83
Compare
Updated the PR, it now only prints the name instead of any lookups. |
@please could you make the header of commit message shorter. Some information could be moved into body of message. |
dnf/yum/rpmtrans.py
Outdated
pkg_currenly_being_handled_name)) | ||
else: | ||
msg = ("Error in %s scriptlet in rpm package %s" | ||
% (scriptlet_name, pkg_currenly_being_handled_name)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not understand why we do not provide full NEVRA when it is valid and available. Think that you install two kernels in transaction. And one fails but which one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated it to print the full NEVRA for the current package which has the information always available.
8f4f46e
to
74a597b
Compare
I also amended the commit message |
dnf/yum/rpmtrans.py
Outdated
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 = pkg_which_owns_this_scriptlet_name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name of "pkg" is confusing. It is string or pkg object or key (mostly string). What about pkg_or_key
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In progress function it is called package
. Therefore not much of help. pkg_descriptor
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated it to pkg_or_key
. I think its better because pkg_descriptor
does not express well that it still could be a whole package.
Differentiate between pkg that triggered scriptlet and pkg which owns it https://bugzilla.redhat.com/show_bug.cgi?id=1724779
74a597b
to
697dcf3
Compare
Thanks a lot. LGTM |
📌 Commit 697dcf3 has been approved by |
Differentiate between pkg that triggered scriptlet and pkg which owns it https://bugzilla.redhat.com/show_bug.cgi?id=1724779 Closes: #1471 Approved by: j-mracek
💥 Test timed out |
@rh-atomic-bot retry |
☀️ Test successful - status-papr |
No description provided.