From fdc21a1efbe60eab048c4ba36ea9bc45889fec06 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Tue, 14 Jul 2026 17:44:22 +0200 Subject: Add SemVer versioning (1.0.0) Bake a PROJECT_VERSION="1.0.0" const into every script (test-build, install.sh, and the three image-builder/*.sh). test-build and install.sh expose -V/--version; the image-builder scripts already use --version for the Slackware target, so their project-version flag is -V only. bootstrap.sh handles -V before its root check so it is queryable as any user. No VERSION file: a release bump is one sed over the consts, anchored on ^PROJECT_VERSION= so it never hits the SBo package VERSION/OPT_VERSION vars. Release procedure documented in CLAUDE.md; user-facing note in README. Co-Authored-By: Claude Opus 4.8 --- CLAUDE.md | 22 ++++++++++++++++++++++ README.md | 7 +++++++ image-builder/bootstrap.sh | 4 ++++ image-builder/build-full-image.sh | 2 ++ image-builder/build-sbo-testbuild.sh | 2 ++ install.sh | 11 +++++++---- test-build | 4 ++++ 7 files changed, 48 insertions(+), 4 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 9d4cd5f..c4813db 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -143,6 +143,28 @@ verified by running `test-build` against a real image. - GPLv2-only. Every source file carries a short GPL header notice. - No em dashes in prose. +## Releases + +SemVer, starting at `1.0.0`. The version is a baked `PROJECT_VERSION="X.Y.Z"` +const in every script (`test-build`, `install.sh`, and the three +`image-builder/*.sh`); there is no VERSION file. `test-build` and `install.sh` +expose `-V`/`--version`; the image-builder scripts already use `--version` for +the Slackware target, so their project-version flag is `-V` only. + +To cut a release (bump `X.Y.Z`): + +```bash +sed -i 's/^PROJECT_VERSION="[^"]*"/PROJECT_VERSION="X.Y.Z"/' \ + test-build install.sh image-builder/*.sh +git commit -aS -m "release X.Y.Z" +git tag -s vX.Y.Z -m "vX.Y.Z" +git push origin master --tags # both remotes (danix_git + forge) +tea release create --repo danix/sbo-dockerbuild --tag vX.Y.Z --title vX.Y.Z +``` + +The `sed` anchors on `^PROJECT_VERSION="..."`, which never matches the SBo +package `VERSION=`/`OPT_VERSION=` vars, so it only touches the project const. + ## Deployment The image-builder scripts run on the docker host VM (`docker.noland.dnx`, diff --git a/README.md b/README.md index c52d4d2..1d21c3c 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,13 @@ cd image-builder See the specs under `docs/specs/` for the full design. +## Versioning + +This project follows [Semantic Versioning](https://semver.org), starting at +`1.0.0`. Check the version with `test-build --version` (or `install.sh +--version`). Tagged releases are published on the +[Slackware Forge](https://forge.slackware.nl/danix/sbo-dockerbuild/releases). + ## License Released under the GNU General Public License, version 2 (v2 only). See diff --git a/image-builder/bootstrap.sh b/image-builder/bootstrap.sh index 273afc8..ea76413 100755 --- a/image-builder/bootstrap.sh +++ b/image-builder/bootstrap.sh @@ -14,11 +14,15 @@ # bootstrap.sh — build the sbo-base:{ver} image FROM scratch from NAS trees. # Run as root (installpkg). Adapted from forge slackware/docker-images. set -euo pipefail +PROJECT_VERSION="1.0.0" # bump via sed across all scripts; see CLAUDE.md Releases HERE="$(cd "$(dirname "$0")" && pwd)" source "${HERE}/config" LOG_TAG=bootstrap source "${HERE}/lib.sh" +# -V before the root check so version is queryable as any user. +[[ "${1:-}" == "-V" ]] && { echo "bootstrap.sh $PROJECT_VERSION"; exit 0; } + REGISTRY_IMAGE="${REGISTRY}/sbo-base" [[ "${EUID}" -eq 0 ]] || _err "run as root." mkdir -p "${HASH_DIR}" diff --git a/image-builder/build-full-image.sh b/image-builder/build-full-image.sh index a2fdb18..0854d4a 100755 --- a/image-builder/build-full-image.sh +++ b/image-builder/build-full-image.sh @@ -14,6 +14,7 @@ # build-full-image.sh — sbo-full:{ver} FROM sbo-base:{ver}, all series. # Adapted from forge slackware/docker-images. No root needed. set -euo pipefail +PROJECT_VERSION="1.0.0" # bump via sed across all scripts; see CLAUDE.md Releases HERE="$(cd "$(dirname "$0")" && pwd)" source "${HERE}/config" LOG_TAG=full @@ -31,6 +32,7 @@ FORCE=false OPT_VERSION="" while [[ $# -gt 0 ]]; do case "$1" in + -V) echo "build-full-image.sh $PROJECT_VERSION"; exit 0 ;; --version) OPT_VERSION="$2"; shift 2 ;; --force) FORCE=true; shift ;; *) _err "unknown argument: $1" ;; diff --git a/image-builder/build-sbo-testbuild.sh b/image-builder/build-sbo-testbuild.sh index a246b79..0d1e07b 100755 --- a/image-builder/build-sbo-testbuild.sh +++ b/image-builder/build-sbo-testbuild.sh @@ -15,6 +15,7 @@ # Adds sbopkg + sbo-maintainer-tools from prebuilt .txz in PKGDIR. # Rebuilds when the full image OR the .txz set changes. set -euo pipefail +PROJECT_VERSION="1.0.0" # bump via sed across all scripts; see CLAUDE.md Releases HERE="$(cd "$(dirname "$0")" && pwd)" source "${HERE}/config" LOG_TAG=testbuild @@ -29,6 +30,7 @@ FORCE=false OPT_VERSION="" while [[ $# -gt 0 ]]; do case "$1" in + -V) echo "build-sbo-testbuild.sh $PROJECT_VERSION"; exit 0 ;; --version) OPT_VERSION="$2"; shift 2 ;; --force) FORCE=true; shift ;; *) _err "unknown argument: $1" ;; diff --git a/install.sh b/install.sh index 5b79cc3..6c7d96e 100755 --- a/install.sh +++ b/install.sh @@ -22,6 +22,7 @@ # ./install.sh --uninstall remove it set -euo pipefail +PROJECT_VERSION="1.0.0" # bump via sed across all scripts; see CLAUDE.md Releases HERE="$(cd "$(dirname "$0")" && pwd)" BINDIR="${BINDIR:-$HOME/bin}" PROG=test-build @@ -29,10 +30,12 @@ CONFDIR="${XDG_CONFIG_HOME:-$HOME/.config}/sbo-testbuild" CONF="$CONFDIR/config" OVERRIDES="$CONFDIR/overrides" -if [[ "${1:-}" == "--uninstall" ]]; then - rm -f "$BINDIR/$PROG" && echo "removed $BINDIR/$PROG" - exit 0 -fi +case "${1:-}" in + -V|--version) echo "install.sh $PROJECT_VERSION"; exit 0 ;; + --uninstall) + rm -f "$BINDIR/$PROG" && echo "removed $BINDIR/$PROG" + exit 0 ;; +esac [[ -f "$HERE/$PROG" ]] || { echo "$PROG not found in $HERE" >&2; exit 1; } mkdir -p "$BINDIR" diff --git a/test-build b/test-build index eb4009f..54a8da4 100755 --- a/test-build +++ b/test-build @@ -23,6 +23,8 @@ # # No em dashes in prose by author convention. +PROJECT_VERSION="1.0.0" # bump via sed across all scripts; see CLAUDE.md Releases + # ============================================================================= # CONFIG (do not edit here; real values live in the external config file) # ============================================================================= @@ -75,6 +77,7 @@ USAGE: OPTIONS: -h, --help This text. + -V, --version Print version and exit. --stable Target Slackware 15.0 (image + tree). Default is -current. --dry-run Resolve, apply overrides, print the build order, do not build. --yes Skip the confirm prompt (the order is still printed first). @@ -90,6 +93,7 @@ parse_args() { while [[ $# -gt 0 ]]; do case "$1" in -h|--help) usage; exit 0 ;; + -V|--version) echo "test-build $PROJECT_VERSION"; exit 0 ;; --stable|15.0) VERSION_ID="15.0"; shift ;; --dry-run) DRY_RUN=1; shift ;; --yes) ASSUME_YES=1; shift ;; -- cgit v1.2.3