jw-pkg/test/unit/python
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Jan Lindemann e96bfca0e1
lib.ec.secret_store.KvFile: Construct from a URI
KvFile.__init__() accepts a host FileContext plus an optional Distro, and
the two may live on different hosts. In effect, files are read from one
host based on another host's package set, which may have its use cases but
is generally undesirable. The context parameter also breaks the uniformity
of the store constructors: Sops, TarGpg, and Vault are constructed from a
URI alone, and FileContext.create() needs a special case that builds the
kvfile store's inner context before handing it to the constructor.

This commit has KvFile constructed from a URI alone like the other stores.
The URI's authority names the host, no authority means "local", and the
constructor builds the inner context through FileContext.create() with
chroot off, forwarding the store's constructor parameters to it. The inner
context is always an exec context, which the distro derivation needs: it is
lazy, Distro.instantiate() runs on the first file listing, with the
JW_DEFAULT_PKG_FILTER environment variable as the default package filter,
as before.

Adapt all call sites:

- FileContext.create(): the kvfile case returns KvFile(uri) directly.
- FilesContext: the distro parameter goes; the store URI is derived from
  the exec context's scheme, authority, and path, so a local context with a
  hostname in its URI stays local.
- DistroContext.install(): the kvfile source wrap goes; the compounds read
  directly through the source context with parse_kv().
- The store tests monkey-patch Distro.instantiate() for the stores that
  list something

Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v1.5.0
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-11-07 13:54:19 +01:00
..
jw lib.ec.secret_store.KvFile: Construct from a URI 2026-11-07 13:54:19 +01:00
Makefile jw.pkg.lib.Uri: Add unit test 2026-06-25 19:08:02 +02:00