repodiff: Improve changelog output
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.
Hello @Thaodan! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
- In the file
plugins/repodiff.py:
Line 314:86: W504 line break after binary operator
Comment last updated at 2022-05-27 16:45:12 UTC
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.
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.