summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2025-09-29use installed USE flags to filter reverse dependencies in equery dependsHEADmasterJohn Turner
2025-09-29impl get_final_flags function in flag.pyJohn Turner
2024-09-09meson.build: prepare for gentoolkit-0.6.8Matt Turner
Signed-off-by: Matt Turner <mattst88@gentoo.org>
2024-06-25merge_driver_ekeyword: Add build systemMatt Turner
Signed-off-by: Matt Turner <mattst88@gentoo.org>
2024-06-20merge_driver_ekeyword: Run blackMatt Turner
Signed-off-by: Matt Turner <mattst88@gentoo.org>
2024-06-20merge_driver_ekeyword: Add testsMatt Turner
And provide a Makefile to generate the test data from gentoo.git. Signed-off-by: Matt Turner <mattst88@gentoo.org>
2024-06-07merge_driver-ekeyword: split out merge_keywords functionMatt Turner
Signed-off-by: Matt Turner <mattst88@gentoo.org>
2024-06-07bin/merge-driver-ekeyword: Move logic to a separate moduleMatt Turner
To facilitate unit testing. Signed-off-by: Matt Turner <mattst88@gentoo.org>
2024-06-07bin/merge-driver-ekeyword: Don't pass program name to main()Matt Turner
Signed-off-by: Matt Turner <mattst88@gentoo.org>
2024-06-07bin/merge-driver-ekeyword: Don't sys.exit() from main()Matt Turner
Makes unit testing easier. Signed-off-by: Matt Turner <mattst88@gentoo.org>
2024-06-07bin/merge-driver-ekeyword: Store merged output in correct locationMatt Turner
Fixes: a667d93 ("bin/merge-driver-ekeyword: Look for KEYWORDS changes in upstream commit") Signed-off-by: Matt Turner <mattst88@gentoo.org>
2024-06-07ekeyword: Remove dead MakefileMatt Turner
Has been dead since commit c819d14 in 2009. Signed-off-by: Matt Turner <mattst88@gentoo.org>
2024-05-24bin/merge-driver-ekeyword: Look for KEYWORDS changes in upstream commitMatt Turner
Previously we only looked for changes to the KEYWORDS= line in our local commit being rebased. If it contained no changes to KEYWORDS= then the merge-driver gave up. However our local patch may conflict with an upstream patch that changed KEYWORDS. In that case, we can look for changes to the KEYWORDS= line in the other patch and try to apply its change to ours. This happened in gentoo.git commits 2c5cd6c4e004 ("sys-fs/squashfs-tools-ng: Stabilize 1.3.0 amd64, #930693") 7129c2e4e5f3 ("sys-fs/squashfs-tools-ng: run elibtoolize in non-live ebuild") leading to a rebase mistake in the latter (later fixed by commit 7579afbd4aa1 ("sys-fs/squashfs-tools-ng: stabilize 1.3.0 for amd64")). With this patch applied, the merge conflicts are automatically resolved between the two commits regardless of which is "ours" vs "theirs". Signed-off-by: Matt Turner <mattst88@gentoo.org>
2024-05-24bin/merge-driver-ekeyword: Two blank lines after function defMatt Turner
Signed-off-by: Matt Turner <mattst88@gentoo.org>
2024-05-24bin/merge-driver-ekeyword: Remove unused importsMatt Turner
Fixes: 1a2c70d ("Run `pyupgrade --py39-plus`") Signed-off-by: Matt Turner <mattst88@gentoo.org>
2024-05-08meson.build: prepare for gentoolkit-0.6.7Sam James
Signed-off-by: Sam James <sam@gentoo.org>
2024-05-03eclean: dist: make VCS cleaning dependent on --deepSam James
The man page clearly says that without --deep, users can expect eclean-dist to be conservative in cleaning up, and not consider the VDB, just the repo state. Honour that promise by making VCS cleaning dependent on --deep, given it involves VDB inspection to see what's installed. Bug: https://bugs.gentoo.org/923369 Signed-off-by: Sam James <sam@gentoo.org>
2024-05-03package: update example PORTDIR pathSam James
Signed-off-by: Sam James <sam@gentoo.org>
2024-05-03man: update default PKGDIR location to /var/cache/binpkgsSam James
Signed-off-by: Sam James <sam@gentoo.org>
2024-05-03man: document eclean-dist's --skip-vcsSam James
Bug: https://bugs.gentoo.org/923369 Signed-off-by: Sam James <sam@gentoo.org>
2024-05-03eclean: dist: fix crash with excluded itemsSam James
Bug: https://bugs.gentoo.org/915055 Signed-off-by: Sam James <sam@gentoo.org>
2024-05-03eclean: dist: fix printing VCS clean items with --quietSam James
Bug: https://bugs.gentoo.org/928951 Signed-off-by: Sam James <sam@gentoo.org>
2024-05-03eclean: dist: fix copyright headersSam James
Signed-off-by: Sam James <sam@gentoo.org>
2024-05-03eclean: dist: fix typo in commentSam James
Signed-off-by: Sam James <sam@gentoo.org>
2024-05-03eclean: dist: fix operating on an empty directorySam James
Zac pointed out that not all return paths had been updated. Bug: https://bugs.gentoo.org/928138 Fixes: 87912b460c533f8b010617018fdad42246db85f0 Signed-off-by: Sam James <sam@gentoo.org>
2024-04-25meson.build: prepare for gentoolkit-0.6.6Sam James
Signed-off-by: Sam James <sam@gentoo.org>
2024-04-25distfiles.exclude: whitelist layout.confUlrich Müller
Bug: https://bugs.gentoo.org/877485 Signed-off-by: Ulrich Müller <ulm@gentoo.org> Closes: https://github.com/gentoo/gentoolkit/pull/47 Signed-off-by: Sam James <sam@gentoo.org>
2024-04-25distfiles.exclude: whitelist .layout.conf* and .mirror-cache.jsonUlrich Müller
Signed-off-by: Ulrich Müller <ulm@gentoo.org> Signed-off-by: Sam James <sam@gentoo.org>
2024-03-12meson: make tests optionalGreg Kubaryk
Closes: https://bugs.gentoo.org/926427 Signed-off-by: Greg Kubaryk <greg.kubaryk@gmail.com> Signed-off-by: Sam James <sam@gentoo.org> (cherry picked from commit 988e47557368df49035eeba94beca893f7b267c1)
2024-03-12Revert "meson: make tests optional"Sam James
This reverts commit 988e47557368df49035eeba94beca893f7b267c1. Signed-off-by: Sam James <sam@gentoo.org>
2024-03-12ci: enable new test optionSam James
See 988e47557368df49035eeba94beca893f7b267c1. Bug: https://bugs.gentoo.org/926427 Signed-off-by: Sam James <sam@gentoo.org>
2024-03-12meson: make tests optionalSam James
Closes: https://bugs.gentoo.org/926427 Signed-off-by: Greg Kubaryk <greg.kubaryk@gmail.com> Signed-off-by: Sam James <sam@gentoo.org>
2024-03-07switch test framework to pytestJohn Turner
Pytest is a testing framework that is backwards compatible with "unittest" tests, but provides new styles of tests that are more ergonomic. Pytest tests do not require wrapping the test in a class, just a top level python function will be automatically picked up. Assertions use the regular python assert built-in and provide greatly enhanced debug output. These features reduce friction in writing new unit tests, and being backwards compatible allows preserving the existing gentoolkit unit tests. Changing the meson test command and installing the pytest package in CI are the only changes required to start using it! Signed-off-by: John Turner <jturner.usa@gmail.com> Closes: https://github.com/gentoo/gentoolkit/pull/45 Signed-off-by: Sam James <sam@gentoo.org>
2024-03-07depends.py: rename DependPrinter to PrinterJohn Turner
The DependPrinter class name and documentation indicated that it was meant to be part of the gentoolkit.dependencies API, to print Dependencies objects. This Printer class is used exclusively for printering equery depends output and is not a public API outside of the depends.py module Signed-off-by: John Turner <jturner.usa@gmail.com> Signed-off-by: Sam James <sam@gentoo.org>
2024-03-07equery/depends: print output in module rather than with a callbackJohn Turner
The depends module can now iterate over the results of the graph_reverse_depends function and print the items as they are yielded. Before, it passed in a callback printer function, and expected the Dependencies class to call it correctly. This setup is nicer because it does not tie together this module and the Dependencies class, and the old setup most likely existed due to performance and interactivity concerns which are now fixed by turning graph_reverse_depends into an iterator. Signed-off-by: John Turner <jturner.usa@gmail.com> Signed-off-by: Sam James <sam@gentoo.org>
2024-03-07dependencies.py: rewrite graph_reverse_depends to pass testsJohn Turner
The graph_reverse_depends method was not able to pass the unit tests introduced in the previous commits. It has been rewritten to pass them. This also has adding types to the method, and yields the results as an iterator rather than collecting them into a list in one shot. The printer callback parameter has been removed. This callback most likely existed so that results would be shown to the user as soon as they were available instead of delaying printing until the method completed, which could take seconds or minutes depending on the parameters. By making this method an iterator, the same effect is acheived by having the caller print every item as its yielded from the method. Signed-off-by: John Turner <jturner.usa@gmail.com> Signed-off-by: Sam James <sam@gentoo.org>
2024-03-07dependencies.py: introduce unit testing for graph_reverse_dependsJohn Turner
This commit introduces a new file with a basic unit test for the graph_reverse_depends method on the Dependencies class. Only 1 test exists right now, but various setup code and the general pattern of the tests are valuable for creating more advanced tests, and more tests for the Dependencies class in general. Pytest is used to run all of the functions in the file that start with test_, and a monkeypatch object is passed into test cases and allows us to mock out methods on the Dependencies class, specifically the "environment" method, which is used to query for packages variables like DEPEND and RDEPEND. We are able to test against a small fake denendency graph by patching the method! Signed-off-by: John Turner <jturner.usa@gmail.com> Signed-off-by: Sam James <sam@gentoo.org>
2024-03-07dependencies.py: use Enum rather than StrEnum for DependencyKindJohn Turner
StrEnum is only supported in Python versions 3.11 and newer. Gentoolkit should not require >=3.11, so DependencyKind will use the regular Enum feature instead. The difference between StrEnum and Enum is that StrEnum members are strings and can generally be used in place of strings in APIs expecting string input. Non-StrEnum members are not strings, but you can get members values by accessing their value field (DependencyKind.DEPEND.value). Fixes: 78464ec40bad9a0f824b063506f58296cc3ed9f3 Signed-off-by: John Turner <jturner.usa@gmail.com> Closes: https://github.com/gentoo/gentoolkit/pull/46 Signed-off-by: Sam James <sam@gentoo.org>
2024-02-17eclean/search.py: Fix find_packages docstring for invalid_pathsBrian Dolbec
Signed-off-by: Brian Dolbec <dolsen@gentoo.org>
2024-02-17Initial tests for _deps_equal()Brian Dolbec
Signed-off-by: Brian Dolbec <dolsen@gentoo.org>
2024-02-17eclean: Handle InvalidDepstring info in _deps_equalBrian Dolbec
Add try/except pair to _deps_equal() to output relavent details causing the exception in order to aid the user to fix the issue. Mark binpkg dep failures as a non match for possible deletion. Make the ebuild dep failure a warning only, return True to save the binpkg. Add parameter docstring info Bug: https://bugs.gentoo.org/923439 Signed-off-by: Brian Dolbec <dolsen@gentoo.org>
2024-02-17gentoolkit: fix flake8 lint error (F401, unused import)Sam James
pym/gentoolkit/dependencies.py:24:1: F401 'gentoolkit.helpers.uniqify' imported but unused Fixes: c0300517671076db453204c796637e206bf977e5 Signed-off-by: Sam James <sam@gentoo.org>
2024-02-16enalyze: placate blackSam James
Signed-off-by: Sam James <sam@gentoo.org>
2024-02-16tox: fix for meson portSam James
Signed-off-by: Sam James <sam@gentoo.org>
2024-02-16dependencies.py: replace hand rolled depcache with functools.cacheJohn Turner
functools.cache caches the output of functions "automatically" without requiring any manual management of a cache value. When used on class methods, the cache is associated with each class instance and only lives as long as the instance does. The Dependencies.graph_reverse_depends method used a dict to cache the output from pkg.get_all_depends. The get_all_depends method involves calling portage's aux_get and parsing the DEPEND string that is returned by it. This dict has been removed and replaced with functools.cache. The graph_reverse_depends method did not cache the output of the "raw=True" get_all_depends calls. This "raw" output is the literal string value for the pkgdeps *DEPEND variables as returned by aux_get. Searching this for a category/package sub-string allows quickly ruling out non-matching pkgdeps, which allows skipping parsing the DEPEND string into a list of Atoms. Using functools cache the method that fetches the raw DEPEND string massively improves performance for graph_reverse_depends when searching for indirect reverse dependencies. "equery depends --indirect emacs" runtime is ~2s with the raw value being cached, and ~60s without. Searching for only direct reverse dependencies does not utilize the cache and does not see any chance in runtime for me. Signed-off-by: John Turner <jturner.usa@gmail.com> Closes: https://github.com/gentoo/gentoolkit/pull/44 Signed-off-by: Sam James <sam@gentoo.org>
2024-02-16dependencies.py: unify get_*depend methodsJohn Turner
Instead of having separate functions for each DEPEND kind, the unified method returns a dict with all of the packages *DEPEND values inside of it. The dict can be indexed with a string or a field of the DependencyKind enum. This will be espeically useful for a future change that adds the ability to filter out specific DEPEND kinds from the query. The Dependencies class did not search IDEPEND dependencies, the unified method searches all dependency kinds defined in the DependencyKind enum, which includes IDEPEND! Signed-off-by: John Turner <jturner.usa@gmail.com> Signed-off-by: Sam James <sam@gentoo.org>
2024-02-16dependencies.py: create DependencyKind enumJohn Turner
The DependencyKind enum allows iterating over the different dependency kinds and represents each dependency kind as a type. This could later be used in APIs for selecting specific dependency kinds in queries. Signed-off-by: John Turner <jturner.usa@gmail.com> Signed-off-by: Sam James <sam@gentoo.org>
2024-01-19eclean: handle when git3-src doesn't exist (port to Pathlib)Siddhanth Rathod
Followup to c584d83705a2ca08961e4f0b541442fdf9a75947. Bug: https://bugs.gentoo.org/922455 Signed-off-by: Siddhanth Rathod <xsiddhanthrathod@gmail.com> Closes: https://github.com/gentoo/gentoolkit/pull/41 Signed-off-by: Sam James <sam@gentoo.org>
2024-01-19NEWS, meson.build: prepare for gentoolkit-0.6.5Sam James
Signed-off-by: Sam James <sam@gentoo.org>
2024-01-19eclean: fix eclean-dist with no git3-src dirSam James
Bug: https://bugs.gentoo.org/922455 Signed-off-by: Sam James <sam@gentoo.org>