-
Notifications
You must be signed in to change notification settings - Fork 125
Transaction table: Omit redundant package names #2285
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
base: main
Are you sure you want to change the base?
Conversation
When possible (that is, when the name of the package being replaced is the same as the name of the package replacing it), omit the old package name on the 'replacing' line to save some column width.
| std::string name; | ||
| if (pkg->get_name() == replaced->get_name()) { | ||
| // Abbreviated format for simple version upgrades | ||
| name = _("replacing"); |
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.
If we want to be nicer to translators, I could avoid a new translatable string (assuming "replacing" is a new translatable string) by making this:
| name = _("replacing"); | |
| name = libdnf5::utils::sformat(_("replacing {}"), ""); |
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.
(Although, now that I think about it, that may not work for all translations?)
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.
For translating it's always better to have full sentences because the translators can then reorder the words as they want.
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.
Right, well, the full string here is "replacing"; there's nothing else. (It's a table cell, so there are no full sentences to begin with. It previously contained "replacing <package-name>".)
|
It looks like test failures may be due to an implicit assumption in the test code that 'replacing' lines will contain a package name. Example: That it's trying to parse "x86_64-0:epoch.1.0-1" as a NEVRA string seems to indicate that it's misreading the architecture name as the package name, and the repository name ('epoch') as the version(?), for dummy-0:1.0-1.x86_64 (the 'replaced' package). I guess |
|
I personally like your output, but I'm curious what's other DNF developer's opinion. |
|
I'm looking at adjusting (Primarily because the output lines are "parsed" with regular expressions, which are a terrible way to parse most things. I'm tempted to replace them with a simple Pyparsing grammar that can actually interpret the output intelligently.) |
When possible (that is, when the name of the package being replaced is the same as the name of the package replacing it), omit the old package name on the 'replacing' line to save some column width.
This PR implements one of my suggestions from #785 (also mentioned at #1574 (comment)), and might be more palatable than #1574 as it doesn't remove any actual information from the output — only redundancy.
With a terminal column with of 87 (arbitrarily chosen to illustrate the differences in output with an available set of package upgrades), standard
dnf5formats like this:Built from this branch, the output fails to wrap, and the fact that the upgrades are coming from
updates-testingis also visible (where the-testingwas entirely cut off, previously):The output will still often wrap, especially when the terminal width is only 80 columns, but it'll wrap less and at least that's something, given that this relatively-conservative output change involves zero pain or information loss.