Commit graph jw-pkg/test/unit/python/jw/pkg/lib/pf
Author SHA1 Message Date
2416257cba
lib.pf.PkgSecrets: Add
The on-host store scopes its address space to the config paths backed by
installed packages, but the scope lives inside KvFile: it derives the set
from the distro itself and consults it in the individual operations. A
context that carries a filter must behave as the filter mandates, so the
wanted set belongs in a filter of its own.

Add the pkg-secrets path filter, a Pkg whose space is the config paths
of the matching packages' template files - the path with the .jw-tmpl
suffix stripped - plus the directories leading to them. A compound or
blob address maps to its config path, a key address to the config path
of the compound it lives under; any other address is judged on its own.
The spec form follows pkg: a bare spec matches every installed package,
and pkg-secrets:url=~REGEX narrows the backing set to packages whose url
matches. Pkg parses its criterion through an overridable _parse_spec(), and
its _match_pkg() matches every package on a None criterion, so both filters
share the parsing and matching code.

Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v1.5.2
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-11-18 19:13:01 +01:00
ea751d3949
pf.Pkg._access(): Use Distro.paths()
Distro.paths() now allows to spare a detour in Pkg._access() - we can
directly get to the list of paths instead of via Distro.select() ->
pkg_paths().

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-11-18 19:13:01 +01:00
372356a8df
lib.util: Add kebab_to_pascal() and pascal_to_kebab()
PathFilter.create() currently instantiates individual filters in a match -
case over the filter URI's protocol. The plan is to instantiate filters
without match / case based on a protocol naming scheme only, so we better
introduce one at this point. Adopt jw-python's kebab_to_pascal() and
pascal_to_kebab() functions as a foundation for a future naming convention.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-11-18 19:13:01 +01:00
5ac36ec271
lib.Distro.pkg_files() -> .pkg_paths()
"files" is a term that can be used for many aspects of a file, its path,
its content, a handle, so better use "pkg_paths" instead of "pkg_files" for
Distro's method to inform about which files a package holds. That also
aligns better with the recent move from PackageFilter toward PathFilter.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-11-18 19:13:01 +01:00
0b1ff0727a
lib.pf.Pkg: Consolidate PackageFilter, drop PackageFilterString
PackageFilterString and Pkg are duplicates. The PackageFilter and
FileContextFilter base classes live in lib/PackageFilter.py, imported by
Pkg, Distro, and the tests.

Move the two base classes into lib/pf/Pkg.py (where Pkg already lives),
drop PackageFilterString, delete lib/PackageFilter.py, and repoint Distro
and the tests to the new location. Move the test suite with the module to
test/.../pf/Pkg/.

Signed-off-by: Jan Lindemann <jan@janware.com>
Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v1.5.0
2026-11-07 19:30:58 +01:00