Summary: | Implement GLEP 74 full-tree verification support | ||
---|---|---|---|
Product: | Portage Development | Reporter: | Michał Górny <mgorny> |
Component: | Core - Ebuild Support | Assignee: | Portage team <dev-portage> |
Status: | CONFIRMED --- | ||
Severity: | enhancement | CC: | esigra, hasufell |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
See Also: |
https://bugs.gentoo.org/show_bug.cgi?id=64258 https://bugs.gentoo.org/show_bug.cgi?id=901385 |
||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | 650144 | ||
Bug Blocks: | 240187 |
Description
Michał Górny
![]() ![]() ![]() ![]() The central part of gemato API is gemato.recursiveloader module that provides ManifestRecursiveLoader. It automatically verifies and loads sub-Manifests as necessary to proceed. For pure verification behavior, it would be initialized like: import os.path from gemato.recursiveloader import ManifestRecursiveLoader from gemato.openpgp import OpenPGPEnvironment openpgp_env = OpenPGPEnvironment() openpgp_env.import_key('/var/lib/gentoo/gkeys/keyrings/gentoo/release/pubring.gpg') ManifestRecursiveLoader(os.path.join(repository_path, 'Manifest'), verify_openpgp=True, openpgp_env=openpgp_env) Then to clean up temporary files: openpgp_env.close() (OpenPGPEnvironment also supports context manager API) The runtime API bits of interest are: 1. .find_timestamp() -- to get the timestamp from Manifest for checking. GLEP 74 suggests that Portage should refuse to operate if timestamp is much older than time of sync (i.e. mirrors are pushing very old data). 2. .assert_path_verifies(relpath) -- checks a single path in repo against the Manifest. @relpath is the path relative to top repo directory. It can be used both for files that do and do not exist, and it appropriately fails if __exists__ state mismatches. 3. .assert_directory_verifies(relpath) -- checks the whole directory in repo. @relpath is the path relative to top repo directory. It fails for any mismatched file as well as for stray files. Functions 2/3 throw exceptions on Manifest mismatches. Additionally, any function that loads Manifests (starting with the constructor) can throw exception if sub-Manifests fail verification. For full list of exceptions, see `pydoc gemato.exceptions`. I think those functions are enough for the initial implementation. If you have any more ideas, let me know and I can add additional API bits. By the way, there's also .find_dist_entry(distname, package_path) if you want to avoid separate Manifest parsing code for distfiles. And although I haven't tested it, I think RecursiveManifestLoader() will work just fine for processing thick and thin package Manifests for repos not using the full structure. However, I suppose the 'lower level' API of gemato.manifest could be preferred for that. Of course, that assuming you don't mind making Portage depend on gemato unconditionally. *** Bug 480190 has been marked as a duplicate of this bug. *** (I suspect either a lot of this or all of this is already done, but not closing until I or someone actually checks.) |