aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* meson.build: prepare for gentoolkit-0.6.8HEADgentoolkit-0.6.8masterMatt Turner2024-09-091-1/+1
| | | | Signed-off-by: Matt Turner <mattst88@gentoo.org>
* merge_driver_ekeyword: Add build systemMatt Turner2024-06-254-0/+49
| | | | Signed-off-by: Matt Turner <mattst88@gentoo.org>
* merge_driver_ekeyword: Run blackMatt Turner2024-06-201-21/+39
| | | | Signed-off-by: Matt Turner <mattst88@gentoo.org>
* merge_driver_ekeyword: Add testsMatt Turner2024-06-2017-0/+681
| | | | | | And provide a Makefile to generate the test data from gentoo.git. Signed-off-by: Matt Turner <mattst88@gentoo.org>
* merge_driver-ekeyword: split out merge_keywords functionMatt Turner2024-06-071-15/+19
| | | | Signed-off-by: Matt Turner <mattst88@gentoo.org>
* bin/merge-driver-ekeyword: Move logic to a separate moduleMatt Turner2024-06-073-134/+145
| | | | | | To facilitate unit testing. Signed-off-by: Matt Turner <mattst88@gentoo.org>
* bin/merge-driver-ekeyword: Don't pass program name to main()Matt Turner2024-06-071-6/+6
| | | | Signed-off-by: Matt Turner <mattst88@gentoo.org>
* bin/merge-driver-ekeyword: Don't sys.exit() from main()Matt Turner2024-06-071-5/+5
| | | | | | Makes unit testing easier. Signed-off-by: Matt Turner <mattst88@gentoo.org>
* bin/merge-driver-ekeyword: Store merged output in correct locationMatt Turner2024-06-071-0/+3
| | | | | Fixes: a667d93 ("bin/merge-driver-ekeyword: Look for KEYWORDS changes in upstream commit") Signed-off-by: Matt Turner <mattst88@gentoo.org>
* ekeyword: Remove dead MakefileMatt Turner2024-06-072-19/+0
| | | | | | Has been dead since commit c819d14 in 2009. Signed-off-by: Matt Turner <mattst88@gentoo.org>
* bin/merge-driver-ekeyword: Look for KEYWORDS changes in upstream commitMatt Turner2024-05-241-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | 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>
* bin/merge-driver-ekeyword: Two blank lines after function defMatt Turner2024-05-241-0/+1
| | | | Signed-off-by: Matt Turner <mattst88@gentoo.org>
* bin/merge-driver-ekeyword: Remove unused importsMatt Turner2024-05-241-1/+1
| | | | | Fixes: 1a2c70d ("Run `pyupgrade --py39-plus`") Signed-off-by: Matt Turner <mattst88@gentoo.org>
* meson.build: prepare for gentoolkit-0.6.7gentoolkit-0.6.7Sam James2024-05-081-1/+1
| | | | Signed-off-by: Sam James <sam@gentoo.org>
* eclean: dist: make VCS cleaning dependent on --deepSam James2024-05-032-3/+4
| | | | | | | | | | | | 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>
* package: update example PORTDIR pathSam James2024-05-031-3/+3
| | | | Signed-off-by: Sam James <sam@gentoo.org>
* man: update default PKGDIR location to /var/cache/binpkgsSam James2024-05-031-1/+1
| | | | Signed-off-by: Sam James <sam@gentoo.org>
* man: document eclean-dist's --skip-vcsSam James2024-05-031-0/+2
| | | | | Bug: https://bugs.gentoo.org/923369 Signed-off-by: Sam James <sam@gentoo.org>
* eclean: dist: fix crash with excluded itemsSam James2024-05-031-0/+1
| | | | | Bug: https://bugs.gentoo.org/915055 Signed-off-by: Sam James <sam@gentoo.org>
* eclean: dist: fix printing VCS clean items with --quietSam James2024-05-031-2/+5
| | | | | Bug: https://bugs.gentoo.org/928951 Signed-off-by: Sam James <sam@gentoo.org>
* eclean: dist: fix copyright headersSam James2024-05-034-4/+4
| | | | Signed-off-by: Sam James <sam@gentoo.org>
* eclean: dist: fix typo in commentSam James2024-05-031-2/+2
| | | | Signed-off-by: Sam James <sam@gentoo.org>
* eclean: dist: fix operating on an empty directorySam James2024-05-031-1/+2
| | | | | | | | 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>
* meson.build: prepare for gentoolkit-0.6.6gentoolkit-0.6.6Sam James2024-04-251-1/+1
| | | | Signed-off-by: Sam James <sam@gentoo.org>
* distfiles.exclude: whitelist layout.confUlrich Müller2024-04-251-0/+1
| | | | | | | 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>
* distfiles.exclude: whitelist .layout.conf* and .mirror-cache.jsonUlrich Müller2024-04-251-0/+2
| | | | | Signed-off-by: Ulrich Müller <ulm@gentoo.org> Signed-off-by: Sam James <sam@gentoo.org>
* meson: make tests optionalGreg Kubaryk2024-03-122-2/+8
| | | | | | | 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)
* Revert "meson: make tests optional"Sam James2024-03-122-8/+2
| | | | | | This reverts commit 988e47557368df49035eeba94beca893f7b267c1. Signed-off-by: Sam James <sam@gentoo.org>
* ci: enable new test optionSam James2024-03-121-1/+1
| | | | | | | See 988e47557368df49035eeba94beca893f7b267c1. Bug: https://bugs.gentoo.org/926427 Signed-off-by: Sam James <sam@gentoo.org>
* meson: make tests optionalSam James2024-03-122-2/+8
| | | | | | Closes: https://bugs.gentoo.org/926427 Signed-off-by: Greg Kubaryk <greg.kubaryk@gmail.com> Signed-off-by: Sam James <sam@gentoo.org>
* switch test framework to pytestJohn Turner2024-03-072-7/+3
| | | | | | | | | | | | | | | | | | | | 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>
* depends.py: rename DependPrinter to PrinterJohn Turner2024-03-071-4/+4
| | | | | | | | | | | 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>
* equery/depends: print output in module rather than with a callbackJohn Turner2024-03-071-11/+18
| | | | | | | | | | | | | | | | | 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>
* dependencies.py: rewrite graph_reverse_depends to pass testsJohn Turner2024-03-071-66/+36
| | | | | | | | | | | | | | | | | | | 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>
* dependencies.py: introduce unit testing for graph_reverse_dependsJohn Turner2024-03-071-0/+71
| | | | | | | | | | | | | | | | | | | 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>
* dependencies.py: use Enum rather than StrEnum for DependencyKindJohn Turner2024-03-071-4/+4
| | | | | | | | | | | | | | | | 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>
* eclean/search.py: Fix find_packages docstring for invalid_pathsBrian Dolbec2024-02-171-3/+2
| | | | Signed-off-by: Brian Dolbec <dolsen@gentoo.org>
* Initial tests for _deps_equal()Brian Dolbec2024-02-171-0/+157
| | | | Signed-off-by: Brian Dolbec <dolsen@gentoo.org>
* eclean: Handle InvalidDepstring info in _deps_equalBrian Dolbec2024-02-171-6/+48
| | | | | | | | | | | | 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>
* gentoolkit: fix flake8 lint error (F401, unused import)Sam James2024-02-171-1/+0
| | | | | | | pym/gentoolkit/dependencies.py:24:1: F401 'gentoolkit.helpers.uniqify' imported but unused Fixes: c0300517671076db453204c796637e206bf977e5 Signed-off-by: Sam James <sam@gentoo.org>
* enalyze: placate blackSam James2024-02-161-1/+1
| | | | Signed-off-by: Sam James <sam@gentoo.org>
* tox: fix for meson portSam James2024-02-161-8/+7
| | | | Signed-off-by: Sam James <sam@gentoo.org>
* dependencies.py: replace hand rolled depcache with functools.cacheJohn Turner2024-02-161-9/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* dependencies.py: unify get_*depend methodsJohn Turner2024-02-161-17/+15
| | | | | | | | | | | | | | | | | 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>
* dependencies.py: create DependencyKind enumJohn Turner2024-02-161-0/+10
| | | | | | | | | 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>
* eclean: handle when git3-src doesn't exist (port to Pathlib)Siddhanth Rathod2024-01-191-25/+25
| | | | | | | | | 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>
* NEWS, meson.build: prepare for gentoolkit-0.6.5gentoolkit-0.6.5Sam James2024-01-192-1/+5
| | | | Signed-off-by: Sam James <sam@gentoo.org>
* eclean: fix eclean-dist with no git3-src dirSam James2024-01-191-0/+3
| | | | | Bug: https://bugs.gentoo.org/922455 Signed-off-by: Sam James <sam@gentoo.org>
* Revert "ci: add py3.13"Sam James2024-01-191-2/+1
| | | | | | | | This reverts commit e0dc707cc7a37336c175faf463666e5f531a338f. Didn't mean to push this. Signed-off-by: Sam James <sam@gentoo.org>
* tox: update implsSam James2024-01-191-1/+1
| | | | Signed-off-by: Sam James <sam@gentoo.org>