Compare commits

...
Sign in to create a new pull request.
Author SHA1 Message Date
d2b991a28c
Release 1.0.0-294
All checks were successful
CI / Packaging - Kali Linux (push) Successful in 5m20s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 6m11s
CI / Packaging test (push) Successful in 0s
2026-11-21 01:15:06 +01:00
2aaed09356
[PR jw/#183] cmds.secrets.lib.DistroContext: One SSH session per compile
All checks were successful
CI / Packaging - Kali Linux (push) Successful in 4m54s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 5m47s
CI / Packaging test (push) Successful in 0s
Merge pull request "cmds.secrets.lib.DistroContext: One SSH session per compile"

Upstream-repo: ssh://git@code.janware.com/janware/jw-pkg
Source-branch: jan/feature/20261120-cmds-secrets-lib-distrocontext-one-ssh-session-per-compile
Target-branch: master
Reviewed-on: #183
2026-11-20 23:12:06 +01:00
7cec4007da
cmds.secrets.lib.DistroContext: Hold ctx + store open
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 4m49s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 6m6s
CI / Packaging test (pull_request) Successful in 0s
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>
2026-11-20 22:49:57 +01:00
65e55a1119
cmds.secrets.lib.DistroContext: Batch file listing code
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>
2026-11-20 22:49:57 +01:00
8b31d7a091
[PR jw/#182] lib.ec.ssh.AsyncSSH: Forward SIGINT to remote
All checks were successful
CI / Packaging - Kali Linux (push) Successful in 5m21s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 5m48s
CI / Packaging test (push) Successful in 0s
Merge pull request "lib.ec.ssh.AsyncSSH: Forward SIGINT to remote"

Upstream-repo: ssh://git@code.janware.com/janware/jw-pkg
Source-branch: jan/fix/20261120-lib-ec-ssh-asyncssh-forward-sigint-to-remote
Target-branch: master
Reviewed-on: #182
2026-11-20 22:39:15 +01:00
dd67dbf544
lib.ec.ssh.AsyncSSH: Forward SIGINT to remote
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 5m15s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 6m1s
CI / Packaging test (pull_request) Successful in 0s
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>
2026-11-20 22:27:52 +01:00
b47163582d
Release 1.0.0-293
All checks were successful
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 5m41s
CI / Packaging - Kali Linux (push) Successful in 5m0s
CI / Packaging test (push) Successful in 0s
2026-11-19 01:15:01 +01:00
56d2b445e7
[PR jw/#181] Move from package-based to path-based secret-store filters
All checks were successful
CI / Packaging - Kali Linux (push) Successful in 4m53s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 6m39s
CI / Packaging test (push) Successful in 0s
Merge pull request "Move from package-based to path-based secret-store filters"

Upstream-repo: ssh://git@code.janware.com/janware/jw-pkg
Source-branch: jan/feature/20261118-move-from-package-based-to-path-based-secret-store-filters
Target-branch: master
Reviewed-on: #181
2026-11-18 19:24:58 +01:00
f717fe2174
lib.ec.secret_store.KvFile: Use lib.pf.PkgSecrets
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 5m12s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 6m36s
CI / Packaging test (pull_request) Successful in 0s
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>
2026-11-18 19:13:01 +01:00
fc79545c30
lib.ec.secret_store.KvFile: Use PkgSecrets.target_paths()
.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>
2026-11-18 19:13:01 +01:00
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
48ec9fdb95
lib.ec.secret_store: "content|config" -> "target"
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>
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
dc9ef58c8b
lib.Distro.paths(): Add method
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>
2026-11-18 19:13:01 +01:00
9bf5e07da0
lib.FileContext: Add _set / _create_path_filter()
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>
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
31e0d1f3a4
Release 1.0.0-292
All checks were successful
CI / Packaging - Kali Linux (push) Successful in 4m54s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 6m29s
CI / Packaging test (push) Successful in 0s
2026-11-17 17:07:02 +00:00
135018b5b6
[PR jw/#180] purge-stale-projects.sh: Keep projects without remote
All checks were successful
CI / Packaging - Kali Linux (push) Successful in 4m37s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 5m32s
CI / Packaging test (push) Successful in 0s
Merge pull request "purge-stale-projects.sh: Keep projects without remote"

Upstream-repo: ssh://git@code.janware.com/janware/jw-pkg
Source-branch: jan/fix/20261117-purge-stale-projects-sh-keep-projects-without-remote
Target-branch: master
Reviewed-on: #180
2026-11-17 13:32:50 +01:00
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
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
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
39 changed files with 717 additions and 248 deletions

4
HASH
View file

@ -1,4 +1,4 @@
suse-tumbleweed/x86_64: 61628efd05405aa6e6498468b3df7538
suse-tumbleweed/x86_64: 0f11ee4501fcdbb1e99e1b03c1ec2eaa
suse-tumbleweed/i586: 86ea923ca3861900dd03d4b1da44f8b6
debian-10/amd64: 47167eb2d7fe2d845a1b12e0702a6e9b
suse-42.3/x86_64: bd0e29fda82e38c89d2ed6f11797ce3a
@ -7,4 +7,4 @@ debian-8/amd64: b16e55fee0967a75aa67a4d859f0455d
ubuntu-18.04/amd64: 190b5c45953399fd93354db0621d6f5f
debian-10/armhf: 5d92c234d483deaf44c80cad168a8d5d
debian-2025.4/amd64: 977965179baa6fd24d0975a05d583eb6
kali-rolling/amd64: 61628efd05405aa6e6498468b3df7538
kali-rolling/amd64: 9520b93fa4bdb6af3e75a78dd605b5a8

View file

@ -1,10 +0,0 @@
suse-tumbleweed/x86_64: 1.0.0-289
suse-tumbleweed/i586: 1.0.0-44
debian-10/amd64: 1.0.0-47
suse-42.3/x86_64: 1.0.0-48
centos-7/x86_64: 1.0.0-84
debian-8/amd64: 1.0.0-84
ubuntu-18.04/amd64: 1.0.0-99
debian-10/armhf: 1.0.0-102
debian-2025.4/amd64: 1.0.0-172
kali-rolling/amd64: 1.0.0-289

View file

@ -1 +1 @@
1.0.0-289-dev
1.0.0-294-dev

View file

@ -37,6 +37,7 @@ build = realpath
[pkg.requires.suse]
run = python3
release = rpmbuild, python3-base
lint = python3-ruff, python3-pyright
[pkg.requires.debian]
run = python3

View file

@ -353,7 +353,7 @@ git-get-mini: $(SSH_WRAPPER_SH)
PGIT_SH_PROJECTS="$(patsubst %/.git,%,$(wildcard $(addsuffix /.git,$(shell make -s build-order))))" $(PGIT_SH_GET_DEFAULT)
git-pull-all: $(SSH_WRAPPER_SH)
$(PGIT_SH) pull $(PGIT_SH_OPTS_NETWORK) --all
$(PGIT_SH) pull $(PGIT_SH_OPTS_NETWORK) --all --tags
git-get-maintainer: $(SSH_WRAPPER_SH)
PGIT_SH_PROJECTS="$(PROJECTS_WITH_PROJECT_CONF)" $(PGIT_SH) exec make $@

View file

@ -119,7 +119,7 @@ love:
@echo "Not war?"
cvsupdate update:
if [ -d "CVS" ]; then cvs update -dP || exit 1; else git pull && git submodule update --init --recursive || exit 1; fi
if [ -d "CVS" ]; then cvs update -dP || exit 1; else git pull --tags && git submodule update --init --recursive || exit 1; fi
cvsdiff diff:
if [ -d "CVS" ]; then cvs diff -u || exit 1; else git --no-pager diff --relative --no-prefix . || exit 1; fi

View file

@ -280,7 +280,7 @@ git-get-maintainer:
git-get-pub:
set -e; if git remote | grep -q "^pub$$"; then \
git fetch --prune --recurse-submodules=on-demand pub master ;\
git fetch --prune --tags --recurse-submodules=on-demand pub master ;\
git submodule foreach --recursive 'git fetch --tags -f pub' ;\
git rebase --autostash pub/master ;\
git merge --ff-only pub/master ;\
@ -303,7 +303,7 @@ pkg-install-release-deps:
$(PKG_MANAGER) install $(shell $(proj_query_cmd) required-os-pkg --quote "build,run,release" $(PROJECT))
pkg-install-testbuild-deps:
$(PKG_MANAGER) install $(shell $(proj_query_cmd) pkg-requires --quote --hide-self --syntax names-only --delimiter " " "build,run,devel,release" $(PROJECT))
$(PKG_MANAGER) install $(shell $(proj_query_cmd) pkg-requires --quote --hide-self --syntax names-only --delimiter " " "lint,build,run,devel,release" $(PROJECT))
recache-vars:
rm -f $(TOPDIR)/make clean-cache cache

View file

@ -263,7 +263,7 @@ cmd_get()
run_git -C $project_dir remote add $remote_name $pull_url
[ "$from_user" = "$remote_user" ] || run_git -C $project_dir remote set-url --push $remote_name no_push
}
run_git -C $project_dir fetch --prune --recurse-submodules=on-demand $remote_name $from_ref
run_git -C $project_dir fetch --prune --tags --recurse-submodules=on-demand $remote_name $from_ref
run_git -C $project_dir submodule foreach --recursive 'git fetch --tags -f origin'
if [ "$to_ref" ]; then
run_git -C $project_dir rebase --autostash $remote_name/$from_ref $to_ref

View file

@ -85,6 +85,13 @@ write_map()
cmd_version -p `platform` $1 write $2
}
release_tags()
{
# a release of a version on a platform is tagged
# v<version>@<platform>
git tag -l "v*@`platform`"
}
find_path()
{
local p
@ -123,7 +130,7 @@ check_scm()
{
if [ -d .git ]; then
log + checking git
git pull --no-edit || fatal "git pull failed, giving up"
git pull --no-edit --tags || fatal "git pull failed, giving up"
git submodule update --init --recursive || fatal "git submodule update failed, giving up"
git status --porcelain | grep -v '^??' | grep -q . && {
git status
@ -177,12 +184,6 @@ increase_build_no()
check_next_version()
{
local v=`read_map $TOPDIR/VERSION | sed 's/-dev//'`
local n=`read_map -n $TOPDIR/RELEASES | sed 's/-dev//'`
if [ "$n" != "$v" ]; then
echo "+ $PKG_PROJECT version is already at $v, no need to increase for release" >&2
echo $v
return
fi
local h=`calculate_hash`
[ -n "$h" ] || fatal "failed to calculate source hash"
if [ ! -f $TOPDIR/HASH ]; then
@ -190,12 +191,19 @@ check_next_version()
echo $v
return
fi
if ! read_map $TOPDIR/HASH | grep -q $h; then
if ! grep -q $h $TOPDIR/HASH; then
echo "+ $PKG_PROJECT has no matching HASH value, needs release" >&2
increase_build_no $v
return
fi
echo "+ $PKG_PROJECT has unchanged source" >&2
if ! release_tags | grep -qF "v$v@"; then
# the release commit allocated $v and recorded the source hash; a missing tag means
# this platform has not released it yet, so release $v as is
echo "+ $PKG_PROJECT has no release tag for $v on `platform`, needs release" >&2
echo $v
return
fi
if [ "$reinstall_check_failed" = 1 ]; then
echo "version $v is uninstallable, needs release" >&2
increase_build_no $v
@ -274,8 +282,8 @@ check_release_is_current()
done
shift
if ! read_map -n $TOPDIR/RELEASES | grep -Fq $next; then
echo "next version $next is not in RELEASES, needs release" >&2
if ! release_tags | grep -qF "v$next@"; then
echo "next version $next is not released on `platform`, needs release" >&2
return 1
fi
@ -293,7 +301,7 @@ check_release_is_current()
check_update_version()
{
local comment="Start version"
local comment="Release"
set -- `getopt 'c:' "$@"`
while [ "$1" != -- ] ; do
case "$1" in
@ -311,8 +319,19 @@ check_update_version()
local next=`check_next_version`
[ "$next" ] || fatal "Failed to get next version."
if [ "$next" != "$v" ]; then
local h=`calculate_hash`
[ -n "$h" ] || fatal "failed to calculate source hash"
local files="VERSION $TOPDIR/HASH"
# the release tags replace the RELEASES file; the
# release commit drops it from the tree
if [ "$SCM" = git ] && [ -f $TOPDIR/RELEASES ] && \
git rm -qf $TOPDIR/RELEASES 2>/dev/null; then
files="$files $TOPDIR/RELEASES"
fi
echo "$next-dev" > VERSION
scm_commit -m "$comment: $next" VERSION
write_map $TOPDIR/HASH $h
$SCM add $TOPDIR/HASH || true
scm_commit -m "$comment $next" $files
return 0
fi
return 1
@ -373,6 +392,7 @@ cmd_version()
case $cmd in
read)
[ -f "$file" ] || return 0
local p=`echo $platform | sed 's%/%\\\/%g'`
local v=`sed "/$p:/ !d; s/$p: *//" $file`
[ "$v" ] && {
@ -609,8 +629,6 @@ upload_pkg()
set -e
local p
local v=`read_map $TOPDIR/VERSION | sed 's/-dev//'`
local h=`calculate_hash`
[ -n "$h" ] || fatal "failed to calculate source hash"
case $PKG_FORMAT in
rpm)
server=pkg.janware.com
@ -657,17 +675,12 @@ upload_pkg()
;;
esac
write_map $TOPDIR/RELEASES $v
$SCM add $TOPDIR/RELEASES || true
write_map $TOPDIR/HASH $h
$SCM add $TOPDIR/HASH || true
echo "+ scheduling rebuild"
$SSH -l root $server /opt/packager-server/bin/packager-server schedule-rebuild
scm_commit -m "Release $v@`platform`" $TOPDIR/RELEASES $TOPDIR/HASH
if [ "$SCM" = git ]; then
# Don't use extra options, they might contain -l
JW_PKG_SSH_EXTRA_OPTS="" git push || fatal "Failed to push changes to RELEASES and HASH"
fi
local tag="v$v@`platform`"
git tag -m "Release $v@`platform`" "$tag" || fatal "Failed to tag the release as $tag"
# Don't use extra options, they might contain -l
JW_PKG_SSH_EXTRA_OPTS="" git push origin HEAD "$tag" || fatal "Failed to push the release commit and tag $tag"
}
install_exe_wrapper()
@ -1297,7 +1310,7 @@ build)
cmd_build "$@"
;;
release-reinstall)
check_update_version -c "Start version"
check_update_version
cmd_build "$@"
cmd_upload
;;

View file

@ -116,6 +116,7 @@ for vcs in $vcss; do
for p in $local_git_proj; do
[ -L $p ] && continue
[ -d $p ] || continue
git -C $p remote | grep -q . || { log "leaving \"$p\" alone, it has no remote"; continue; }
echo $remote_git_proj | grep -q "\(^\| \)$p\($\| \)" && continue
check_scm $p
echo done checking scm

View file

@ -21,4 +21,4 @@ class CmdLs(NamedPkgsCmd): # export
@override
async def _run(self, args: Namespace) -> None:
for name in args.names:
print('\n'.join(await self.distro.pkg_files(name)))
print('\n'.join(await self.distro.pkg_paths(name)))

View file

@ -71,7 +71,7 @@ class BaseCmdPkgRelations(Cmd):
)
parser.add_argument(
'flavours',
help = 'Dependency flavours (run, build, devel, release), '
help = 'Dependency flavours (lint, run, build, devel, release), '
'separated by comma or whitespace'
)
parser.add_argument('modules', nargs = '*', help = 'Modules')

View file

@ -33,11 +33,12 @@ class DistroContext(FilesContext):
self.__distro = distro
async def match_files(self, pkg_names: Collection[str], pattern: str) -> list[str]:
# -- One query for the whole name list: the distro backends
# accept a list and issue a single file-listing command
ret: list[str] = []
for pkg_name in pkg_names:
for path in await self.__distro.pkg_files(pkg_name):
if re.match(pattern, path):
ret.append(path)
for path in await self.__distro.pkg_paths(list(pkg_names)):
if re.match(pattern, path):
ret.append(path)
return ret
async def list_template_files(self, pkg_names: Collection[str]) -> list[str]:
@ -89,20 +90,25 @@ class DistroContext(FilesContext):
ret: list[str] = []
failed: list[str] = []
missing = 0
targets = await self.list_compilation_targets(pkg_names)
for target in targets:
try:
ok = await self.compile_template_file(target, default_attrs)
except Exception as e:
if not keep_going:
raise
log(ERR, f'{target}: {e}')
failed.append(target)
continue
if ok:
ret.append(target)
else:
missing += 1
# -- Keep the exec context and the store open across the whole
# compile, so the run() calls in the per-target operations
# bump the reference counter instead of opening and closing
# the connection for every remote command.
async with self.ctx, self.store:
targets = await self.list_compilation_targets(pkg_names)
for target in targets:
try:
ok = await self.compile_template_file(target, default_attrs)
except Exception as e:
if not keep_going:
raise
log(ERR, f'{target}: {e}')
failed.append(target)
continue
if ok:
ret.append(target)
else:
missing += 1
if missing > 0:
from ....lib.util import pretty_cmd

View file

@ -10,6 +10,8 @@ from typing import TYPE_CHECKING, Any
from .base import InputMode
from .log import ERR, INFO, WARNING, log
from .PathFilter import Verdict
from .pf.Pkg import PackageFilter
if TYPE_CHECKING:
from collections.abc import Collection
@ -20,7 +22,6 @@ if TYPE_CHECKING:
from .FlaggedFile import FlaggedFile
from .Package import Package
from .PathFilter import PathFilter
from .pf.Pkg import PackageFilter
class Distro(abc.ABC):
@ -504,13 +505,13 @@ class Distro(abc.ABC):
return
return await self._delete(names)
# -- pkg_files
# -- pkg_paths
@abc.abstractmethod
async def _pkg_files(self, names: list[str] | None) -> Iterable[str]:
async def _pkg_paths(self, names: list[str] | None) -> Iterable[str]:
pass
async def pkg_files(self, names: str | list[str] | None = None) -> Iterable[str]:
async def pkg_paths(self, names: str | list[str] | None = None) -> Iterable[str]:
# -- The file paths of the packages selected by the
# argument: None, the default selection, filtered to the
# app's packages when a filter is set, all installed
@ -519,9 +520,49 @@ class Distro(abc.ABC):
# compatibility with the single-package call
if isinstance(names, str):
names = [names]
if names is None and self.default_path_filter is not None:
elif names is None and self.default_path_filter is not None:
names = [p.name for p in await self.select()]
return await self._pkg_files(names)
return await self._pkg_paths(names)
# -- paths
async def _paths(
self,
filter: PathFilter | None = None,
pkg_names: Collection[str] = [],
) -> Iterable[str]:
if filter and pkg_names and not isinstance(filter, PackageFilter):
raise Exception(
f'Tried to select files from {self} with non-package-filter {filter} '
f'and package list {", ".join(pkg_names)}'
)
if not filter:
filter = self.__default_path_filter
# -- pkg_names follows the select() convention: an empty
# list selects every package, which is listed in one
# whole-system query instead of by name
if isinstance(filter, PackageFilter):
pkg_names = [p.name for p in await self._select(pkg_names, filter)]
ret: list[str] = [
path for path in await self.pkg_paths(names = list(pkg_names))
]
elif pkg_names:
pkg_names = [p.name for p in await self._select_by_name(pkg_names)]
ret = [path for path in await self.pkg_paths(names = list(pkg_names))]
else:
# -- _pkg_paths() directly: pkg_paths() would re-resolve
# the default filter, which _paths() already did
ret = [path for path in await self._pkg_paths(None)]
if filter and not isinstance(filter, PackageFilter):
ret = [path for path in ret if await filter.run(path) == Verdict.ALLOW]
return ret
async def paths(
self,
filter: PathFilter | None = None,
pkg_names: Collection[str] = [],
) -> Iterable[str]:
return await self._paths(filter, pkg_names)
# -- verify

View file

@ -124,29 +124,31 @@ class FileContext(abc.ABC):
def chroot(self) -> bool:
return self.__chroot
def _create_path_filter(
self, candidate: str | PathFilter | Literal[False] | None
) -> PathFilter | Literal[False]:
if candidate is None or candidate is False:
return False
if isinstance(candidate, PathFilter):
return candidate
return PathFilter.create(spec = candidate, file_context = self)
@property
def path_filter(self) -> PathFilter | None:
def __create_path_filter(
candidate: str | None | PathFilter | Literal[False]
) -> PathFilter | Literal[False]:
if candidate is None or candidate is False:
return False
if isinstance(candidate, PathFilter):
return candidate
return PathFilter.create(spec = candidate, file_context = self)
if self.__path_filter is None:
query = self.__uri.query_dict if self.__uri.query_dict else {}
candidate: str | PathFilter | Literal[False] | None = \
query.get('path-filter')
if candidate is None:
candidate = self.__default_path_filter
self.__path_filter = __create_path_filter(candidate)
self.__path_filter = self._create_path_filter(candidate)
return self.__path_filter or None
@path_filter.setter
def path_filter(self, value: str | PathFilter | None | Literal[False]) -> None:
self._set_path_filter(value)
def _set_path_filter(self, value: str | PathFilter | None | Literal[False]) -> None:
self.__path_filter = None
self.__default_path_filter = value

View file

@ -54,7 +54,9 @@ class PathFilter(abc.ABC):
f'Unsupported filter spec "{spec}": expected a "name:spec" '
'form, where the name picks the filter class'
)
class_name = name.capitalize()
from .util import kebab_to_pascal
class_name = kebab_to_pascal(name)
module_name = 'jw.pkg.lib.pf.' + class_name
filter_classes: LoadTypes[PathFilter] = LoadTypes(
[module_name],

View file

@ -67,7 +67,7 @@ class Distro(Base):
)
@override
async def _pkg_files(self, names: list[str] | None) -> Iterable[str]:
async def _pkg_paths(self, names: list[str] | None) -> Iterable[str]:
raise NotImplementedError(
'distro pkg ls yet implemented for Arch-like distributions'
)

View file

@ -156,7 +156,7 @@ class Distro(Base):
await self.dpkg(['-P', *names], sudo = True)
@override
async def _pkg_files(self, names: list[str] | None) -> Iterable[str]:
async def _pkg_paths(self, names: list[str] | None) -> Iterable[str]:
return await list_files(names, ec = self.ctx)
@override

View file

@ -88,7 +88,7 @@ class Distro(Base):
await self.rpm(['-e', *names], sudo = True)
@override
async def _pkg_files(self, names: list[str] | None) -> Iterable[str]:
async def _pkg_paths(self, names: list[str] | None) -> Iterable[str]:
return await list_files(names, ec = self.ctx)
@override

View file

@ -107,7 +107,7 @@ class Distro(Base):
await self.rpm(['-e', *names], sudo = True)
@override
async def _pkg_files(self, names: list[str] | None) -> Iterable[str]:
async def _pkg_paths(self, names: list[str] | None) -> Iterable[str]:
return await list_files(names, ec = self.ctx)
@override

Some files were not shown because too many files have changed in this diff Show more