Commit graph

5,362 commits

Author SHA1 Message Date
ec00ab9b17
purge-stale-projects.sh: Keep projects without remote
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 5m5s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 5m34s
CI / Packaging test (pull_request) Successful in 0s
purge-stale-projects.sh moves every local git project that is missing from
the personal project list on devgit.janware.com into purged/git/, assuming
each local project mirrors a server-side repository. A project without a
remote mirrors nothing, so it cannot be stale, yet it is moved away just
the same.

Skip a project when its Git repository has no remote, and log that it is
left alone. Projects with a remote keep the existing behaviour and are
purged only when they no longer appear in the server's list of personal
projects.

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-17 13:22:06 +01:00
6fe9eeb546
Release 1.0.0-291
All checks were successful
CI / Packaging - Kali Linux (push) Successful in 5m18s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 6m3s
CI / Packaging test (push) Successful in 0s
v1.0.0-291@kali-rolling/amd64 v1.0.0-291@suse-tumbleweed/x86_64
2026-11-12 00:12:00 +00:00
6a51b9e9a0
[PR jw/#179] pgit.sh, make: Fetch tags in get and pull targets
All checks were successful
CI / Packaging - Kali Linux (push) Successful in 4m49s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 5m31s
CI / Packaging test (push) Successful in 0s
Merge pull request "pgit.sh, make: Fetch tags in get and pull targets"

Upstream-repo: ssh://git@code.janware.com/janware/jw-pkg
Source-branch: jan/fix/20261111-pgit-sh-make-fetch-tags-in-get-and-pull-targets
Target-branch: master
Reviewed-on: #179
2026-11-11 16:53:19 +01:00
c4769cf79f
pgit.sh, make: Fetch tags in get and pull targets
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 5m25s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 5m41s
CI / Packaging test (pull_request) Successful in 0s
Fetch tags with all get and pull targets:

- pgit.sh cmd_get(): add --tags to the top-level fetch, which serves the
  get- and git-get- targets of the topdir and the projects-dir Makefiles
- topdir.mk git-get-pub: add --tags to the pub fetch
- projects-dir.mk git-pull-all: pass --tags to the per-project git pull
  --all
- rules.mk update: pass --tags to git pull
- pkg.sh check_scm(): pass --tags to git pull so the release flow sees the
  release tags of the remote

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-11-11 16:42:08 +01:00
d9628937c8
Release 1.0.0-290
All checks were successful
CI / Packaging - Kali Linux (push) Successful in 4m51s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 5m44s
CI / Packaging test (push) Successful in 0s
v1.0.0-290@kali-rolling/amd64 v1.0.0-290@suse-tumbleweed/x86_64
2026-11-11 07:12:34 +00:00
0c287908ce
[PR jw/#178] pkg.sh: Don't bump an unreleased version
All checks were successful
CI / Packaging - Kali Linux (push) Successful in 4m51s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 5m29s
CI / Packaging test (push) Successful in 0s
Merge pull request "pkg.sh: Don't bump an unreleased version"

Upstream-repo: ssh://git@code.janware.com/janware/jw-pkg
Source-branch: jan/fix/20261111-pkg-sh-don-t-bump-an-unrleased-version
Target-branch: master
Reviewed-on: #178
2026-11-11 07:59:38 +01:00
8dee1ed41e
pkg.sh: Don't bump an unreleased version
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 4m49s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 5m43s
CI / Packaging test (pull_request) Successful in 0s
Return the current version from check_next_version() when the platform has
no release tag for it.  A missing tag together with an unchanged source
means the release commit allocated the version and this platform only has
to release it. The reinstall check then only runs when the tag exists, i.e.
when a release already happened and its installed package might be broken.

This keeps the version from being bumped twice in the same release run.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-11-11 07:47:54 +01:00
623254fcab
[PR jw/#177] pkg.sh: Move release bookkeeping from the RELEASES file to Git tags
All checks were successful
CI / Packaging - Kali Linux (push) Successful in 4m59s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 5m32s
CI / Packaging test (push) Successful in 0s
Merge pull request "pkg.sh: Move release bookkeeping from the RELEASES file to Git tags"

Upstream-repo: ssh://git@code.janware.com/janware/jw-pkg
Source-branch: jan/feature/20261110-pkg-sh-move-release-bookkeeping-from-the-releases-file-to-git-tags
Target-branch: master
Reviewed-on: #177
2026-11-10 14:06:19 +01:00
a24769a840
pkg.sh: Drop the RELEASES file in the release commit
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 5m20s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 5m46s
CI / Packaging test (pull_request) Successful in 0s
The release tags replace the RELEASES bookkeeping, but the file is still
tracked in jw-pkg and in every other project repo, and removing it by hand
in each of them does not scale.

Make check_update_version() remove the RELEASES file from the tree in the
release commit itself when it is still there, so the next release of each
project drops it automatically. The removal is git only, as the release
flow is; a repo without a tracked RELEASES file is unaffected.

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-10 13:55:09 +01:00
bb1353cfb3
pkg.sh: Use tags instead of RELEASES file
If a release on a platform is due is decided by checking if the version /
platform / architecture combination is recorded in RELEASES. This commit
moves that bookkeeping from RELEASES to Git tag.

Create a git tag per release, named after the version and the platform
of the RELEASES entry, so "kali-rolling/amd64: 1.0.0-288" becomes the
tag v1.0.0-288@kali-rolling/amd64, and push the branch commit and
the tag. The tag message keeps the previous commit message, "Release
<version>@<platform>".

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-10 13:55:09 +01:00
a968352d16
pkg.sh: Retitle release commits "Release <version>"
The current "Start version" commit subject sits well in a history of
commits where that commit is followed by commits which complete a release
of that version on a respective platform. Those checkpoints are going to move
out of commits to Git tags, with only one commit per version remaining. So,
label the version bump commit simply "Release <version>" instead.

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-10 13:55:09 +01:00
1be510e9af
[PR jw/#176] Add dependency flavour "lint"
All checks were successful
CI / Packaging - Kali Linux (push) Successful in 4m54s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 5m30s
CI / Packaging test (push) Successful in 0s
Merge pull request "Add dependency flavour "lint""

Upstream-repo: ssh://git@code.janware.com/janware/jw-pkg
Source-branch: jan/feature/20261110-add-the-lint-dependency-flavour-and-drop-the-imports-it-flags
Target-branch: master
Reviewed-on: #176
2026-11-10 11:40:34 +01:00
8752440bc0
topdir.mk, project.conf: Add new dep flavour "lint"
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 5m10s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 5m43s
CI / Packaging test (pull_request) Successful in 0s
Add a new dependency flavour named "lint", in addition to the existing
flavours run, build, devel and release, to declare the dependencies needed
for static linting. Those are deliberately not lumped into the build
flavour, because that might add dependencies that are hard to satisfy on
some platforms that should remain buildable.

Start easy, with OpenSUSE only, because Tumbleweed provides pyright and
ruff in its core repositories. That should be enough for a first canary in
CI. Tighter linting should be added by follow-up PRs.

Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v1.5.1
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-11-10 11:29:38 +01:00
1fa738553e
lib.FilesContext: Drop unused and duplicate imports test
Ruff complains about unused and duplicate imports in FilesContext's test,
fix that.

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-10 11:29:38 +01:00
560a25ba17
Release 1.0.0-289@suse-tumbleweed/x86_64
All checks were successful
CI / Packaging - Kali Linux (push) Successful in 4m51s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 5m3s
CI / Packaging test (push) Successful in 0s
2026-11-10 05:12:39 +00:00
d3f455044e
Release 1.0.0-289@kali-rolling/amd64
All checks were successful
CI / Packaging - Kali Linux (push) Successful in 4m52s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m54s
CI / Packaging test (push) Successful in 0s
2026-11-10 00:13:33 +00:00
42777e26ef
Start version: 1.0.0-289 2026-11-10 00:12:18 +00:00
e5761a93ef
[PR jw/#175] cmds.posix.CmdCopy: Don't copy(App.exec_context.path_filter)
All checks were successful
CI / Packaging - Kali Linux (push) Successful in 4m50s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m58s
CI / Packaging test (push) Successful in 0s
Merge pull request "cmds.posix.CmdCopy: Don't copy(App.exec_context.path_filter)"

Upstream-repo: ssh://git@code.janware.com/janware/jw-pkg
Source-branch: jan/fix/20261109-cmds-posix-cmdcopy-don-t-copy-app-exec-context-path-filter
Target-branch: master
Reviewed-on: #175
2026-11-09 22:25:29 +01:00
7ca07b21fe
cmds.posix.CmdCopy: Don't copy(App.exec_context.path_filter)
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 5m14s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 5m10s
CI / Packaging test (pull_request) Successful in 0s
The App's target exec context's path_filter gets passed to util.copy().
That might be a fine idea, but the semantics are too hard to understand at
this point, so, if copy should be limited by a path filter, it should to be
passed as a query string attached to the source- or target file context.

This commit enforces just that by dropping the default_exec_context
argument to copy().

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-09 22:14:59 +01:00
7df9c3ce02
[PR jw/#174] lib.ExecApp, ec.Local: Don't use keyword "local" as URI
All checks were successful
CI / Packaging - Kali Linux (push) Successful in 4m53s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 5m5s
CI / Packaging test (push) Successful in 0s
Merge pull request "lib.ExecApp, ec.Local: Don't use keyword "local" as URI"

Upstream-repo: ssh://git@code.janware.com/janware/jw-pkg
Source-branch: jan/fix/20261109-lib-execapp-ec-local-don-t-use-keyword-local-as-uri
Target-branch: master
Reviewed-on: #174
2026-11-09 21:16:49 +01:00
e2449e0591
lib.ExecApp, ec.Local: Don't use keyword "local" as URI
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 5m16s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 5m12s
CI / Packaging test (pull_request) Successful in 0s
ExecApp's --target parameter and the ec.Local.__init__()'s uri argument carry
"local" as their default value which was meant as a keyword but doesn't pass
as an URI. Fix that.

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-09 21:06:03 +01:00
ec142057bf
[PR jw/#173] cmds.secrets.lib.FilesContext: Write the compile output unfiltered
All checks were successful
CI / Packaging - Kali Linux (push) Successful in 4m55s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 5m0s
CI / Packaging test (push) Successful in 0s
Merge pull request "cmds.secrets.lib.FilesContext: Write the compile output unfiltered"

Upstream-repo: ssh://git@code.janware.com/janware/jw-pkg
Source-branch: jan/fix/20261109-cmds-secrets-lib-filescontext-write-the-compile-output-unfiltered
Target-branch: master
Reviewed-on: #173
2026-11-09 20:13:27 +01:00
508bbd613d
cmds.secrets.lib.FilesContext: Write the compile output unfiltered
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 5m21s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 5m10s
CI / Packaging test (pull_request) Successful in 0s
The path filter of the exec context filtered the compile's own file
operations: put() and rename() silently no-op on a filtered path, stat()
raises, and the compile swallows that into a false '<missing>' verdict.
A compile-templates run with a path filter therefore reported '@content'
for every template while installing nothing, and left the empty temp files
behind.

The filter scopes the distro's package selection, not the command's own
output. Write the compiled file and its temp unfiltered: put, stat, the
read of the previous output, rename, and unlink. The reads of the template
and of the attribute files keep the filter.

Add a unit test with a context whose package space holds only the template:
the output must be written and no temp must leak.

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-09 20:02:51 +01:00
90c27fca24
Release 1.0.0-288@suse-tumbleweed/x86_64
All checks were successful
CI / Packaging - Kali Linux (push) Successful in 4m53s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m59s
CI / Packaging test (push) Successful in 0s
2026-11-09 09:29:15 +00:00
2205155478
Release 1.0.0-288@kali-rolling/amd64
All checks were successful
CI / Packaging - Kali Linux (push) Successful in 5m27s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m57s
CI / Packaging test (push) Successful in 0s
2026-11-09 08:59:59 +00:00
c6f43619f2
Start version: 1.0.0-288 2026-11-09 08:58:44 +00:00
5650f2700d
[PR jw/#172] projects-dir.mk: Fix target pkg-delete-ours filter
All checks were successful
CI / Packaging - Kali Linux (push) Successful in 5m1s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m58s
CI / Packaging test (push) Successful in 0s
Merge pull request "projects-dir.mk: Fix target pkg-delete-ours filter"

Upstream-repo: ssh://git@code.janware.com/janware/jw-pkg
Source-branch: jan/fix/20261109-projects-dir-mk-fix-target-pkg-delete-ours-filter
Target-branch: master
Reviewed-on: #172
2026-11-09 09:33:31 +01:00
9e22933165
projects-dir.mk: Fix target pkg-delete-ours filter
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 5m22s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 5m21s
CI / Packaging test (pull_request) Successful in 0s
Since jw/#170, jw-pkg packages select expects the filter string in
"name:rest" form. The old spec "url =~ janware" is now illegal and breaks
CI, "make pkg-delete-ours" prints an error and deletes nothing.

Fix the filter's spec to "pkg:url=~janware", which matches installed
packages whose URL contains "janware", i.e. our packages.

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-09 09:22:43 +01:00
e147005c21
[PR jw/#171] lib.distros.debian.Distro._install(): Protect installed same-version packages
All checks were successful
CI / Packaging - Kali Linux (push) Successful in 4m44s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m54s
CI / Packaging test (push) Successful in 0s
Merge pull request "lib.distros.debian.Distro._install(): Protect installed pkgs"

Upstream-repo: ssh://git@code.janware.com/janware/jw-pkg
Source-branch: jan/feature/20261108-lib-distros-debian-distro-install-protect-installed-pkgs
Target-branch: master
Reviewed-on: #171
2026-11-08 13:24:26 +01:00
302d3fe791
lib.distros.debian.Distro._install(): Protect installed pkgs
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 5m14s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 5m30s
CI / Packaging test (pull_request) Successful in 0s
apt 3.x distinguishes versions with the same version number by their
control metadata, so a .deb installed with dpkg -i that differs from the
repository's same-version package is regarded as a separate version, and
apt-get install of the package name "upgrades" it to the repository
version, replacing the installed package. If the installed package was
built from the source code repo's master, this is effectively a downgrade
and can break a CI run in currently unintended ways.

This commit detects same-version packages in apt-get's install todo list by
running apt-get -s install (simulate installation), parsing the output, and
removing those packages from the command line of the subsequent, real
install command.

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-08 13:13:34 +01:00
c16bc81d67
[PR jw/#170] lib.ExecApp: Rename --pkg-filter to --path-filter
All checks were successful
CI / Packaging - Kali Linux (push) Successful in 5m17s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 5m39s
CI / Packaging test (push) Successful in 0s
Merge pull request "lib.ExecApp: Rename --pkg-filter to --path-filter"

Upstream-repo: ssh://git@code.janware.com/janware/jw-pkg
Source-branch: jan/feature/20261107-lib-execapp-rename-pkg-filter-to-path-filter
Target-branch: master
Reviewed-on: #170
2026-11-07 19:52:11 +01:00
0373ae3134
lib.ExecApp: Rename --pkg-filter to --path-filter
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 5m17s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 5m27s
CI / Packaging test (pull_request) Successful in 0s
The exec context's default filter selects paths, not just packages, so the
pkg spelling of the option and environment variable that set it no longer
fit. Rename both and some variables accordingly:

- ExecApp: --pkg-filter becomes --path-filter, and the fallback environment
  variable JW_DEFAULT_PKG_FILTER becomes JW_DEFAULT_PATH_FILTER
- Distro: the default_pkg_filter constructor argument and property become
  default_path_filter, matching FileContext, ExecContext, and CopyContext;
  App and KvFile pass the renamed argument
- Adapt the help test's expected output and the unit tests

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:37:27 +01:00
bc54e4f3b2
lib.ec.secret_store.KvFile: Init filter in FC-style
Drop the re-read of JW_DEFAULT_PKG_FILTER, and derive the filter from the
ctor and URI like all other FileContext instances would. Use that to filter
the backend for the packages provinding secrets.

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:32:34 +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
09d76249f3
lib.ExecApp: Move .path_filter into the app's ExecContext
Create an app's exec context with the user-specified path filter, and drop
the ExecApp.path_filter property, now a duplicate of
exec_context.path_filter. Use the latter in the two call sites.

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:23:33 +01:00
685ed51935
cmds.pkg.CmdSelect: Load path filter dynamically
The select command names PackageFilterString directly, but the filter is a
spec string and the class is resolved dynamically by the loader. Build the
filter through PathFilter.create() so the concrete class no longer appears
at the call site.

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:23:14 +01:00
9197e51439
lib.Distro: Widen the package filter to PathFilter
The default package filter is typed PackageFilter, but it is handed over
from file contexts that carry a PathFilter. Widen the default_pkg_filter
parameter.

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:22:58 +01:00
774ab215de
lib.pf.Pkg: Add module
Add the Pkg path filter to the lib.pf module, the loader-visible home
of the package filter spec. A spec of the form pkg:criterion=~regex
instantiates Pkg through PathFilter.create(). The parsing duplicates the
one of PackageFilterString for now; a later commit consolidates the two.

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:22:19 +01:00
f74dca5a45
lib.PackageFilter: Derive from PathFilter
This commit moves package-based filtering from the package level to the
path level, using the new path filter framework. Derive PackageFilter from
a new FileContextFilter base, which binds a PathFilter to the FileContext
it guards, and implements _access().

The filter's space is the file list of the packages it selects, taken from
the backing distro's pkg_files(). An address is allowed only if it names
one of those files.

The backing distro is taken from the file context, if the context carries
one, and is otherwise autodetected from the host the context executes on,
so the filter also works on a bare exec context. A context that is not an
exec context and carries no distro rejects path queries with an error.

The filter string now follows the loader syntax, pkg:url=~ regex, and
a bare url=~regex like the old url=~jw.dev form is rejected; update
JW_DEFAULT_PKG_FILTER values accordingly.

PackageFilter's match() is renamed match_pkg(), to make clear that it
matches packages, and Distro._select() calls the new name.

ExecApp.path_filter builds the filter through PathFilter.create() and
binds it to the exec context. CmdSelect passes its argument to the new
constructor, CmdCopy hands the app's filter to the copy, and the App distro
picks it up as the default package filter.

Extend the unit test to cover the space membership and the distro lookup.

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:22:12 +01:00
d27bf01714
lib.util.copy(): Add optional default_path_filter
Hand the new default_path_filter parameter to the CopyContext copy() opens,
and to the recursive calls it makes for a list of URIs, so an app can limit
the addresses a copy touches the same way it limits its own contexts.

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 17:00:08 +01:00
4117143c05
lib.CopyContext: Add optional default_path_filter
CopyContext creates its src and dst contexts from URIs when they are
not given as instances. Pass an optional default_path_filter into that
creation, so a copy made under a filter limits the addresses it reads and
writes. A context given as an instance keeps the filter it already carries.

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 16:58:10 +01:00
c2c8db2737
lib.FileContext: Limit accessible addresses
Allow to attach a default path filter to a FileContext, given in the
constructor as default_path_filter, or in the URI query as "path-filter".
Passing False as default_path_filter will make the FileContext ignore any
path-filter in the query.

The filter is created lazily on first use through PathFilter.create(), so a
string spec is loaded from the lib.pf module like any other filter.

Every path based action evaluates the filter before it is carried out.
An IGNORE verdict is logged and the action is skipped: reads and stats
raise FileNotFoundError, writes, unlinks, erases, renames, and mkdirs are
no-ops, and readdir() drops the filtered entries. An ABORT verdict raises
PermissionError.

Every path-driven method also takes a flag parameter, "filtered",
defaulting to True, so a caller that must work regardless of the context's
filter can opt out of the check.

Add a unit test that exercises the verdicts, the filtered bypass, and the
distribution probe on a Local context.

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 16:49:24 +01:00
013636fa38
lib.PathFilter / lib.pf: Add class + module
Add the abstract PathFilter class, designed to be attached to a FileContext
in later commits. This is the first commit of a series that generalizes the
JW_DEFAULT_PKG_FILTER / --pkg-filter framework into loadable path filters
that can be attached to any FileContext.

A filter answers an access check, _access(), with a bool. run() turns the
answer into a verdict: ALLOW when the check passes, otherwise ABORT or
IGNORE according to the filter's deny action, LOG or ABORT. The verdict is
handled by the filter's handle, a pair of per-verdict gates: with the ABORT
gate set, an ABORT verdict raises PermissionError; with the LOG gate set,
an IGNORE verdict is logged and returned. A verdict whose gate is not set
passes through unhandled.

Also add the lib.pf module that hosts the concrete filters. A filter spec
of the form foo:something is loaded by PathFilter.create() as the Foo class
from the jw.pkg.lib.pf.Foo module. A spec without the name prefix, or a
name that no module provides, is rejected with an error that names the
expected class and module.

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 16:47:55 +01:00
bed3e90169
[PR jw/#169] lib.util.copy(): Require recursive for directories
All checks were successful
CI / Packaging - Kali Linux (push) Successful in 4m49s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 5m0s
CI / Packaging test (push) Successful in 0s
Merge pull request "lib.util.copy(): Require recursive for directories"

Upstream-repo: ssh://git@code.janware.com/janware/jw-pkg
Source-branch: jan/feature/20261107-lib-util-copy-require-recursive-for-directories
Target-branch: master
Reviewed-on: #169
2026-11-07 14:35:41 +01:00
9cdafbba26
[PR jw/#168] lib.ec.secret_store.Sops: Don't encrypt annotations
Some checks failed
CI / Packaging test (push) Has been cancelled
CI / Packaging - Kali Linux (push) Has been cancelled
CI / Packaging - OpenSUSE Tumbleweed (push) Has been cancelled
Merge pull request "lib.ec.secret_store.Sops: Don't encrypt annotations"

Upstream-repo: ssh://git@code.janware.com/janware/jw-pkg
Source-branch: jan/feature/20261107-lib-ec-secret-store-sops-don-t-encrypt-annotations
Target-branch: master
Reviewed-on: #168
2026-11-07 14:25:46 +01:00
e9a93ece35
lib.util.copy(): Require recursive for directories
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 4m51s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 5m0s
CI / Packaging test (pull_request) Successful in 0s
copy() handed a non-recursive copy of a directory to the single-object
get() path. For a plain context the backend then fails with a transport
error, and for a kvfile store the store root is a branch, not an entry,
so the get() fails with a FileNotFoundError naming a transformed address:
copying "kvfile:///etc" reported "FileNotFoundError: etc".

Require recursive for a directory source that is not fetchable as a whole,
as cp requires -r for directories: copy() now raises with a message naming
the source and the recursive option, instead of falling through to get().

Add a unit test that covers a directory source for a plain context and a
kvfile store.

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 14:16:09 +01:00
3f29084790
lib.ec.secret_store.Sops: Don't encrypt annotations
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 5m28s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 5m7s
CI / Packaging test (pull_request) Successful in 0s
SERVICE_SECRET[n] keys of an entry are used as rotation metadata by
downstream software, and their values don't need to be kept secret: they
name the macro and the account that owns it. Encrypting them buys nothing,
and it forces every annotation tool to decrypt and re-encrypt the whole
entry for a one-line read or edit.

Run sops encrypt with --unencrypted-regex SERVICE_SECRET, so the annotation
keys stay plain text in the repository file and the store stays greppable
without the age key, and with --mac-only-encrypted, so the MAC covers the
encrypted values only and the annotation lines can be edited as plain text
without invalidating the file.

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 14:13:26 +01:00
8ee5c7e589
[PR jw/#167] lib.ec.secret_store.KvFile: Refactor and construct from a URI
All checks were successful
CI / Packaging - Kali Linux (push) Successful in 5m4s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 5m1s
CI / Packaging test (push) Successful in 0s
Merge pull request "lib.ec.secret_store.KvFile: Refactor and construct from a URI"

Upstream-repo: ssh://git@code.janware.com/janware/jw-pkg
Source-branch: jan/feature/20261107-lib-ec-secret-store-kvfile-refactor-and-construct-from-a-uri
Target-branch: master
Reviewed-on: #167
2026-11-07 14:04:56 +01:00
fae3390a50
lib.ec.secret_store.KvFile: Fail get() on directories
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 5m16s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 5m13s
CI / Packaging test (pull_request) Successful in 0s
A directory node of the store, the root included, stats as a directory, but
a get on it falls through to the key lookup below its parent and fails with
a FileNotFoundError naming a path the caller never asked for: get() on the
root fails with an empty name, get() on a branch with its parent's compound
path.

Raise IsADirectoryError from _get() when the path is a directory on the
host, after the compound and the blob lookups, so get() and stat() agree: a
directory stats as FT_DIR and refuses a get.

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
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