Each run() call opens and closes the exec context, so a compile that issues
one remote command at a time opened and closed the SSH connection for every
command: a single deploy on dynamix opened around a hundred sessions and
took several minutes.
run() opens and closes through the FileContext reference counter, so
holding the context (and the secret store) open for the whole compile turns
the per-command open() / close() pairs into counter bumps, and the
connection is established only once. This commit wraps the target listing
and the per-target loop in an "async with" on both, which drops the counter
to zero at end of scope and closes the contexts.
Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v1.5.2
Signed-off-by: Jan Lindemann <jan@janware.com>
The compile phase of a secrets deploy makes one SSH round-trip per package
to list the package files. On a host with nine packages, that is nine
round-trips.
Make match_files() pass the whole name list to pkg_paths() in one call: the
distro backends already accept a list and issue a single file-listing
command.
Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v1.5.2
Signed-off-by: Jan Lindemann <jan@janware.com>
The first Ctrl-C cancels the running task while the SSH connection is still
open, but _run_ssh() has no cleanup: the connection is abandoned and the
remote process is never signalled. A long-running command such as zypper
dup therefore keeps running after the client dies, taking its children with
it and leaving the system in a half-baked state, e.g. a mid-air package
transaction.
Catch the cancellation inside the run, forward SIGINT to the remote
process, and wait for it to exit, draining the captured output, before
propagating the cancellation.
Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v1.5.2
Signed-off-by: Jan Lindemann <jan@janware.com>
Do the filtering outside of KvFile, in a standard way.
KvFile currently instantiates its backend distro with a self-instantiated
backend filter, and doesn't propagate the filter passed to its ctor up to
its base class. This arrangement makes it hard to ensure the class behaves
in a standardish way. Allowing the base class filter to do its work, and
not pass any filter to the backend context, is the more straightforward
architecture, this is what this commit does.
The base class still has some freedom to create a filter. Override the base
class's _create_path_filter() to make sure that filter is a PkgSecrets /
pkg-secrets: filter, anything else is not thought through at this point.
Signed-off-by: Jan Lindemann <jan@janware.com>
.jw-secret and .jw-secret-file detection on a distro's packages should
happend in a central place. PkgSecrets.distro_target_paths() is that place,
use it, instead of rolling our own detection loop. .target_paths() is a
welcome performance-enhancement, reusing PkgSecret's cache.
Signed-off-by: Jan Lindemann <jan@janware.com>
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>
Rename lib.ec.secret_store.layout.content_name() to target_name() and
KvFile's config_path to target_path(). "Target" is a better name to settle
on instead of "config" or "content". It's used in other contexts, too,
referring to secret compilation output.
Signed-off-by: Jan Lindemann <jan@janware.com>
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>
After the introduction of path-based filters, accompany the existing
pkg_paths() method by a more fine-grained paths() method, taking a
PathFilter instead of a PackageFilter. It additionally takes a "pkg_names"
argument, which is then dispatched to the filter if it's a package filter.
The API isn't glorious, but works for now and is easily changeable in the
future: **kwargs comes to mind, or a PackageFilter which brings its own
package names.
Signed-off-by: Jan Lindemann <jan@janware.com>
Make the __create_path_filter() closure an overwritable, protected method
_create_path_filter(), and add _set_path_filter() to allow subclasses to
hook into external path filter manipulations, too.
Signed-off-by: Jan Lindemann <jan@janware.com>
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>
"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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>