Commit graph jw-pkg/scripts/scm.sh
Author SHA1 Message Date
f738951642
calculate_hash(): Derive hash from VCS file ids
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 5m28s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 4m34s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 5m12s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m22s
CI / Packaging test (push) Successful in 0s
The source hash is an md5sum over all versioned files in the working tree.
md5sum follows symlinks, so a project with links to files outside the tree
may produce different hashes depending on files outside the repo.

Compute the hash over the VCS file ids instead. Add a -s option to scm.sh
ls-files that lists each versioned file together with its content id. The
listing is sorted by path rather than by id, so an entry keeps its position
when its content changes.

For Git repos, git ls-tree -r HEAD reports the blob of a symlink's target
string and the pinned commit of a submodule, so the resulting hash depends
only on the committed tree, never on the working tree or on the machine.

calculate_hash() and the HASH variable in make/pkg-dist.mk feed the id
listing, minus the release metadata files, directly to md5sum.

calculate_hash() fails loudly when the pipeline fails, with its callers
refusing to proceed on an empty result.

The scheme change invalidates the stored HASH values, so every project
gets one more release the first time it runs against the new code, and the
hashes are stable again afterwards.

Signed-off-by: Jan Lindemann <jan@janware.com>
Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.85.1
2026-09-16 14:44:59 +02:00
7cec102691
scm.sh ls-files: Honor -f in Git repositories
In CVS, the -f option keeps directory entries out of scm.sh ls-file's
listing; in Git, it's a silent no-op. Notably symlinks are not excluded
despite -f.

Implement -f for git with a mode filter on git ls-files -s output: only
100644 and 100755 entries are listed, so the option means the same thing in
both code paths.

For Git, this actually means a behaviour change which needs to be fixed:

The dist archive targets tar-files and cpio-files in make/list-files.mk and
the scm_files() helper in scripts/pkg.sh then may no longer pass it to get
unchanged behaviour.

The targets list-files and list-text-files keep it, so the text-files cache
now matches its documented regular-files-only membership.

Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.85.1
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-09-16 14:44:59 +02:00
77c746571a
scripts: Fix shellcheck errors
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 4m23s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 4m30s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 4m2s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m6s
CI / Packaging test (push) Successful in 0s
Fix shellcheck SC2068 (unquoted array expansions), SC2145 (mixed
string/array arguments), SC2328 (redirection in command
substitution), SC2173 (untrapable signals), and SC2148 (missing
shebang) errors across 14 script files.

Also configure scripts/Makefile with --severity=error so that only
errors (not warnings or notes) cause check failures. To be tightened
by follow-up commits.

Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL and pi.dev
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-06-29 17:52:24 +02:00
e55793f61a scm.sh ls-files: Support -a (all files)
scm.sh ls-files by defaults does not list the VSC metadata files.
Passing -a includes them in the output.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-12-01 11:29:53 +01:00
3f8c1ad573 scm.sh: Be more explicit about where ls-files fails
scm.sh sometimes complains about "no VCS here" without detailing what
"here" actually means. Fix that.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-17 12:17:04 +01:00
82eb80979d bin, make, scripts: Re-add files necessary for packaging jw-build
Re-add all files necessary to package jw-build itself, i.e.
sucessfully run make pkg-rebuild-reinstall. This adds 1892 lines of
code.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-14 11:22:50 +01:00
bc883deed4 Everywhere: Remove everything non-essential for "make clean all"
This commit removes everything not strictly necessary for running
"make clean all" inside jw-build.

packaging jw-devtest. This cuts the repo down from 24077 to 4725
lines of code.

The idea is to

1) Further remove bloat from the remaining bits

2) Re-add what's necessary to build and package other essential repos.

   The decision should be based on whether or not jw-build can also be
   useful in a non-janware context.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-14 15:02:56 +01:00
531e0eab19 scm.sh: Ls-files: Add --recurse-submodules for git
Make scm.sh ls-files list all files belonging to submodules, too. The use case
is to have list-text-files return them.

Signed-off-by: Jan Lindemann <jan@janware.com>
2024-07-16 10:57:52 +00:00
089aebeaec scm.sh clean: Make git clean ignore .gitignore
scm.sh clean doesn't remove files in .gitignore, which is kind of beside the
point. Fix that.

Signed-off-by: Jan Lindemann <jan@janware.com>
2020-04-10 12:03:43 +00:00
522eb228ce scm.sh: Automatically activate opt_no_submodules for git 1.x
Signed-off-by: Jan Lindemann <jan@janware.com>
2019-01-30 16:23:11 +00:00
e827efadd5 make, scripts: Replace list-vcs-files.sh by scm.sh ls-files
Signed-off-by: Jan Lindemann <jan@janware.com>
2018-12-16 10:30:49 +00:00
14e76bbddd scm.sh: Add cmd_clean to scm.sh
Signed-off-by: Jan Lindemann <jan@janware.com>
2017-06-24 12:59:10 +00:00
dde1e31b27 scm.sh: Add support for remove
Signed-off-by: Jan Lindemann <jan@janware.com>
2016-02-11 16:11:59 +00:00
df77be6508 project.conf, scm.sh: Move doc/share/project.txt -> make/project.conf
Signed-off-by: Jan Lindemann <jan@janware.com>
2016-01-29 13:09:04 +00:00
d3c6ed87e4 scm.sh: Add command add
Signed-off-by: Jan Lindemann <jan@janware.com>
2016-01-28 12:43:26 +00:00
88a4ed98f1 scm.sh: Add scm.sh
Signed-off-by: Jan Lindemann <jan@janware.com>
2016-01-28 09:13:48 +00:00