-
Notifications
You must be signed in to change notification settings - Fork 104
Upgrade summary output too wide (> 80 cols) #785
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
Comments
(Apparently you cannot put a screenshot here) It looks like this: http://oirase.annexia.org/tmp/Screenshot_2023-08-01_11-34-49.png |
If there is an interactive terminal But it shouldn't be stretching the outputs over multiple lines like in your screenshot (unless you first print the transaction table and then resize the window). |
I didn't resize the terminal. Everything would fit into 80 columns fine if there wasn't so much whitespace. |
Interesting, do you have a reproducer for this? |
It happens with any install command that needs to install a significant number of packages. For example just now I did:
This happens to be with |
(which is wider than 80 columns and appears wrapped) |
Right, as you can see in the output you provided there is really no way to make it smaller and keep the columns aligned. We could also look into cutting the packages names if too long but it might make the output even more confusing. There is this other issue to make the output smaller/configurable #326 that I think is related to your request. |
Old dnf does this:
where the summary part is all nicely under 80 columns. |
Ok, so if I understand correctly the core of this issue is that dnf5 transaction output is wider because:
|
The issue is that the output is wider than 80 columns on an 80 column terminal, when it doesn't need to be. |
Fedora report https://bugzilla.redhat.com/show_bug.cgi?id=2329030. |
So, this is still happening, but:
In my 80-column terminal: Then, later, during the actual transaction: (And as you can see, there's plenty of room to narrow the output. The longest name string is (Edit: This is with Fedora 41's dnf5-5.2.8.1-2.fc41.x86_64.) |
In looking at this more, a few things strike me:
Just cutting down on the number of extra-long "␣␣replacing <old_name>" strings the first column has to accommodate could really help rein in the width. |
Would love to see the 'replacing' line removed when it is the same package name.
The last line does not hold any interesting information for most users and makes the the output twice as long |
@EverardB There's discussion in PR #1574 about possible approaches to that. Personally, I don't mind the extra length (vertical space is free, the terminal scrolls), I just want each line to fit on a single line. Everything wrapping ALSO makes the output twice-again as long. 😀 (Not to mention, a pain to read.) |
I have a proposal to solve this issue. First of all, here is the draft diff: draft diff for upgrade summary on small displaysdiff --git a/libdnf5-cli/output/.search.cpp.swp b/libdnf5-cli/output/.search.cpp.swp
deleted file mode 100644
index a0ad3340..00000000
Binary files a/libdnf5-cli/output/.search.cpp.swp and /dev/null differ
diff --git a/libdnf5-cli/output/transaction_table.cpp b/libdnf5-cli/output/transaction_table.cpp
index 468add94..06ef2ab2 100644
--- a/libdnf5-cli/output/transaction_table.cpp
+++ b/libdnf5-cli/output/transaction_table.cpp
@@ -274,25 +274,25 @@ TransactionTable::Impl::Impl(ITransaction & transaction) {
scols_table_enable_noheadings(*tb, 1);
struct libscols_line * header_ln = scols_table_new_line(*tb, NULL);
- auto column = scols_table_new_column(*tb, _("Package"), 0.3, 0);
+ auto column = scols_table_new_column(*tb, _("Package"), 0.3, SCOLS_FL_TRUNC);
auto header = scols_column_get_header(column);
auto cell = scols_line_get_cell(header_ln, COL_NAME);
scols_cell_set_data(cell, scols_cell_get_data(header));
scols_cell_set_color(cell, "bold");
- column = scols_table_new_column(*tb, _("Arch"), 6, 0);
+ column = scols_table_new_column(*tb, _("Arch"), 0.05, 0);
header = scols_column_get_header(column);
cell = scols_line_get_cell(header_ln, COL_ARCH);
scols_cell_set_data(cell, scols_cell_get_data(header));
scols_cell_set_color(cell, "bold");
- column = scols_table_new_column(*tb, _("Version"), 0.3, SCOLS_FL_TRUNC);
+ column = scols_table_new_column(*tb, _("Version"), 0.05, 0);
header = scols_column_get_header(column);
cell = scols_line_get_cell(header_ln, COL_EVR);
scols_cell_set_data(cell, scols_cell_get_data(header));
scols_cell_set_color(cell, "bold");
- column = scols_table_new_column(*tb, _("Repository"), 0.1, SCOLS_FL_TRUNC);
+ column = scols_table_new_column(*tb, _("Repository"), 0.05, 0);
header = scols_column_get_header(column);
cell = scols_line_get_cell(header_ln, COL_REPO);
scols_cell_set_data(cell, scols_cell_get_data(header));
And here are my rationale for the suggested changes:
I did not submit the PR yet since this is relatively a complex issue and needs some brainstorming on what would be the most appropriate solution. Here are the snapshots before and after my draft patch: |
I did some consultation on cc. @decathorpe |
On small displays (e.g. 80 chars width term), The 1st column (i.e. `Package` Name) is printed on its dedicated line if necessary. This is similar to dnf4 behavior. A `libsmartcols` iterator is used to print output line-by-line and decide if the package name should be printed on its dedicated line. The `Arch` column width should not be fixed. The previous setting of `6` characters resulted on truncation of `Aarch64` & `ppc64le` at all conditions. `Repository` column is allowed to be wider as the previous `whint` value resulted on truncation of `updates-testing` on small displays, making it indistinguishable from `updates`. (reported in issue 785). resolves: rpm-software-management#785 resolves: rpm-software-management#1785 Examples of output behavior are available at CI/CD changes here:
On small displays (e.g. 80 chars width term), The 1st column (i.e. `Package` Name) is printed on its dedicated line if necessary. This is similar to dnf4 behavior. A `libsmartcols` iterator is used to print output line-by-line and decide if the package name should be printed on its dedicated line. The `Arch` column width should not be fixed. The previous setting of `6` characters resulted on truncation of `Aarch64` & `ppc64le` at all conditions. `Repository` column is allowed to be wider as the previous `whint` value resulted on truncation of `updates-testing` on small displays, making it indistinguishable from `updates` (reported in issue 1785). resolves: rpm-software-management#785 resolves: rpm-software-management#1785 Examples of output behavior are available at CI/CD changes here:
On small displays (e.g. 80 chars width term), The 1st column (i.e. `Package` Name) is printed on its dedicated line if necessary. This is similar to dnf4 behavior. A `libsmartcols` iterator is used to print output line-by-line and decide if the package name should be printed on its dedicated line. The `Arch` column width should not be fixed. The previous setting of `6` characters resulted on truncation of `Aarch64` & `ppc64le` at all conditions. `Repository` column is allowed to be wider as the previous `whint` value resulted on truncation of `updates-testing` on small displays, making it indistinguishable from `updates` (reported in issue 1785). resolves: rpm-software-management#785 resolves: rpm-software-management#1785 From CI/CD point of view (piped output), nothing changes. No need to update the existing unittests. Below are the example output on 80 character width terminal: Output of `install python3-mkdocs-git*plugin --assumeno` before patch: ``` Updating and loading repositories: Repositories loaded. Package Arch Version Reposit Size Installing: python3-mkdocs-git-authors-plugin noarch 0.9.2-1.fc42 fedora 131.3 KiB python3-mkdocs-git-revision-date-localized-plugin noarch 1.3.0-1.fc42 fedora 109.3 KiB Installing dependencies: fontawesome-fonts-web noarch 1:6.7.2-2.fc42 fedora 22.2 MiB mkdocs noarch 1.6.1-3.fc4 fedora 6.5 MiB ... ``` Output of `install python3-mkdocs-git*plugin --assumeno` after patch: ``` Updating and loading repositories: Repositories loaded. Package Arch Version Repository Size Installing: python3-mkdocs-git-authors-plugin noarch 0.9.2-1.fc42 fedora 131.3 KiB python3-mkdocs-git-revision-date-localized-plugin noarch 1.3.0-1.fc42 fedora 109.3 KiB Installing dependencies: fontawesome-fonts-web noarch 1:6.7.2-2.fc42 fedora 22.2 MiB mkdocs noarch 1.6.1-3.fc42 fedora 6.5 MiB ... ```
On small displays (e.g. 80 chars width term), The 1st column (i.e. `Package` Name) is printed on its dedicated line if necessary. This is similar to dnf4 behavior. A `libsmartcols` iterator is used to print output line-by-line and decide if the package name should be printed on its dedicated line. The `Arch` column width should not be fixed. The previous setting of `6` characters resulted on truncation of `Aarch64` & `ppc64le` at all conditions. `Repository` column is allowed to be wider as the previous `whint` value resulted on truncation of `updates-testing` on small displays, making it indistinguishable from `updates` (reported in issue 1785). resolves: rpm-software-management#785 resolves: rpm-software-management#1785 From CI/CD point of view (piped output), nothing changes. No need to update the existing unittests. Below are the example output on 80 character width terminal: Output of `install python3-mkdocs-git*plugin --assumeno` before patch: ``` Updating and loading repositories: Repositories loaded. Package Arch Version Reposit Size Installing: python3-mkdocs-git-authors-plugin noarch 0.9.2-1.fc42 fedora 131.3 KiB python3-mkdocs-git-revision-date-localized-plugin noarch 1.3.0-1.fc42 fedora 109.3 KiB Installing dependencies: fontawesome-fonts-web noarch 1:6.7.2-2.fc42 fedora 22.2 MiB mkdocs noarch 1.6.1-3.fc4 fedora 6.5 MiB ... ``` Output of `install python3-mkdocs-git*plugin --assumeno` after patch: ``` Updating and loading repositories: Repositories loaded. Package Arch Version Repository Size Installing: python3-mkdocs-git-authors-plugin noarch 0.9.2-1.fc42 fedora 131.3 KiB python3-mkdocs-git-revision-date-localized-plugin noarch 1.3.0-1.fc42 fedora 109.3 KiB Installing dependencies: fontawesome-fonts-web noarch 1:6.7.2-2.fc42 fedora 22.2 MiB mkdocs noarch 1.6.1-3.fc42 fedora 6.5 MiB ... ```
On small displays (e.g. 80 chars width term), The 1st column (i.e. `Package` Name) is printed on its dedicated line if necessary. This is similar to dnf4 behavior. A `libsmartcols` iterator is used to print output line-by-line and decide if the package name should be printed on its dedicated line. The `Arch` column width should not be fixed. The previous setting of `6` characters resulted on truncation of `Aarch64` & `ppc64le` at all conditions. `Repository` column is allowed to be wider as the previous `whint` value resulted on truncation of `updates-testing` on small displays, making it indistinguishable from `updates` (reported in issue 1785). resolves: rpm-software-management#785 resolves: rpm-software-management#1785 From CI/CD point of view (piped output), nothing changes. No need to update the existing unittests. Below are the example output on 80 character width terminal: Output of `install python3-mkdocs-git*plugin --assumeno` before patch: ``` Updating and loading repositories: Repositories loaded. Package Arch Version Reposit Size Installing: python3-mkdocs-git-authors-plugin noarch 0.9.2-1.fc42 fedora 131.3 KiB python3-mkdocs-git-revision-date-localized-plugin noarch 1.3.0-1.fc42 fedora 109.3 KiB Installing dependencies: fontawesome-fonts-web noarch 1:6.7.2-2.fc42 fedora 22.2 MiB mkdocs noarch 1.6.1-3.fc4 fedora 6.5 MiB ... ``` Output of `install python3-mkdocs-git*plugin --assumeno` after patch: ``` Updating and loading repositories: Repositories loaded. Package Arch Version Repository Size Installing: python3-mkdocs-git-authors-plugin noarch 0.9.2-1.fc42 fedora 131.3 KiB python3-mkdocs-git-revision-date-localized-plugin noarch 1.3.0-1.fc42 fedora 109.3 KiB Installing dependencies: fontawesome-fonts-web noarch 1:6.7.2-2.fc42 fedora 22.2 MiB mkdocs noarch 1.6.1-3.fc42 fedora 6.5 MiB ... ```
On small displays (e.g. 80 chars width term), The 1st column (i.e. `Package` Name) is printed on its dedicated line if necessary. This is similar to dnf4 behavior. A `libsmartcols` iterator is used to print output line-by-line and decide if the package name should be printed on its dedicated line. The `Arch` column width should not be fixed. The previous setting of `6` characters resulted on truncation of `Aarch64` & `ppc64le` at all conditions. `Repository` column is allowed to be wider as the previous `whint` value resulted on truncation of `updates-testing` on small displays, making it indistinguishable from `updates` (reported in issue 1785). resolves: rpm-software-management#785 resolves: rpm-software-management#1785 From CI/CD point of view (piped output), nothing changes. No need to update the existing unittests. Below are the example output on 80 character width terminal: Output of `install python3-mkdocs-git*plugin --assumeno` before patch: ``` Updating and loading repositories: Repositories loaded. Package Arch Version Reposit Size Installing: python3-mkdocs-git-authors-plugin noarch 0.9.2-1.fc42 fedora 131.3 KiB python3-mkdocs-git-revision-date-localized-plugin noarch 1.3.0-1.fc42 fedora 109.3 KiB Installing dependencies: fontawesome-fonts-web noarch 1:6.7.2-2.fc42 fedora 22.2 MiB mkdocs noarch 1.6.1-3.fc4 fedora 6.5 MiB ... ``` Output of `install python3-mkdocs-git*plugin --assumeno` after patch: ``` Updating and loading repositories: Repositories loaded. Package Arch Version Repository Size Installing: python3-mkdocs-git-authors-plugin noarch 0.9.2-1.fc42 fedora 131.3 KiB python3-mkdocs-git-revision-date-localized-plugin noarch 1.3.0-1.fc42 fedora 109.3 KiB Installing dependencies: fontawesome-fonts-web noarch 1:6.7.2-2.fc42 fedora 22.2 MiB mkdocs noarch 1.6.1-3.fc42 fedora 6.5 MiB ... ```
On small displays (e.g. 80 chars width term), The 1st column (i.e. `Package` Name) is printed on its dedicated line if necessary. This is similar to dnf4 behavior. A `libsmartcols` iterator is used to print output line-by-line and decide if the package name should be printed on its dedicated line. The `Arch` column width should not be fixed. The previous setting of `6` characters resulted on truncation of `Aarch64` & `ppc64le` at all conditions. `Repository` column is allowed to be wider as the previous `whint` value resulted on truncation of `updates-testing` on small displays, making it indistinguishable from `updates` (reported in issue 1785). resolves: rpm-software-management#785 resolves: rpm-software-management#1785 From CI/CD point of view (piped output), nothing changes. No need to update the existing unittests. Below are the example output on 80 character width terminal: Output of `install python3-mkdocs-git*plugin --assumeno` before patch: ``` Updating and loading repositories: Repositories loaded. Package Arch Version Reposit Size Installing: python3-mkdocs-git-authors-plugin noarch 0.9.2-1.fc42 fedora 131.3 KiB python3-mkdocs-git-revision-date-localized-plugin noarch 1.3.0-1.fc42 fedora 109.3 KiB Installing dependencies: fontawesome-fonts-web noarch 1:6.7.2-2.fc42 fedora 22.2 MiB mkdocs noarch 1.6.1-3.fc4 fedora 6.5 MiB ... ``` Output of `install python3-mkdocs-git*plugin --assumeno` after patch: ``` Updating and loading repositories: Repositories loaded. Package Arch Version Repository Size Installing: python3-mkdocs-git-authors-plugin noarch 0.9.2-1.fc42 fedora 131.3 KiB python3-mkdocs-git-revision-date-localized-plugin noarch 1.3.0-1.fc42 fedora 109.3 KiB Installing dependencies: fontawesome-fonts-web noarch 1:6.7.2-2.fc42 fedora 22.2 MiB mkdocs noarch 1.6.1-3.fc42 fedora 6.5 MiB ... ```
This is wider than 80 columns.
The text was updated successfully, but these errors were encountered: