pkgcore-based QA utility for ebuild repos
Project description
pkgcheck
Dependencies
pkgcheck is developed alongside pkgcore and snakeoil. Running pkgcheck from git will often require both pkgcore and snakeoil from git as well.
For releases, see the required runtime dependencies.
There are also several optional runtime dependencies that add or extend check support in various ways if found on the host system including the following:
git: supports historical queries for git-based repos and commit-related checks
requests: supports various network-related checks
Gentoo-PerlMod-Version: supports Perl package version checks
tree-sitter-bash: used in checks that inspect the CST of ebuilds and eclasess. Must be language version >= 14.
Installing
Installing latest pypi release:
pip install pkgcheck
Installing from git:
pip install https://github.com/pkgcore/pkgcheck/archive/master.tar.gz
Installing from a tarball:
python setup.py install
Usage
Most users will use pkgcheck on the command line via pkgcheck scan to target ebuild repos. See the docs or the man page for more information on running pkgcheck.
It’s also possible to run pkgcheck natively from python. For example, to output the results for a given ebuild repo:
from pkgcheck import scan
for result in scan(['/path/to/ebuild/repo']):
print(result)
This allows third party tools written in python to leverage pkgcheck’s scanning functionality for purposes such as CI or VCS commit support.
Tests
Normal pytest is used, just execute:
pytest
In addition, a tox config is provided so the testsuite can be run in a virtualenv setup against all supported python versions. To run tests for all environments just execute tox in the root directory of a repo or unpacked tarball. Otherwise, for a specific python version execute something similar to the following:
tox -e py311
Adding new checks
Adding a new check consists of 2 main parts: writing the logic and documentation, and adding tests for the check.
Writing the logic
Select the best file for the check under src/pkgcheck/checks/.
Create new classes for the results:
You would need to select the correct result level (style, info, warning, error) - you might want to consult QA team.
You would need to select the correct context: category, package, version, profile, etc.
Add long user friendly documentation for the result.
Implement the desc property which is printed to the user.
Create a new class for the check:
Add long user friendly documentation for the result.
Put the source of input for the check. This is hard, so best case is to find similar check and copy the code.
Define the results it can return.
Implement the feed function.
Adding tests
Select one of the repos under testdata/repos. In most cases you would want standalone.
Add the ebuild/category/test case you want to catch.
cd into this directory, and run pkgcheck scan --cache-dir /tmp -R JsonStream. This should yield the results you want to catch (filter out what you expect).
Add the results to the test case under: testdata/data/repos/${REPO}/${CHECK CLASS}/${RESULT CLASS}/expected.json
If you want to check the fix for the test case, git add the files under testdata/repos/${REPO}, modify to fix the results, and using git diff testdata/repos/${REPO} collect the diff.
Copy similar patch, add the diff to the patch file, and fix file names, under: testdata/data/repos/${REPO}/${CHECK CLASS}/${RESULT CLASS}/fix.patch
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pkgcheck-0.10.32.tar.gz
.
File metadata
- Download URL: pkgcheck-0.10.32.tar.gz
- Upload date:
- Size: 380.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41557803fd7fcaf2a0ebcb91d037b0fdb82decd856359ac991afb101f575572e |
|
MD5 | 281bc4421fcd75f953ef3d7d88ba0dfd |
|
BLAKE2b-256 | 4db0d54a8b92382db9f890195cce73e52fe9cd3b5a0b001ae01a1783b4fe7e52 |
Provenance
The following attestation bundles were made for pkgcheck-0.10.32.tar.gz
:
Publisher:
release.yml
on pkgcore/pkgcheck
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
pkgcheck-0.10.32.tar.gz
- Subject digest:
41557803fd7fcaf2a0ebcb91d037b0fdb82decd856359ac991afb101f575572e
- Sigstore transparency entry: 151023949
- Sigstore integration time:
- Predicate type:
File details
Details for the file pkgcheck-0.10.32-py3-none-any.whl
.
File metadata
- Download URL: pkgcheck-0.10.32-py3-none-any.whl
- Upload date:
- Size: 189.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c3046ac01687ae1f2fec131a42773b1f5ea5257e9bc303ec1a9d93b356d591a |
|
MD5 | deb5a1d5e5b6142ff8d7e106d82fc70d |
|
BLAKE2b-256 | 497db88fdc3a15b5d6f846614eb892d23c57c0201958ead601c157a95088f49d |
Provenance
The following attestation bundles were made for pkgcheck-0.10.32-py3-none-any.whl
:
Publisher:
release.yml
on pkgcore/pkgcheck
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
pkgcheck-0.10.32-py3-none-any.whl
- Subject digest:
9c3046ac01687ae1f2fec131a42773b1f5ea5257e9bc303ec1a9d93b356d591a
- Sigstore transparency entry: 151023950
- Sigstore integration time:
- Predicate type: