Skip to content
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

repodiff: Improve changelog output #456

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

Thaodan
Copy link

@Thaodan Thaodan commented May 26, 2022

This PR aims to improve the output that is outputted by repodiff to be more visually appealing and better formated.

The idea is to format the changelog like this:

# Packages removed(num)
## Source Package
- Packages removed name - version,  name - version, 

# Packages Modified(num)
## Package
- Update : Version old - Version new
### Date - Author
- changes
- changes

# Packages added(num)
## Source Package
- Packages Added name - version,  name - version, 
### Date - Author
- changes
- changes 

# Size Summary

Optionally the author can be hidden or the dateline can be skipped entirely to better show e.g. the diff between repos of different distribution releases.

@pep8speaks
Copy link

pep8speaks commented May 26, 2022

Hello @Thaodan! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 314:86: W504 line break after binary operator

Comment last updated at 2022-05-27 16:45:12 UTC

@Thaodan Thaodan force-pushed the improve_changelog_output branch 6 times, most recently from 65f77a7 to 58d235c Compare May 26, 2022 23:02
- Only show a section when there's content to display, e.g. no upraded
  packages.
- Draw sections with induvidual decending headers
- List size and versionchanges as regular entries in the changelog
- Show the amount of changes to each major section e.g. added
  packages
Since now added, removed and updated packages already show the amount
of changed packages.
@Thaodan Thaodan changed the title WIP: repodiff: Improve changelog output repodiff: Improve changelog output May 28, 2022
@pkratoch pkratoch self-assigned this Jun 16, 2022
@pkratoch
Copy link
Contributor

Hi, thank you for your pull request.

I am not sure this is more readable than the previous output, because it gets quite long and it's harder to get the list of packages just from the first look. I tried the option --simple to see if it makes a more consise output, but it failed with a traceback:

Traceback (most recent call last):
  File "/usr/bin/dnf", line 62, in <module>
    main.user_main(sys.argv[1:], exit_code=True)
  File "/usr/lib/python3.10/site-packages/dnf/cli/main.py", line 201, in user_main
    errcode = main(args)
  File "/usr/lib/python3.10/site-packages/dnf/cli/main.py", line 67, in main
    return _main(base, args, cli_class, option_parser_class)
  File "/usr/lib/python3.10/site-packages/dnf/cli/main.py", line 106, in _main
    return cli_run(cli, base)
  File "/usr/lib/python3.10/site-packages/dnf/cli/main.py", line 122, in cli_run
    cli.run()
  File "/usr/lib/python3.10/site-packages/dnf/cli/cli.py", line 1057, in run
    return self.command.run()
  File "/usr/lib/python3.10/site-packages/dnf-plugins/repodiff.py", line 335, in run
    self._report(self._repodiff(q_old, q_new))
  File "/usr/lib/python3.10/site-packages/dnf-plugins/repodiff.py", line 243, in _report
    report_modified(pkg_old=added_source_packages[src_pkg]["pkg"],
  File "/usr/lib/python3.10/site-packages/dnf-plugins/repodiff.py", line 165, in report_modified
    msgs.append("- Updated : %s - %s" % (pkg_old.evr, pkg_new.evr))
AttributeError: 'NoneType' object has no attribute 'evr'

Moreover, the list of added packages and list of removed packages doesn't work correctly. The list of packages is in the list of binaries and in case of the removed packages, the header is "None".

So, this needs more work, but since DNF 5 is under development (https://github.com/rpm-software-management/libdnf/tree/dnf-5-devel), maybe we could consider reworking it there instead of changing this plugin DNF 4.

@Thaodan
Copy link
Author

Thaodan commented Jun 20, 2022

Hi, thank you for your pull request.

I am not sure this is more readable than the previous output, because it gets quite long and it's harder to get the list of packages just from the first look. I tried the option --simple to see if it makes a more consise output, but it failed with a traceback:

I can post an example file I generated. The point of this PR is to make the detailed output more useable by grouping the changes better and also showing the changelog of newly added packages.

Traceback (most recent call last):
  File "/usr/bin/dnf", line 62, in <module>
    main.user_main(sys.argv[1:], exit_code=True)
  File "/usr/lib/python3.10/site-packages/dnf/cli/main.py", line 201, in user_main
    errcode = main(args)
  File "/usr/lib/python3.10/site-packages/dnf/cli/main.py", line 67, in main
    return _main(base, args, cli_class, option_parser_class)
  File "/usr/lib/python3.10/site-packages/dnf/cli/main.py", line 106, in _main
    return cli_run(cli, base)
  File "/usr/lib/python3.10/site-packages/dnf/cli/main.py", line 122, in cli_run
    cli.run()
  File "/usr/lib/python3.10/site-packages/dnf/cli/cli.py", line 1057, in run
    return self.command.run()
  File "/usr/lib/python3.10/site-packages/dnf-plugins/repodiff.py", line 335, in run
    self._report(self._repodiff(q_old, q_new))
  File "/usr/lib/python3.10/site-packages/dnf-plugins/repodiff.py", line 243, in _report
    report_modified(pkg_old=added_source_packages[src_pkg]["pkg"],
  File "/usr/lib/python3.10/site-packages/dnf-plugins/repodiff.py", line 165, in report_modified
    msgs.append("- Updated : %s - %s" % (pkg_old.evr, pkg_new.evr))
AttributeError: 'NoneType' object has no attribute 'evr'

I've run this against the release version of dnf, I can look to test it against master.

Moreover, the list of added packages and list of removed packages doesn't work correctly. The list of packages is in the list of binaries and in case of the removed packages, the header is "None".

Hm this could be again because of recent changes, I will try to fix it.

So, this needs more work, but since DNF 5 is under development (https://github.com/rpm-software-management/libdnf/tree/dnf-5-devel), maybe we could consider reworking it there instead of changing this plugin DNF 4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants