Created attachment 886568 [details, diff] Patch to remove git dependency for 'make-package-list' command Tried using NATTkA while fumbling around trying to figure out how to file a keywordreq. The wiki page for NATTkA is a stub but it has a sample command for keywording, the results of which were: ``` rockpro64 /var/db/repos/gentoo # nattka --repo . make-package-list -a '~arm64' rsnapshot Traceback (most recent call last): File "/usr/lib/python-exec/python3.11/nattka", line 8, in <module> sys.exit(setuptools_main()) ^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/nattka/__main__.py", line 1066, in setuptools_main sys.exit(main(sys.argv[1:])) ^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/nattka/__main__.py", line 1056, in main return getattr(cmd, args.command.replace('-', '_'))() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/nattka/__main__.py", line 395, in make_package_list repo, git_repo = self.get_git_repository() ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/nattka/__main__.py", line 190, in get_git_repository git_repo = GitWorkTree(repo.location) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/nattka/git.py", line 119, in __init__ raise GitRepositoryNotFound( nattka.git.GitRepositoryNotFound: No repository found in /var/db/repos/gentoo ``` From reading the help, 'make-package-list' didn't seem like it would need to do any git commands, and looking at the code supported that conclusion. So this is a quickly whipped up patch from the main machine, which when placed in /etc/portage/patches/app-portage/nattka/ results in the following output instead: ``` rockpro64 /var/db/repos/gentoo # nattka --repo . make-package-list -a '~arm64' app-backup/rsnapshot INFO:nattka:Iteration 1: running pkgcheck ... gentoo -- updating profiles cache: arm64 INFO:nattka:New packages: dev-perl/Lchown INFO:nattka:Iteration 1: verifying ... INFO:nattka:Iteration 2: running pkgcheck ... INFO:nattka:Time elapsed: 0:00:05.921201 INFO:nattka:Target CC: arm64@gentoo.org INFO:nattka:Package list follows: app-backup/rsnapshot ~arm64 dev-perl/Lchown ^ ```
Per /usr/lib/python3.11/site-packages/nattka/git.py, it needs a git repo to be able to reset the state after, I think?
(In reply to Sam James from comment #1) > Per /usr/lib/python3.11/site-packages/nattka/git.py, it needs a git repo to > be able to reset the state after, I think? Ahh, so it is actually a destructive action because it defers to pkgcheck to do the scanning and that requires the ebuild(s) to be updated on disk. That is unfortunate but makes a bit of sense. For this one command the only writes seem to come from keyword.update_keywords_in_file which could return the original content if it changed, and an alternate context manager implementation could write that back. But that would be more work and be much more likely to closed "won't fix". Syncing from rsync keeps a clean original copy to verify the manifest before writing the updates to the repository, which would be a reasonable approach here but it's taking a while to read the sync code to see how that works. Or the changed ebuilds could be written to an overlay instead of over the existing files if pkgcheck supports overlays. So many options but they require time to look into.