From d75d9f2b60a4282aeadff64e65d1c0773f80d8d4 Mon Sep 17 00:00:00 2001 From: saiththerobo Date: Thu, 12 Nov 2026 08:27:26 +0000 Subject: [PATCH 01/19] tools/pkg-version: count package versions from main's history Every PR bumped its packages' version files, and open PRs kept taking the same number: two branches that write the same version line merge without a conflict, so the second shipped new contents under a published number unless a review caught it (review lessons L-12, L-404, L-426, L-477), and the fixes were renumber commits, "main merged" commits on contributors' branches, or a follow-up PR (#683). tools/pkg-version works the version out instead. The version file gives the series (its first two numbers); on main's first-parent line every commit that touches packages/ is the next number. The count starts at the commit that adds this tool, from the version file as it stood then, so no published number comes back, and a third number in the file is read as a floor only, so an old-style bump changes nothing (an equal or lower one) or lifts the count (a higher one). A build off main is main's version at the merge base plus the branch's commits and the commit (0.2.130.1.g4f2a9c1), which pacman orders between main's 0.2.130 and 0.2.131; a package or series main doesn't have yet builds as 0.1.0pre1.g, below main's first 0.1.0. --commit maps a version back to the commit it was built from (#689). The build container and the phone get no .git, so build-packages, repo-build and phone-install-package copy a package through tools/lib/pkg-tar.sh, which adds the version as .pkgver; without the history (a shallow clone, a copy) it refuses rather than guess. CI's test job checks out the full history for the count. tests/pkg-version covers the cases in a scratch repository (two PRs that both wrote one number land as two, a merge commit counts once, branch builds, the refusals; pacman's order with vercmp where pacman is) and replays this repository's history as if the count had started at its first commit: 30 packages over 382 commits, every commit a new number and none below its version file's. The same replay shows what the old scheme did: 61 times a package changed on main without a new number, 12 of them in files the package ships. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/checks.yml | 4 + .gitignore | 3 + tests/all | 4 +- tests/build-packages-host-tools | 2 +- tests/local-builds | 4 +- tests/pkg-version | 161 ++++++++++++++++++++++++++++++++ tests/stage-boot-files | 2 +- tools/build-packages | 8 +- tools/lib/pkg-tar.sh | 32 +++++++ tools/phone-install-package | 7 +- tools/pkg-version | 157 +++++++++++++++++++++++++++++++ tools/repo-build | 4 +- 12 files changed, 373 insertions(+), 15 deletions(-) create mode 100755 tests/pkg-version create mode 100644 tools/lib/pkg-tar.sh create mode 100755 tools/pkg-version diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 4c783e778..530472729 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -59,6 +59,10 @@ jobs: node --version fi - uses: actions/checkout@v5 + with: + # The packages' versions are counted from main's history + # (tools/pkg-version), and origin/main is the line they count on + fetch-depth: 0 - name: A normal user (some tests check what a user may not do) run: | useradd -m ci diff --git a/.gitignore b/.gitignore index 14b43f718..ebc8a802e 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,6 @@ logs/ # Python bytecode from running package code in place __pycache__/ *.pyc + +# A package version worked out for a build without git (tools/lib/pkg-tar.sh) +packages/*/.pkgver diff --git a/tests/all b/tests/all index 1afbe163c..fec93d682 100755 --- a/tests/all +++ b/tests/all @@ -33,7 +33,7 @@ set -euo pipefail cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." for f in tools/install-phone tools/phone-provision tools/nv-backup tools/build-rootfs tools/build-packages tools/make-bundle \ tools/local-key-init tools/fetch-published tools/fetch-toolchain tools/repo-publish tools/repo-build tools/release tools/release-upload tools/server/releases-nginx.sh \ - tools/lib/alarm.sh tools/lib/alarm-setup tools/lib/signing.sh tools/lib/bundle-tar.sh tools/lib/usage.sh rootfs/build-inside rootfs/resolve.sh tests/*; do + tools/lib/alarm.sh tools/lib/alarm-setup tools/lib/signing.sh tools/lib/bundle-tar.sh tools/lib/usage.sh tools/pkg-version tools/lib/pkg-tar.sh rootfs/build-inside rootfs/resolve.sh tests/*; do [[ -f $f ]] || continue # tests/owl is the OWL conformance suite's folder [[ $f == *.py ]] && continue bash -n "$f" || { echo "not ok - $f parses" >&2; exit 1; } @@ -49,7 +49,7 @@ python3 tests/boot-arch-label.py python3 tests/persistent-root-boot.py python3 tests/initramfs-root-policy.py python3 tests/bt-uart-gpio.py -for t in tests/pr-check tests/kernel-pr-check tests/phone-smoke tests/alarm-wake-test tests/install-phone tests/build-rootfs tests/rootfs-resolve tests/phone-provision tests/nv-backup tests/initramfs-grow tests/images-layout tests/boot-update-parity tests/stage-boot-files tests/build-packages-host-tools tests/initramfs-reproducible tests/device-overlays tests/simplefb-trigger tests/initramfs-steps tests/storage-guard tests/usb-product tests/grep-q-pipes tests/boot-method tests/modules-push tests/make-bundle-keys tests/make-bundle tests/release-signing tests/pinned-packages tests/flame-probe tests/dipper-probe packages/omamobile-firstboot/test/all packages/omamobile-device-felix/test/all packages/omamobile-device-lynx/test/all packages/omamobile-device-panther/test/all tests/local-builds tests/phone-install-package tests/publish-kernel tests/fetch-toolchain tests/release-upload tests/extract-camera-data tests/release tests/lineage-ref tests/repo-publish tests/repo-publish-stage tests/extract-vendor-firmware tests/alpine-fetch-callers tests/alpine-fetch tests/tools-help tests/install-phone-initramfs; do +for t in tests/pr-check tests/kernel-pr-check tests/phone-smoke tests/alarm-wake-test tests/install-phone tests/build-rootfs tests/rootfs-resolve tests/phone-provision tests/nv-backup tests/initramfs-grow tests/images-layout tests/boot-update-parity tests/stage-boot-files tests/build-packages-host-tools tests/initramfs-reproducible tests/device-overlays tests/simplefb-trigger tests/initramfs-steps tests/storage-guard tests/usb-product tests/grep-q-pipes tests/boot-method tests/modules-push tests/make-bundle-keys tests/make-bundle tests/release-signing tests/pinned-packages tests/flame-probe tests/dipper-probe packages/omamobile-firstboot/test/all packages/omamobile-device-felix/test/all packages/omamobile-device-lynx/test/all packages/omamobile-device-panther/test/all tests/local-builds tests/phone-install-package tests/publish-kernel tests/fetch-toolchain tests/release-upload tests/extract-camera-data tests/release tests/lineage-ref tests/repo-publish tests/repo-publish-stage tests/extract-vendor-firmware tests/alpine-fetch-callers tests/alpine-fetch tests/tools-help tests/install-phone-initramfs tests/pkg-version; do echo "# $t" "$t" done diff --git a/tests/build-packages-host-tools b/tests/build-packages-host-tools index e61fd2ca9..309854f27 100755 --- a/tests/build-packages-host-tools +++ b/tests/build-packages-host-tools @@ -18,7 +18,7 @@ R=$t/repo trap 'gpgconf --homedir "$R/keys/testdev/gnupg" --kill gpg-agent 2>/dev/null || true; rm -rf "$t"' EXIT mkdir -p "$R/tools/lib" "$R/device/testdev" "$R/packages" "$t/bin" "$t/tmp" -cp tools/build-packages tools/stage-boot-files "$R/tools/" && cp omamobile.conf "$R/" +cp tools/build-packages tools/stage-boot-files tools/pkg-version "$R/tools/" && cp tools/lib/pkg-tar.sh "$R/tools/lib/" && cp omamobile.conf "$R/" mkdir -p "$R/packages/omamobile-boot-update/lib" && cp packages/omamobile-boot-update/lib/descriptor.sh "$R/packages/omamobile-boot-update/lib/" printf 'CODENAME=testdev\n' > "$R/device/testdev/device.conf" cat > "$R/tools/lib/alarm.sh" <<'A' diff --git a/tests/local-builds b/tests/local-builds index 179d7410c..3de03df0e 100755 --- a/tests/local-builds +++ b/tests/local-builds @@ -18,8 +18,8 @@ trap 'gpgconf --homedir "$t/signer" --kill gpg-agent 2>/dev/null || true; gpgcon R=$t/repo mkdir -p "$R/tools/lib" "$R/device/panther" "$R/packages" -cp tools/local-key-init tools/fetch-published tools/build-packages tools/build-rootfs "$R/tools/" -cp tools/lib/alarm.sh tools/lib/alarm-setup "$R/tools/lib/" +cp tools/local-key-init tools/fetch-published tools/build-packages tools/build-rootfs tools/pkg-version "$R/tools/" +cp tools/lib/alarm.sh tools/lib/alarm-setup tools/lib/pkg-tar.sh "$R/tools/lib/" cp device/panther/device.conf "$R/device/panther/" cp -a packages/omamobile-device-panther "$R/packages/" run() { (cd "$R" && "$@") > "$t/log" 2>&1; } diff --git a/tests/pkg-version b/tests/pkg-version new file mode 100755 index 000000000..aa8268b78 --- /dev/null +++ b/tests/pkg-version @@ -0,0 +1,161 @@ +#!/bin/bash +# SPDX-License-Identifier: MIT +# tools/pkg-version (and tools/lib/pkg-tar.sh) against a throwaway repository: +# the count from the commit that added the tool, a third number as a floor +# only, two PRs that wrote the same number, a new series, branch builds, and +# the refusals without history. Then a replay of this repository's own +# history as if the count had started at its first commit: no package may +# keep or lower its version across a commit that touched it, or fall below +# the number its version file gave. +set -euo pipefail +here=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd) +t=$(mktemp -d) +trap 'rm -rf "$t"' EXIT +n=0 +ok() { n=$((n + 1)); echo "ok $n - $1"; } +fail() { echo "not ok - $*" >&2; exit 1; } +is() { [[ $1 == "$2" ]] || fail "$3: got '$1', expected '$2'"; ok "$3"; } + +r=$t/repo +mkdir -p "$r/packages/demo" "$r/tools/lib" +cd "$r" +git init -q -b main +git config user.name Tester +git config user.email tester@example.org +pv() { tools/pkg-version "$@" 2>&1; } +change() { mkdir -p "$(dirname "packages/${2:-demo}/$1")" && echo "$RANDOM $*" >> "packages/${2:-demo}/$1"; } +commit() { git add -A && git commit -q -m "$1"; } + +# Before the tool: the version file is the version, as it was published. +echo 0.2.5 > packages/demo/version; change code; commit "demo 0.2.5" +change code; commit "demo: a change that forgot its bump" +cp "$here/tools/lib/pkg-tar.sh" tools/lib/ +echo "pkgname=demo" > packages/demo/PKGBUILD +cat >> packages/demo/PKGBUILD <<'EOF' +pkgver=$(cat "${startdir:-.}/.pkgver" 2>/dev/null || "${startdir:-.}/../../tools/pkg-version" "${startdir:-.}") +pkgrel=1 +EOF +commit "demo: a PKGBUILD" +is "$(git show HEAD~1:packages/demo/version)" 0.2.5 "fixture" + +# The tool lands: the count starts here, from the file as it stood. +cp "$here/tools/pkg-version" tools/; commit "tools/pkg-version" +is "$(pv demo)" 0.2.5 "the commit that adds the tool doesn't change a package's version" +change code; commit "demo: a change, no bump" +is "$(pv demo)" 0.2.6 "a commit touching the package is the next number" +echo 0.2.6 > packages/demo/version; change code; commit "demo 0.2.6: an old-style bump to a taken number" +is "$(pv demo)" 0.2.7 "a third number at or below the count changes nothing" +echo 0.2.20 > packages/demo/version; commit "demo 0.2.20: a jump" +is "$(pv demo)" 0.2.20 "a higher third number is a floor" +c20=$(git rev-parse HEAD) +change test/all; commit "demo: tests only" +is "$(pv demo)" 0.2.21 "every commit under the package counts" +echo 0.3 > packages/demo/version; commit "demo: a new series" +is "$(pv demo)" 0.3.0 "a new series starts at 0" +change code; commit "demo: a change" +is "$(pv demo)" 0.3.1 "and counts on" +is "$(pv --commit demo 0.2.20)" "$c20" "--commit finds the commit a version was built from" +is "$(pv --commit demo 0.2.5)" "$(git rev-list --max-parents=0 HEAD)" "--commit finds a version from before the tool" +is "$(pv --history demo | wc -l)" 9 "--history lists every commit that touched the package" +pv --commit demo 0.9.9 >/dev/null && fail "an unknown version is refused" +ok "an unknown version is refused" + +# Two PRs both write 0.3.2, squash-merged one after the other: the merge +# shows no conflict, and each lands with its own number. +git checkout -q -b pr-a; echo 0.3.2 > packages/demo/version; change a; commit "demo 0.3.2: A" +a=$(pv demo) +git checkout -q main; git checkout -q -b pr-b; echo 0.3.2 > packages/demo/version; change b; commit "demo 0.3.2: B" +git checkout -q main; git merge -q --squash pr-a >/dev/null; commit "demo 0.3.2: A (#1)" +is "$(pv demo)" 0.3.2 "the first PR lands as 0.3.2" +git merge -q --squash pr-b >/dev/null 2>&1 +commit "demo 0.3.2: B (#2)" +is "$(pv demo)" 0.3.3 "the second PR, with the same number in its file, lands as 0.3.3" +[[ $a =~ ^0\.3\.1\.1\.g[0-9a-f]{7}$ ]] || fail "a branch build: got $a" +ok "a branch build is main's version at the base, its own commits and the commit ($a)" + +# A merge commit on main (not squashed) is one commit on main's line. +git checkout -q -b pr-c; change c; commit "c1"; change c; commit "c2" +git checkout -q main; git merge -q --no-ff -m "Merge pr-c" pr-c +is "$(pv demo)" 0.3.4 "a merge commit counts once, not per commit it brings" + +# Branch builds against main. +git checkout -q -b other; echo x > README.md; commit "elsewhere" +is "$(pv demo)" 0.3.4 "a branch that doesn't touch the package builds main's version" +change code; commit "demo on a branch"; change code; commit "again" +v=$(pv demo) +[[ $v == 0.3.4.2.g$(git rev-parse --short=7 HEAD) ]] || fail "two branch commits: got $v" +ok "two branch commits: $v" +mkdir -p packages/fresh; echo 0.1 > packages/fresh/version; commit "fresh" +v=$(pv fresh) +[[ $v =~ ^0\.1\.0pre1\.g[0-9a-f]{7}$ ]] || fail "a new package on a branch: got $v" +ok "a new package on a branch builds below main's first ($v)" +echo 0.4 > packages/demo/version; commit "demo 0.4 on a branch" +v=$(pv demo) +[[ $v =~ ^0\.4\.0pre3\.g[0-9a-f]{7}$ ]] || fail "a new series on a branch: got $v" +ok "a new series on a branch builds below main's first of it ($v)" +pv --main other demo | grep -qx 0.4.0 || fail "--main names the line to count on" +ok "--main names the line to count on" +git checkout -q main + +# The copy a build container or the phone gets: .pkgver, and the PKGBUILD +# reads it there without git. +( + source tools/lib/pkg-tar.sh + mkdir "$t/copy" + pkg_tar packages/demo | tar xf - -C "$t/copy" +) +is "$(cat "$t/copy/demo/.pkgver")" 0.3.4 "pkg_tar puts the version in the copy" +is "$(cd "$t/copy/demo" && startdir=$PWD bash -c 'source ./PKGBUILD; echo $pkgver')" 0.3.4 "the PKGBUILD reads it there" +echo 9.9.9 > packages/demo/.pkgver +rm -rf "$t/copy2" && mkdir "$t/copy2" +(source tools/lib/pkg-tar.sh; pkg_tar packages/demo | tar xf - -C "$t/copy2") +is "$(cat "$t/copy2/demo/.pkgver")" 0.3.4 "a stale .pkgver in the directory loses to the fresh one" +rm packages/demo/.pkgver + +# Without the history: refuse, never guess. +git clone -q --depth 1 "file://$r" "$t/shallow" +(cd "$t/shallow" && tools/pkg-version demo) >/dev/null 2>&1 && fail "a shallow clone is refused" +ok "a shallow clone is refused" +mkdir -p "$t/nogit-tree/packages" "$t/nogit-tree/tools" && cp -r packages/demo "$t/nogit-tree/packages/" && cp tools/pkg-version "$t/nogit-tree/tools/" +(cd "$t/nogit-tree/packages/demo" && startdir=$PWD bash -c 'source ./PKGBUILD; [[ -z $pkgver ]]') 2>/dev/null || + fail "a copy without .git gets no version" +ok "a copy without .git gets no version (makepkg stops on an empty pkgver)" +(source tools/lib/pkg-tar.sh; cd "$t/nogit-tree" && pkg_tar packages/demo >/dev/null 2>&1) && fail "pkg_tar refuses without a version" +ok "pkg_tar refuses without a version" + +# pacman's order, where pacman is (CI's Arch container). +if command -v vercmp >/dev/null; then + lt() { [[ $(vercmp "$1" "$2") == -1 ]] || fail "vercmp $1 < $2"; } + lt 0.3.4 0.3.4.1.gabc1234; lt 0.3.4.1.gfffffff 0.3.4.2.g0000000; lt 0.3.4.2.g0000000 0.3.5 + lt 0.1.0pre1.gabc1234 0.1.0; lt 0.1.0pre9.gabc1234 0.1.0pre10.gabc1234; lt 0.4.0pre3.gabc1234 0.4.0 + ok "pacman orders branch builds between main's builds" +else + ok "# skip: no vercmp for pacman's order" +fi + +# This repository's own history, replayed from its first commit. +cd "$here" +if [[ $(git rev-parse --is-shallow-repository) == true ]]; then + ok "# skip: a shallow clone has no history to replay" + exit 0 +fi +first=$(git rev-list --max-parents=0 HEAD | tail -1) +checked=0 commits=0 +for f in packages/*/PKGBUILD; do + grep -qF tools/pkg-version "$f" || continue + p=$(basename "$(dirname "$f")") + prev= + while read -r c v; do + file=$(git show "$c:packages/$p/version" | tr -d '[:space:]') + if [[ -n $prev && ${prev%.*} == "${v%.*}" ]]; then + [[ $(printf '%s\n' "$prev" "$v" | sort -V | tail -1) == "$v" && $prev != "$v" ]] || + fail "$p: $v at $c does not follow $prev" + fi + if [[ $file =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + [[ $(printf '%s\n' "$file" "$v" | sort -V | tail -1) == "$v" ]] || fail "$p: $v at $c is below its file's $file" + fi + prev=$v commits=$((commits + 1)) + done < <(OMAMOBILE_PKGVER_SINCE=$first tools/pkg-version --main HEAD --history "$p") + checked=$((checked + 1)) +done +ok "replayed $checked packages over $commits commits from the first one: every commit a new number, none below its file's" diff --git a/tests/stage-boot-files b/tests/stage-boot-files index ec09d7d47..165ea9f53 100755 --- a/tests/stage-boot-files +++ b/tests/stage-boot-files @@ -55,7 +55,7 @@ pass "repo-publish carries boot-files/; build-packages checks them, verifies the # a throwaway local key. if command -v gpg >/dev/null && command -v zstd >/dev/null; then R=$t/repo && mkdir -p "$R/tools/lib" "$R/device/testdev" "$R/packages" "$t/bin" "$t/tmp" - cp tools/build-packages tools/stage-boot-files "$R/tools/" && cp omamobile.conf "$R/" + cp tools/build-packages tools/stage-boot-files tools/pkg-version "$R/tools/" && cp tools/lib/pkg-tar.sh "$R/tools/lib/" && cp omamobile.conf "$R/" mkdir -p "$R/packages/omamobile-boot-update/lib" && cp packages/omamobile-boot-update/lib/descriptor.sh "$R/packages/omamobile-boot-update/lib/" printf 'CODENAME=testdev\n' > "$R/device/testdev/device.conf" cat > "$R/tools/lib/alarm.sh" <<'A' diff --git a/tools/build-packages b/tools/build-packages index e16e29702..b2feb8c06 100755 --- a/tools/build-packages +++ b/tools/build-packages @@ -62,6 +62,7 @@ set -euo pipefail cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." ROOT=$PWD source tools/lib/alarm.sh +source tools/lib/pkg-tar.sh SLOW=(mesa hyprland libcamera) # Packed from a staged kernel build: built only when named (see above) @@ -363,10 +364,9 @@ for dir in "${build[@]}"; do name=$(basename "$dir") alarm_say "$name $(pkg_version "$dir")" work=$(mktemp -d) - # The package directory as it is (including gitignored prebuilt files the - # PKGBUILDs install), minus makepkg's work directories and old packages. - tar cf - --exclude="./$name/pkg" --exclude="./$name/src/build" --exclude='*.pkg.tar.*' \ - -C "$(dirname "$dir")" "./$name" | tar xf - -C "$work" + # The package directory as it is, with its version worked out here + # (tools/lib/pkg-tar.sh): the container has no git history. + pkg_tar "$dir" | tar xf - -C "$work" || { rm -rf "$work"; alarm_die "$name: no version (tools/pkg-version)"; } out=$work/out && mkdir -p "$out" incheck=0 if ((nocheck == 0)); then diff --git a/tools/lib/pkg-tar.sh b/tools/lib/pkg-tar.sh new file mode 100644 index 000000000..de5b933b3 --- /dev/null +++ b/tools/lib/pkg-tar.sh @@ -0,0 +1,32 @@ +# SPDX-License-Identifier: MIT +# shellcheck shell=bash +# A package directory as a tar stream for building somewhere without the git +# history (the build container, the phone): the directory as it is +# (including gitignored prebuilt files the PKGBUILDs install), minus +# makepkg's work directories and old packages, plus .pkgver with the version +# tools/pkg-version works out here, for PKGBUILDs that ask it. +# +# source tools/lib/pkg-tar.sh +# pkg_tar packages/ | tar xf - -C DEST +# +# Returns non-zero, writing nothing, when the version can't be worked out +# (a shallow clone, no .git): a build must not guess it. +pkg_tar() { + local dir=${1%/} name tmp v='' extra=() + name=$(basename "$dir") + if grep -qF 'tools/pkg-version' "$dir/PKGBUILD"; then + v=$("$(dirname -- "${BASH_SOURCE[0]}")/../pkg-version" "$dir") || return 1 + fi + tmp=$(mktemp -d) + mkdir "$tmp/$name" + if [[ -n $v ]]; then + echo "$v" > "$tmp/$name/.pkgver" + extra=(-C "$tmp" "./$name/.pkgver") + fi + # Appended last, so it wins over a stale .pkgver in the directory. + tar cf - --exclude="./$name/pkg" --exclude="./$name/src/build" --exclude='*.pkg.tar.*' \ + -C "$(dirname "$dir")" "./$name" "${extra[@]}" + local rc=$? + rm -rf "$tmp" + return $rc +} diff --git a/tools/phone-install-package b/tools/phone-install-package index 8e9776f84..f772a7c82 100755 --- a/tools/phone-install-package +++ b/tools/phone-install-package @@ -22,9 +22,10 @@ phone_home=$("$ssh" "getent passwd '$phone_user' | cut -d: -f6") build=$phone_home/build/pkgs "$ssh" "rm -rf $build/$name && mkdir -p $build && chown '$phone_user': $build" -# makepkg's own work dirs (pkg/, src/ at the top) and old packages stay home. -tar cf - --exclude="./$name/pkg" --exclude="./$name/src/build" --exclude="*.pkg.tar.*" \ - -C "$(dirname "$dir")" "./$name" | "$ssh" "tar xf - -C $build --no-same-owner && chown -R '$phone_user': $build/$name" +# makepkg's own work dirs (pkg/, src/ at the top) and old packages stay home; +# the version is worked out here, since the phone gets no git history. +source tools/lib/pkg-tar.sh +pkg_tar "$dir" | "$ssh" "tar xf - -C $build --no-same-owner && chown -R '$phone_user': $build/$name" # Build-only dependencies (makedepends, checkdepends) that aren't installed # yet go in for the build and out again afterwards, like makepkg -s -r # (makepkg runs as the user, so pacman runs here as root). Runtime diff --git a/tools/pkg-version b/tools/pkg-version new file mode 100755 index 000000000..18ade63ce --- /dev/null +++ b/tools/pkg-version @@ -0,0 +1,157 @@ +#!/bin/bash +# SPDX-License-Identifier: MIT +# A package's version, worked out from git: nobody writes the last number. +# +# tools/pkg-version [--main REF] PACKAGE the version to build HEAD at +# tools/pkg-version [--main REF] --rev REV PACKAGE the version to build REV at +# tools/pkg-version --history PACKAGE " " for every +# commit on main's line that +# touched the package +# tools/pkg-version --commit PACKAGE VERSION the commit that version was built from +# +# PACKAGE is a name (omamobile-shell) or its directory (packages/omamobile-shell). +# +# packages//version gives the series: its first two numbers (0.2). A +# third number, which PRs used to bump by hand, is read only as a floor: a +# version never goes below it, and a lower or equal one changes nothing. On +# main (the first-parent line of REF, default origin/main) every commit that +# touches packages/ is the next number in the series, so two merges can +# never ship one number with different contents, and a merge needs no version +# change at all. The count starts at the commit that added this tool, from the +# version file as it stood then, so no number already published comes back. +# Writing a new series (0.3) starts it at 0 (or at its third number, if given). +# +# Off main, a build is main's version at the merge base, then the branch's +# own commits that touch the package and the commit: 0.2.130.1.g4f2a9c1. +# pacman orders that above 0.2.130 and below main's next 0.2.131, so a phone +# with a test build upgrades to the next published one. A branch that doesn't +# touch the package builds main's version. A package (or a series) that main +# doesn't have yet builds as 0.1.0pre1.g4f2a9c1, below main's first 0.1.0. +# +# It needs the history: in a shallow clone or a copy without .git it refuses +# rather than guess. Tools that build from a copy (build-packages, +# repo-build, phone-install-package) run it here first and put the result in +# the copy as .pkgver, which the PKGBUILDs read before asking git. +# +# OMAMOBILE_PKGVER_SINCE= moves the start of the count (tests replay +# history with it); OMAMOBILE_MAIN_REF sets REF like --main. +set -euo pipefail +die() { echo "pkg-version: $*" >&2; exit 1; } + +main=${OMAMOBILE_MAIN_REF:-} rev=HEAD mode=version want= +while (($#)); do + case $1 in + --main) main=${2:?--main needs a ref}; shift 2 ;; + --rev) rev=${2:?--rev needs a commit}; shift 2 ;; + --history) mode=history; shift ;; + --commit) mode=commit; shift ;; + -h|--help) source "$(dirname -- "${BASH_SOURCE[0]}")/lib/usage.sh"; usage_from_header "$0"; exit 0 ;; + -*) die "unknown option $1" ;; + *) break ;; + esac +done +(($# >= 1)) || die "usage: tools/pkg-version [--main REF] [--rev REV] PACKAGE" +pkg=${1%/}; pkg=${pkg##*/} +[[ $mode != commit ]] || want=${2:?--commit needs PACKAGE VERSION} +[[ $pkg =~ ^[a-z0-9][a-z0-9.+_-]*$ ]] || die "not a package name: $1" + +# The repository: the package directory's, else this tool's. +if [[ -d $1 ]]; then dir=$1; else dir=$(dirname -- "$(readlink -f "${BASH_SOURCE[0]}")"); fi +top=$(git -C "$dir" rev-parse --show-toplevel 2>/dev/null) || + die "$1 is not in a git checkout: build from a clone, or pass the version as .pkgver" +cd -- "$top" +[[ $(git rev-parse --is-shallow-repository) == false ]] || + die "a shallow clone can't count versions: git fetch --unshallow" +path=packages/$pkg +self=tools/pkg-version + +if [[ -z $main ]]; then + for main in origin/main main ''; do + [[ -z $main ]] || git rev-parse -q --verify "$main^{commit}" >/dev/null && break + done + [[ -n $main ]] || main=$rev +fi +git rev-parse -q --verify "$rev^{commit}" >/dev/null || die "no such commit $rev" +git rev-parse -q --verify "$main^{commit}" >/dev/null || die "no such ref $main" + +# "S Z" from a version file's text (Z empty when it gives only a series). +parse() { + local v + v=$(tr -d '[:space:]' <<<"$1") + [[ $v =~ ^([0-9]+\.[0-9]+)(\.([0-9]+))?$ ]] || return 1 + echo "${BASH_REMATCH[1]} ${BASH_REMATCH[3]}" +} +file_at() { git show "$1:$path/version" 2>/dev/null; } + +# Where the count starts on C's first-parent line: the commit that added this +# tool (or OMAMOBILE_PKGVER_SINCE), empty if C comes before it. +since() { + local c=$1 k + if [[ -n ${OMAMOBILE_PKGVER_SINCE:-} ]]; then + k=$(git rev-parse --verify "$OMAMOBILE_PKGVER_SINCE^{commit}") || die "no such commit $OMAMOBILE_PKGVER_SINCE" + git merge-base --is-ancestor "$k" "$c" && echo "$k" + return 0 + fi + git rev-list --first-parent "$c" -- "$self" | tail -1 # tail: head would SIGPIPE git under pipefail +} + +# " " for each commit on C's first-parent line touching the +# package, oldest first. Before the start of the count the version file is +# the version, as it was published. +walk() { + local c=$1 k s z S="" v=-1 f + k=$(since "$c") + local -a before=() after=() + if [[ -z $k ]]; then + mapfile -t before < <(git rev-list --first-parent --reverse "$c" -- "$path") + else + mapfile -t before < <(git rev-list --first-parent --reverse "$k^" -- "$path" 2>/dev/null) + mapfile -t after < <(git rev-list --first-parent --reverse "$k^..$c" -- "$path" 2>/dev/null || + git rev-list --first-parent --reverse "$c" -- "$path") + fi + for f in "${before[@]}"; do + read -r s z < <(parse "$(file_at "$f")") || continue + S=$s v=${z:-0} + echo "$f $S.$v" + done + for f in "${after[@]}"; do + read -r s z < <(parse "$(file_at "$f")") || continue + if [[ $s != "$S" ]]; then + S=$s v=${z:-0} + else + v=$((v + 1)) + [[ -z $z ]] || ((z <= v)) || v=$z + fi + echo "$f $S.$v" + done +} + +case $mode in + history) walk "$main"; exit 0 ;; + commit) + # The whole walk first: leaving its pipe early would SIGPIPE it. + mapfile -t lines < <(walk "$main") + for l in "${lines[@]}"; do + [[ ${l#* } != "$want" ]] || { echo "${l%% *}"; exit 0; } + done + die "$pkg $want was never built on $main" ;; +esac + +[[ -n $(git ls-tree "$rev" -- "$path/version") ]] || die "$path/version doesn't exist at $rev" +if git merge-base --is-ancestor "$rev" "$main"; then + v=$(walk "$rev" | tail -1 | cut -d' ' -f2) + [[ -n $v ]] || die "$path/version doesn't hold a version (0.2 or 0.2.5) at $rev" + echo "$v" + exit 0 +fi + +base=$(git merge-base "$rev" "$main") || die "$rev shares no history with $main" +n=$(git rev-list --count --first-parent "$base..$rev" -- "$path") +v=$(walk "$base" | tail -1 | cut -d' ' -f2) +if ((n == 0)) && [[ -n $v ]]; then echo "$v"; exit 0; fi +read -r s z < <(parse "$(file_at "$rev")") || die "$path/version doesn't hold a version (0.2 or 0.2.5) at $rev" +sha=$(git rev-parse --short=7 "$rev") +# A new package, or a branch that starts a new series: main's first build +# of it will be S.Z, and pacman orders 0.1.0pre1 below 0.1.0. +if [[ -z $v || ${v%.*} != "$s" ]]; then echo "$s.${z:-0}pre$n.g$sha"; exit 0; fi +echo "$v.$n.g$sha" diff --git a/tools/repo-build b/tools/repo-build index 387768cc0..da5a0d8f8 100755 --- a/tools/repo-build +++ b/tools/repo-build @@ -13,6 +13,7 @@ cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." # The release key (docs/RELEASES.md §10), with a clear error without it source tools/lib/signing.sh +source tools/lib/pkg-tar.sh signing_key_load "$PWD" || exit 1 key=$SIGNING_KEY repo=out/repo/aarch64 @@ -36,8 +37,7 @@ for dir in "${dirs[@]}"; do name=$(basename "$dir") echo "==> $name" "$ssh" "rm -rf $build/$name && mkdir -p $build && chown '$phone_user': $build" - tar cf - --exclude="./$name/pkg" --exclude="./$name/src/build" --exclude="*.pkg.tar.*" \ - -C "$(dirname "$dir")" "./$name" | "$ssh" "tar xf - -C $build --no-same-owner && chown -R '$phone_user': $build/$name" + pkg_tar "$dir" | "$ssh" "tar xf - -C $build --no-same-owner && chown -R '$phone_user': $build/$name" # --nodeps: runtime dependencies (e.g. omamobile-keyring) come from this # very repository, so they needn't be installed on the builder. "$ssh" "su - '$phone_user' -c 'cd $build/$name && makepkg -f --nodeps --noconfirm' 2>&1 | tail -1" From 186ac9716e32ad391085c1398962915c679b8357 Mon Sep 17 00:00:00 2001 From: saiththerobo Date: Thu, 12 Nov 2026 08:27:26 +0000 Subject: [PATCH 02/19] packages: pkgver from tools/pkg-version The 30 packages whose PKGBUILD read pkgver from their version file read it from .pkgver when a build tool made a copy, and from tools/pkg-version otherwise. omamobile-keyring (a date the index names) and linux-omamobile (pkgrel only) keep their own schemes; the upstream builds keep their pinned versions. omamobile-remote printed a version written into its script, which had to match the version file by hand (L-640); install now writes the package's pkgver into it. omamobile-voice's test compares pkgver with tools/pkg-version instead of the file. Co-Authored-By: Claude Opus 5.5 --- packages/omamobile-apps/PKGBUILD | 2 +- packages/omamobile-audio/PKGBUILD | 2 +- packages/omamobile-boot-update/PKGBUILD | 2 +- packages/omamobile-device-akita/PKGBUILD | 2 +- packages/omamobile-device-cheetah/PKGBUILD | 2 +- packages/omamobile-device-dodge/PKGBUILD | 2 +- packages/omamobile-device-felix/PKGBUILD | 2 +- packages/omamobile-device-husky/PKGBUILD | 2 +- packages/omamobile-device-lynx/PKGBUILD | 2 +- packages/omamobile-device-oriole/PKGBUILD | 2 +- packages/omamobile-device-panther/PKGBUILD | 2 +- packages/omamobile-device-raven/PKGBUILD | 2 +- packages/omamobile-device-tegu/PKGBUILD | 2 +- packages/omamobile-fingerprint/PKGBUILD | 2 +- packages/omamobile-firstboot/PKGBUILD | 2 +- packages/omamobile-gnss/PKGBUILD | 2 +- packages/omamobile-mirror/PKGBUILD | 2 +- packages/omamobile-mmd/PKGBUILD | 2 +- packages/omamobile-modem-sit/PKGBUILD | 2 +- packages/omamobile-modem/PKGBUILD | 2 +- packages/omamobile-omarchy/PKGBUILD | 2 +- packages/omamobile-owl-widgets/PKGBUILD | 2 +- packages/omamobile-remote/PKGBUILD | 4 ++-- packages/omamobile-remote/bin/omamobile-remote | 2 +- packages/omamobile-remote/install | 5 ++++- packages/omamobile-remote/test/all | 8 +++++--- packages/omamobile-sensors/PKGBUILD | 2 +- packages/omamobile-settings/PKGBUILD | 2 +- packages/omamobile-shell/PKGBUILD | 2 +- packages/omamobile-speaker-tuning/PKGBUILD | 2 +- packages/omamobile-telephony-tegu/PKGBUILD | 2 +- packages/omamobile-voice/PKGBUILD | 2 +- packages/omamobile-voice/test/all | 4 ++-- packages/omamobile-waydroid/PKGBUILD | 2 +- 34 files changed, 43 insertions(+), 38 deletions(-) diff --git a/packages/omamobile-apps/PKGBUILD b/packages/omamobile-apps/PKGBUILD index 7be85452b..731d31d32 100644 --- a/packages/omamobile-apps/PKGBUILD +++ b/packages/omamobile-apps/PKGBUILD @@ -8,7 +8,7 @@ # in `optdepends` with the reason. Device-specific stacks (the modem's RIL # and bridge) never go in `depends`: they belong to the device's image. pkgname=omamobile-apps -pkgver=$(cat "${startdir:-.}/version") +pkgver=$(cat "${startdir:-.}/.pkgver" 2>/dev/null || "${startdir:-.}/../../tools/pkg-version" "${startdir:-.}") pkgrel=1 pkgdesc="Omarchy Mobile's default mobile apps (camera, phone, messages, contacts, images, maps and location, NFC tags)" arch=(any) diff --git a/packages/omamobile-audio/PKGBUILD b/packages/omamobile-audio/PKGBUILD index 74266ee6a..60d3c0354 100644 --- a/packages/omamobile-audio/PKGBUILD +++ b/packages/omamobile-audio/PKGBUILD @@ -1,7 +1,7 @@ # SPDX-License-Identifier: MIT # Maintainer: Derek Ross pkgname=omamobile-audio -pkgver=$(cat "${startdir:-.}/version") +pkgver=$(cat "${startdir:-.}/.pkgver" 2>/dev/null || "${startdir:-.}/../../tools/pkg-version" "${startdir:-.}") pkgrel=1 pkgdesc="Omarchy Mobile audio for the Pixel 7 Pro, Pixel 6 Pro and Pixel 9a: UCM profiles and PipeWire rules for the AoC sound card, Pixel 7 Pro speaker protection with the factory calibration" arch=(any) diff --git a/packages/omamobile-boot-update/PKGBUILD b/packages/omamobile-boot-update/PKGBUILD index 6d8d297eb..8ea50ee12 100644 --- a/packages/omamobile-boot-update/PKGBUILD +++ b/packages/omamobile-boot-update/PKGBUILD @@ -1,7 +1,7 @@ # SPDX-License-Identifier: MIT # Maintainer: Derek Ross pkgname=omamobile-boot-update -pkgver=$(cat "${startdir:-.}/version") +pkgver=$(cat "${startdir:-.}/.pkgver" 2>/dev/null || "${startdir:-.}/../../tools/pkg-version" "${startdir:-.}") pkgrel=1 pkgdesc="Omarchy Mobile: rebuild a phone's slot-B boot images from linux-omamobile and write them, guarded and verified (pacman hook, opt-in)" arch=(any) diff --git a/packages/omamobile-device-akita/PKGBUILD b/packages/omamobile-device-akita/PKGBUILD index 4d4eecb6f..b4559400d 100644 --- a/packages/omamobile-device-akita/PKGBUILD +++ b/packages/omamobile-device-akita/PKGBUILD @@ -1,7 +1,7 @@ # SPDX-License-Identifier: MIT # Maintainer: Derek Ross pkgname=omamobile-device-akita -pkgver=$(cat "${startdir:-.}/version") +pkgver=$(cat "${startdir:-.}/.pkgver" 2>/dev/null || "${startdir:-.}/../../tools/pkg-version" "${startdir:-.}") pkgrel=1 pkgdesc="Omarchy Mobile support for the Google Pixel 8a (akita): storage guard and USB networking" arch=(aarch64) diff --git a/packages/omamobile-device-cheetah/PKGBUILD b/packages/omamobile-device-cheetah/PKGBUILD index 1c8f5d065..fdd7df522 100644 --- a/packages/omamobile-device-cheetah/PKGBUILD +++ b/packages/omamobile-device-cheetah/PKGBUILD @@ -1,7 +1,7 @@ # SPDX-License-Identifier: MIT # Maintainer: Derek Ross pkgname=omamobile-device-cheetah -pkgver=$(cat "${startdir:-.}/version") +pkgver=$(cat "${startdir:-.}/.pkgver" 2>/dev/null || "${startdir:-.}/../../tools/pkg-version" "${startdir:-.}") pkgrel=1 pkgdesc="Omarchy Mobile support for the Google Pixel 7 Pro (cheetah): boot-slot success, storage guard, USB networking" arch=(aarch64) diff --git a/packages/omamobile-device-dodge/PKGBUILD b/packages/omamobile-device-dodge/PKGBUILD index ffd7c803d..ae604cbbb 100644 --- a/packages/omamobile-device-dodge/PKGBUILD +++ b/packages/omamobile-device-dodge/PKGBUILD @@ -1,7 +1,7 @@ # SPDX-License-Identifier: MIT # Maintainer: Martin Lund pkgname=omamobile-device-dodge -pkgver=$(cat "${startdir:-.}/version") +pkgver=$(cat "${startdir:-.}/.pkgver" 2>/dev/null || "${startdir:-.}/../../tools/pkg-version" "${startdir:-.}") pkgrel=1 pkgdesc="Omarchy Mobile support for the OnePlus 13 (dodge): reboot-to-fastboot and USB networking" arch=(aarch64) diff --git a/packages/omamobile-device-felix/PKGBUILD b/packages/omamobile-device-felix/PKGBUILD index 0de7dd309..34441b4ac 100644 --- a/packages/omamobile-device-felix/PKGBUILD +++ b/packages/omamobile-device-felix/PKGBUILD @@ -1,7 +1,7 @@ # SPDX-License-Identifier: MIT # Maintainer: Derek Ross pkgname=omamobile-device-felix -pkgver=$(cat "${startdir:-.}/version") +pkgver=$(cat "${startdir:-.}/.pkgver" 2>/dev/null || "${startdir:-.}/../../tools/pkg-version" "${startdir:-.}") pkgrel=1 pkgdesc="Omarchy Mobile support for the Google Pixel Fold (felix): storage guard and USB networking" arch=(aarch64) diff --git a/packages/omamobile-device-husky/PKGBUILD b/packages/omamobile-device-husky/PKGBUILD index c6dfb1f7e..5ac9b30c4 100644 --- a/packages/omamobile-device-husky/PKGBUILD +++ b/packages/omamobile-device-husky/PKGBUILD @@ -1,7 +1,7 @@ # SPDX-License-Identifier: MIT # Maintainer: Derek Ross pkgname=omamobile-device-husky -pkgver=$(cat "${startdir:-.}/version") +pkgver=$(cat "${startdir:-.}/.pkgver" 2>/dev/null || "${startdir:-.}/../../tools/pkg-version" "${startdir:-.}") pkgrel=1 pkgdesc="Omarchy Mobile support for the Google Pixel 8 Pro (husky): storage guard, USB networking and the USB replug rescue" arch=(aarch64) diff --git a/packages/omamobile-device-lynx/PKGBUILD b/packages/omamobile-device-lynx/PKGBUILD index 4442fb3be..4f42139f3 100644 --- a/packages/omamobile-device-lynx/PKGBUILD +++ b/packages/omamobile-device-lynx/PKGBUILD @@ -1,7 +1,7 @@ # SPDX-License-Identifier: MIT # Maintainer: Derek Ross pkgname=omamobile-device-lynx -pkgver=$(cat "${startdir:-.}/version") +pkgver=$(cat "${startdir:-.}/.pkgver" 2>/dev/null || "${startdir:-.}/../../tools/pkg-version" "${startdir:-.}") pkgrel=1 pkgdesc="Omarchy Mobile support for the Google Pixel 7a (lynx): storage guard, USB networking, and boot-success marker" arch=(aarch64) diff --git a/packages/omamobile-device-oriole/PKGBUILD b/packages/omamobile-device-oriole/PKGBUILD index 3befe18d6..11af2410c 100644 --- a/packages/omamobile-device-oriole/PKGBUILD +++ b/packages/omamobile-device-oriole/PKGBUILD @@ -1,6 +1,6 @@ # SPDX-License-Identifier: MIT pkgname=omamobile-device-oriole -pkgver=$(cat "${startdir:-.}/version") +pkgver=$(cat "${startdir:-.}/.pkgver" 2>/dev/null || "${startdir:-.}/../../tools/pkg-version" "${startdir:-.}") pkgrel=1 pkgdesc="Pixel 6 first-light support: storage policy, USB networking and boot helpers" arch=(aarch64) diff --git a/packages/omamobile-device-panther/PKGBUILD b/packages/omamobile-device-panther/PKGBUILD index f01769587..a934de44c 100644 --- a/packages/omamobile-device-panther/PKGBUILD +++ b/packages/omamobile-device-panther/PKGBUILD @@ -1,7 +1,7 @@ # SPDX-License-Identifier: MIT # Maintainer: Derek Ross pkgname=omamobile-device-panther -pkgver=$(cat "${startdir:-.}/version") +pkgver=$(cat "${startdir:-.}/.pkgver" 2>/dev/null || "${startdir:-.}/../../tools/pkg-version" "${startdir:-.}") pkgrel=1 pkgdesc="Omarchy Mobile support for the Google Pixel 7 (panther): storage guard, USB networking, GPU, haptics, suspend-to-idle, USB after a replug, display brightness, Wi-Fi" arch=(aarch64) diff --git a/packages/omamobile-device-raven/PKGBUILD b/packages/omamobile-device-raven/PKGBUILD index 0153bf58d..3f6b38b2d 100644 --- a/packages/omamobile-device-raven/PKGBUILD +++ b/packages/omamobile-device-raven/PKGBUILD @@ -1,6 +1,6 @@ # SPDX-License-Identifier: MIT pkgname=omamobile-device-raven -pkgver=$(cat "${startdir:-.}/version") +pkgver=$(cat "${startdir:-.}/.pkgver" 2>/dev/null || "${startdir:-.}/../../tools/pkg-version" "${startdir:-.}") pkgrel=1 pkgdesc="Omarchy Mobile support for the Google Pixel 6 Pro (raven): boot-slot success, USB rescue, display, power and module policy" arch=(aarch64) diff --git a/packages/omamobile-device-tegu/PKGBUILD b/packages/omamobile-device-tegu/PKGBUILD index 2732b538d..9f563fda1 100644 --- a/packages/omamobile-device-tegu/PKGBUILD +++ b/packages/omamobile-device-tegu/PKGBUILD @@ -1,7 +1,7 @@ # SPDX-License-Identifier: MIT # Maintainer: Derek Ross pkgname=omamobile-device-tegu -pkgver=$(cat "${startdir:-.}/version") +pkgver=$(cat "${startdir:-.}/.pkgver" 2>/dev/null || "${startdir:-.}/../../tools/pkg-version" "${startdir:-.}") pkgrel=1 pkgdesc="Omarchy Mobile support for the Google Pixel 9a (tegu): storage guard, USB networking, hang-safe graphics start" arch=(aarch64) diff --git a/packages/omamobile-fingerprint/PKGBUILD b/packages/omamobile-fingerprint/PKGBUILD index 525dfe6e4..e13c8d8be 100644 --- a/packages/omamobile-fingerprint/PKGBUILD +++ b/packages/omamobile-fingerprint/PKGBUILD @@ -1,7 +1,7 @@ # SPDX-License-Identifier: MIT # Maintainer: Derek Ross pkgname=omamobile-fingerprint -pkgver=$(cat "${startdir:-.}/version") +pkgver=$(cat "${startdir:-.}/.pkgver" 2>/dev/null || "${startdir:-.}/../../tools/pkg-version" "${startdir:-.}") pkgrel=1 pkgdesc="Omarchy Mobile fingerprint for the Pixel 7 Pro: Google's HAL in a chroot, bridged to fprintd" arch=(aarch64) diff --git a/packages/omamobile-firstboot/PKGBUILD b/packages/omamobile-firstboot/PKGBUILD index a9a5c281c..285c241bd 100644 --- a/packages/omamobile-firstboot/PKGBUILD +++ b/packages/omamobile-firstboot/PKGBUILD @@ -1,7 +1,7 @@ # SPDX-License-Identifier: MIT # Maintainer: Derek Ross pkgname=omamobile-firstboot -pkgver=$(cat "${startdir:-.}/version") +pkgver=$(cat "${startdir:-.}/.pkgver" 2>/dev/null || "${startdir:-.}/../../tools/pkg-version" "${startdir:-.}") pkgrel=1 pkgdesc="Omarchy Mobile first boot: the user, SSH key, firewall and Omarchy's setup from the installer's answers" arch=(any) diff --git a/packages/omamobile-gnss/PKGBUILD b/packages/omamobile-gnss/PKGBUILD index e5964331a..88cbce8b4 100644 --- a/packages/omamobile-gnss/PKGBUILD +++ b/packages/omamobile-gnss/PKGBUILD @@ -1,7 +1,7 @@ # SPDX-License-Identifier: MIT # Maintainer: Derek Ross pkgname=omamobile-gnss -pkgver=$(cat "${startdir:-.}/version") +pkgver=$(cat "${startdir:-.}/.pkgver" 2>/dev/null || "${startdir:-.}/../../tools/pkg-version" "${startdir:-.}") pkgrel=1 pkgdesc="Omarchy Mobile GNSS for the Pixel 7 Pro: Broadcom's lhd/gpsd in a vendor chroot, NMEA to GeoClue on demand" arch=(aarch64) diff --git a/packages/omamobile-mirror/PKGBUILD b/packages/omamobile-mirror/PKGBUILD index 8550eca11..863931674 100644 --- a/packages/omamobile-mirror/PKGBUILD +++ b/packages/omamobile-mirror/PKGBUILD @@ -1,7 +1,7 @@ # SPDX-License-Identifier: MIT # Maintainer: Derek Ross pkgname=omamobile-mirror -pkgver=$(cat "${startdir:-.}/version") +pkgver=$(cat "${startdir:-.}/.pkgver" 2>/dev/null || "${startdir:-.}/../../tools/pkg-version" "${startdir:-.}") pkgrel=1 pkgdesc="Omarchy Mobile screen mirroring: the phone's screen and input on a computer over the USB cable (wayvnc)" arch=(any) diff --git a/packages/omamobile-mmd/PKGBUILD b/packages/omamobile-mmd/PKGBUILD index faba84561..180d3884b 100644 --- a/packages/omamobile-mmd/PKGBUILD +++ b/packages/omamobile-mmd/PKGBUILD @@ -1,7 +1,7 @@ # SPDX-License-Identifier: MIT # Maintainer: Derek Ross pkgname=omamobile-mmd -pkgver=$(cat "${startdir:-.}/version") +pkgver=$(cat "${startdir:-.}/.pkgver" 2>/dev/null || "${startdir:-.}/../../tools/pkg-version" "${startdir:-.}") pkgrel=1 pkgdesc="Omarchy Mobile ModemManager-compatible bridge: org.freedesktop.ModemManager1 served from omamobile-sitd" arch=(aarch64) diff --git a/packages/omamobile-modem-sit/PKGBUILD b/packages/omamobile-modem-sit/PKGBUILD index dbf3a6726..f2ea587d4 100644 --- a/packages/omamobile-modem-sit/PKGBUILD +++ b/packages/omamobile-modem-sit/PKGBUILD @@ -1,7 +1,7 @@ # SPDX-License-Identifier: MIT # Maintainer: Derek Ross pkgname=omamobile-modem-sit -pkgver=$(cat "${startdir:-.}/version") +pkgver=$(cat "${startdir:-.}/.pkgver" 2>/dev/null || "${startdir:-.}/../../tools/pkg-version" "${startdir:-.}") pkgrel=1 pkgdesc="Omarchy Mobile SIT RIL for the Pixel 7 Pro's S5300: LTE registration, IMS calls and SMS, cellular data on rmnet0" arch=(aarch64) diff --git a/packages/omamobile-modem/PKGBUILD b/packages/omamobile-modem/PKGBUILD index f010fc4bc..73a6b5342 100644 --- a/packages/omamobile-modem/PKGBUILD +++ b/packages/omamobile-modem/PKGBUILD @@ -1,7 +1,7 @@ # SPDX-License-Identifier: MIT # Maintainer: Derek Ross pkgname=omamobile-modem -pkgver=$(cat "${startdir:-.}/version") +pkgver=$(cat "${startdir:-.}/.pkgver" 2>/dev/null || "${startdir:-.}/../../tools/pkg-version" "${startdir:-.}") pkgrel=1 pkgdesc="Omarchy Mobile modem runtime for the Pixel 7 Pro: stock rfsd and cbd in a vendor chroot on RAM copies of NV, with a per-phone overlay for the modem's own NV writes" arch=(aarch64) diff --git a/packages/omamobile-omarchy/PKGBUILD b/packages/omamobile-omarchy/PKGBUILD index 9584abe80..2c587d80b 100644 --- a/packages/omamobile-omarchy/PKGBUILD +++ b/packages/omamobile-omarchy/PKGBUILD @@ -1,7 +1,7 @@ # SPDX-License-Identifier: MIT # Maintainer: Derek Ross pkgname=omamobile-omarchy -pkgver=$(cat "${startdir:-.}/version") +pkgver=$(cat "${startdir:-.}/.pkgver" 2>/dev/null || "${startdir:-.}/../../tools/pkg-version" "${startdir:-.}") pkgrel=1 pkgdesc="Omarchy Mobile's Omarchy patches, re-applied after every Omarchy upgrade, omamobile-update, Omarchy's update for a phone, and a kernel module cleanup that keeps the next boot's modules" arch=(any) diff --git a/packages/omamobile-owl-widgets/PKGBUILD b/packages/omamobile-owl-widgets/PKGBUILD index 2331c4ae1..0007e23a6 100644 --- a/packages/omamobile-owl-widgets/PKGBUILD +++ b/packages/omamobile-owl-widgets/PKGBUILD @@ -5,7 +5,7 @@ # conformance suite (status.json), and an index built with our compiler. # No previews (docs/WIDGET-INTEROP-PLAN.md Q10). pkgname=omamobile-owl-widgets -pkgver=$(cat "${startdir:-.}/version") +pkgver=$(cat "${startdir:-.}/.pkgver" 2>/dev/null || "${startdir:-.}/../../tools/pkg-version" "${startdir:-.}") pkgrel=1 _commit=b63886b pkgdesc="Omarchy Mobile: OWL home-screen widgets from the omarchy-widgets store (the built-ins and the Store tab), checked against our runtime" diff --git a/packages/omamobile-remote/PKGBUILD b/packages/omamobile-remote/PKGBUILD index 5c15e6056..98d8b6fc4 100644 --- a/packages/omamobile-remote/PKGBUILD +++ b/packages/omamobile-remote/PKGBUILD @@ -1,7 +1,7 @@ # SPDX-License-Identifier: MIT # Maintainer: Derek Ross pkgname=omamobile-remote -pkgver=$(cat "${startdir:-.}/version") +pkgver=$(cat "${startdir:-.}/.pkgver" 2>/dev/null || "${startdir:-.}/../../tools/pkg-version" "${startdir:-.}") pkgrel=1 pkgdesc="Use an Omarchy Mobile phone over ssh like a person would: screenshots, keys, taps, scrolling, locking, unlocking, apps, keeping it awake during a test. Opt-in, enables nothing" arch=(any) @@ -15,5 +15,5 @@ check() { } package() { - "$startdir/install" "$pkgdir" + "$startdir/install" "$pkgdir" "$pkgver" } diff --git a/packages/omamobile-remote/bin/omamobile-remote b/packages/omamobile-remote/bin/omamobile-remote index c0e11867d..7f56c9a4c 100755 --- a/packages/omamobile-remote/bin/omamobile-remote +++ b/packages/omamobile-remote/bin/omamobile-remote @@ -136,7 +136,7 @@ cmd=${1:-help} shift || true case $cmd in help|-h|--help) sed -n '3,30p' "$0" | sed 's/^# \{0,1\}//'; exit 0 ;; - version) echo "omamobile-remote 0.1.2"; exit 0 ;; + version) echo "omamobile-remote @VERSION@"; exit 0 ;; # the package's version, set by install esac find_session diff --git a/packages/omamobile-remote/install b/packages/omamobile-remote/install index 11eed7a38..432f433a5 100755 --- a/packages/omamobile-remote/install +++ b/packages/omamobile-remote/install @@ -1,6 +1,8 @@ #!/bin/bash # SPDX-License-Identifier: MIT -# Stage the package into DESTDIR (./install DESTDIR, an absolute path). It +# Stage the package into DESTDIR (./install DESTDIR [VERSION], an absolute +# path; VERSION, the PKGBUILD's pkgver, is what `omamobile-remote version` +# prints). It # installs scripts only: no unit, no udev rule, no group, no network listener. # Nothing here runs until somebody logs in over ssh and runs it. set -euo pipefail @@ -9,5 +11,6 @@ d=${1:?usage: install DESTDIR} cd "$(dirname "$(readlink -f "$0")")" install -Dm755 bin/omamobile-remote "$d/usr/bin/omamobile-remote" +sed -i "s/@VERSION@/${2:-unknown}/" "$d/usr/bin/omamobile-remote" install -Dm644 README.md "$d/usr/share/doc/omamobile-remote/README.md" install -Dm644 LICENSE "$d/usr/share/licenses/omamobile-remote/LICENSE" diff --git a/packages/omamobile-remote/test/all b/packages/omamobile-remote/test/all index be1f849f4..74c764057 100755 --- a/packages/omamobile-remote/test/all +++ b/packages/omamobile-remote/test/all @@ -17,9 +17,11 @@ trap 'rm -rf "$tmp"' EXIT mkdir -p "$tmp/noproc" export OMAMOBILE_REMOTE_PROC=$tmp/noproc -# --- the printed version matches the version file -check "omamobile-remote version prints the version file" \ - test "$(bin/omamobile-remote version)" = "omamobile-remote $(cat version)" +# --- the printed version is the package's: install puts pkgver in +mkdir -p "$tmp/dest" +./install "$tmp/dest" 0.1.7.2.gabc1234 >/dev/null +check "omamobile-remote version prints the version install was given" \ + test "$("$tmp/dest/usr/bin/omamobile-remote" version)" = "omamobile-remote 0.1.7.2.gabc1234" # --- the scripts parse for f in bin/* install test/all test/fake/*; do diff --git a/packages/omamobile-sensors/PKGBUILD b/packages/omamobile-sensors/PKGBUILD index 6bf774034..36397788e 100644 --- a/packages/omamobile-sensors/PKGBUILD +++ b/packages/omamobile-sensors/PKGBUILD @@ -1,7 +1,7 @@ # SPDX-License-Identifier: MIT # Maintainer: Derek Ross pkgname=omamobile-sensors -pkgver=$(cat "${startdir:-.}/version") +pkgver=$(cat "${startdir:-.}/.pkgver" 2>/dev/null || "${startdir:-.}/../../tools/pkg-version" "${startdir:-.}") pkgrel=1 pkgdesc="Omarchy Mobile sensors for the Pixel 7 Pro: iio-sensor-proxy's D-Bus API from the AoC, auto-rotate for Hyprland" arch=(any) diff --git a/packages/omamobile-settings/PKGBUILD b/packages/omamobile-settings/PKGBUILD index 28ab9ed7f..f8b7c44a8 100644 --- a/packages/omamobile-settings/PKGBUILD +++ b/packages/omamobile-settings/PKGBUILD @@ -1,6 +1,6 @@ # SPDX-License-Identifier: MIT pkgname=omamobile-settings -pkgver=$(cat "${startdir:-.}/version") +pkgver=$(cat "${startdir:-.}/.pkgver" 2>/dev/null || "${startdir:-.}/../../tools/pkg-version" "${startdir:-.}") pkgrel=1 pkgdesc="Native mobile Settings framework and device information" arch=(aarch64 x86_64) diff --git a/packages/omamobile-shell/PKGBUILD b/packages/omamobile-shell/PKGBUILD index b662b4da6..e670c8411 100644 --- a/packages/omamobile-shell/PKGBUILD +++ b/packages/omamobile-shell/PKGBUILD @@ -1,7 +1,7 @@ # SPDX-License-Identifier: MIT # Maintainer: Derek Ross pkgname=omamobile-shell -pkgver=$(cat "${startdir:-.}/version") +pkgver=$(cat "${startdir:-.}/.pkgver" 2>/dev/null || "${startdir:-.}/../../tools/pkg-version" "${startdir:-.}") pkgrel=1 pkgdesc="Omarchy Mobile's phone profile for the Omarchy shell: status bar, quick settings, launcher" arch=(any) diff --git a/packages/omamobile-speaker-tuning/PKGBUILD b/packages/omamobile-speaker-tuning/PKGBUILD index 118629594..399ac3f93 100644 --- a/packages/omamobile-speaker-tuning/PKGBUILD +++ b/packages/omamobile-speaker-tuning/PKGBUILD @@ -1,7 +1,7 @@ # SPDX-License-Identifier: MIT # Maintainer: Derek Ross pkgname=omamobile-speaker-tuning -pkgver=$(cat "${startdir:-.}/version") +pkgver=$(cat "${startdir:-.}/.pkgver" 2>/dev/null || "${startdir:-.}/../../tools/pkg-version" "${startdir:-.}") pkgrel=1 pkgdesc="Omarchy Mobile speaker tuning for the Pixel 7 Pro: Waves on the AoC, configured from the user's own vendor files" arch=(aarch64) diff --git a/packages/omamobile-telephony-tegu/PKGBUILD b/packages/omamobile-telephony-tegu/PKGBUILD index 0da8e53cb..7acede794 100644 --- a/packages/omamobile-telephony-tegu/PKGBUILD +++ b/packages/omamobile-telephony-tegu/PKGBUILD @@ -1,6 +1,6 @@ # SPDX-License-Identifier: MIT pkgname=omamobile-telephony-tegu -pkgver=$(cat "${startdir:-.}/version") +pkgver=$(cat "${startdir:-.}/.pkgver" 2>/dev/null || "${startdir:-.}/../../tools/pkg-version" "${startdir:-.}") pkgrel=1 pkgdesc="Opt-in Pixel 9a Phone/Messages bridge attachment to an already running sitd" arch=(any) diff --git a/packages/omamobile-voice/PKGBUILD b/packages/omamobile-voice/PKGBUILD index 88870f2a6..b966a49fd 100644 --- a/packages/omamobile-voice/PKGBUILD +++ b/packages/omamobile-voice/PKGBUILD @@ -17,7 +17,7 @@ # makepkg has no fallback for one source; a copy on our own server would # replace this URL (same file name, same sha256). pkgname=omamobile-voice -pkgver=$(cat "${startdir:-.}/version") +pkgver=$(cat "${startdir:-.}/.pkgver" 2>/dev/null || "${startdir:-.}/../../tools/pkg-version" "${startdir:-.}") pkgrel=1 _commit=5359861c739e955e79d9a303bcbc70fb988958b1 _model=ggml-base.en.bin diff --git a/packages/omamobile-voice/test/all b/packages/omamobile-voice/test/all index 7467fe3df..d0b4822c4 100755 --- a/packages/omamobile-voice/test/all +++ b/packages/omamobile-voice/test/all @@ -18,8 +18,8 @@ bash -n "$here/PKGBUILD" || fail "PKGBUILD parses" eval "$(startdir=$here bash -c 'source "$startdir/PKGBUILD" printf "pkgname=%q pkgver=%q commit=%q model=%q url0=%q sum0=%q\n" "$pkgname" "$pkgver" "$_commit" "$_model" "${source[0]}" "${sha256sums[0]}" printf "deps=%q\n" "${depends[*]:-}"')" -[[ $pkgname == omamobile-voice && $pkgver == "$(cat "$here/version")" ]] || fail "name and version" -ok "PKGBUILD parses, version from ./version" +[[ $pkgname == omamobile-voice && $pkgver == "$("$repo/tools/pkg-version" "$here")" ]] || fail "name and version" +ok "PKGBUILD parses, version from tools/pkg-version" [[ $commit =~ ^[0-9a-f]{40}$ ]] || fail "the source is pinned to a full commit, not a branch: $commit" [[ $url0 == "$model-$commit::https://huggingface.co/ggerganov/whisper.cpp/resolve/$commit/$model" ]] || fail "the model's URL names the pinned commit: $url0" diff --git a/packages/omamobile-waydroid/PKGBUILD b/packages/omamobile-waydroid/PKGBUILD index f3962f705..a83dd3541 100644 --- a/packages/omamobile-waydroid/PKGBUILD +++ b/packages/omamobile-waydroid/PKGBUILD @@ -1,7 +1,7 @@ # SPDX-License-Identifier: MIT # Maintainer: Derek Ross pkgname=omamobile-waydroid -pkgver=$(cat "${startdir:-.}/version") +pkgver=$(cat "${startdir:-.}/.pkgver" 2>/dev/null || "${startdir:-.}/../../tools/pkg-version" "${startdir:-.}") pkgrel=1 pkgdesc="Omarchy Mobile Waydroid integration: kernel checks, container hardening, Mali-G710 Mesa overlay, ufw rules" arch=(any) From cbb2f235a11dafb2939a3c56cfdfae223c18626a Mon Sep 17 00:00:00 2001 From: saiththerobo Date: Thu, 12 Nov 2026 08:27:26 +0000 Subject: [PATCH 03/19] CONTRIBUTING, AGENTS, RELEASES: versions are counted, not bumped MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subjects drop the version, the PR template asks for no bump, and CONTRIBUTING §6.3 says how versions come about now: the series in the version file, one number per commit on main, a branch build's suffix, and that a dependency on a change not yet on main names a version main has shipped or a provides name. AGENTS lists the tool; RELEASES §7 and the packages stage read the version from it; the reviewer agent checks for no bump. Co-Authored-By: Claude Opus 5.5 --- .claude/agents/omamobile-reviewer.md | 3 ++- .github/pull_request_template.md | 2 +- AGENTS.md | 5 +++-- CONTRIBUTING.md | 3 ++- docs/KEYBOARD-LAYOUTS.md | 2 +- docs/RELEASES.md | 6 +++--- docs/REMOTE-TESTING.md | 2 +- 7 files changed, 13 insertions(+), 10 deletions(-) diff --git a/.claude/agents/omamobile-reviewer.md b/.claude/agents/omamobile-reviewer.md index 7ab98af20..c1b7e20ac 100644 --- a/.claude/agents/omamobile-reviewer.md +++ b/.claude/agents/omamobile-reviewer.md @@ -128,7 +128,8 @@ that would land wrong. cited; Google's copyright kept on imported code; SPDX headers. - **Conventions:** area prefixes (this repo) or subsystem prefixes from `git log --oneline ` (kernel); bodies that say why with evidence; - package `version` bumped with the version in the subject; a human + no package `version` bump (`tools/pkg-version` counts it; a new series + only on purpose); a human Signed-off-by on kernel commits and never an AI one; the plan updated with a gated runbook (Expect/Pass, stop condition, rollback, risk) for anything run on a phone. diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 2ca376343..07b845261 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -21,7 +21,7 @@ partition contents: use placeholders such as . - [ ] `tools/pr-check origin/main` passes - [ ] `tests/all` passes - [ ] `tests/packages` passes (or the packages I touched: ...) -- [ ] Each changed package has its `version` bumped, and the new version is in the commit subject +- [ ] No package `version` bumped: the version is counted at merge (`tools/pkg-version`, CONTRIBUTING §6.3) - [ ] Commits have area prefixes and bodies that say why; any AI help is a `Co-Authored-By:` or `Assisted-by:` trailer, never a `Signed-off-by:` ## On the phone diff --git a/AGENTS.md b/AGENTS.md index b17243cd5..d1960232f 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -56,7 +56,7 @@ Omarchy Mobile runs native Omarchy (Arch Linux ARM, Hyprland, Omarchy's packages ``` This leaves other people's staged and unstaged changes alone. -- **Moving a feature from bring-up into a package:** bump the package `version`, enable nothing that isn't hang-safe, and delete the bring-up files from `/etc/modprobe.d` on the phone (`omamobile-*-bringup.conf`, and any hand-copied package file). A file in `/etc/modprobe.d` replaces the package's `/usr/lib/modprobe.d` file of the same name, so a stale `omamobile-aoc.conf` there hid the package's new blacklist. +- **Moving a feature from bring-up into a package:** enable nothing that isn't hang-safe, and delete the bring-up files from `/etc/modprobe.d` on the phone (`omamobile-*-bringup.conf`, and any hand-copied package file). A file in `/etc/modprobe.d` replaces the package's `/usr/lib/modprobe.d` file of the same name, so a stale `omamobile-aoc.conf` there hid the package's new blacklist. - **Kernel releases change with every push** (`7.3.0-rc6-omamobile-push1-NNNNN-g`). `bin/omamobile push` runs `modules-push` when the tarball's checksum differs. Without its modules a new kernel boots without its drivers, the GPU among them. `modules-push` replaces `/usr/lib/modules/` as a whole; on the 9a that once took a hand-installed panel driver with it, and the display stayed on the boot logo. It now refuses when the folder holds modules added or swapped by hand since the last push (it records what each push installed in `.omamobile-modules.sha256`), and `OMAMOBILE_MODULES_REPLACE=1` overrides that, wiping them. Pin a daily release whose folder carries hand-installed modules (`/usr/lib/modules/.omamobile-pinned`), and keep a copy before overriding (`tar -C /usr/lib/modules -cf … `). - **Stop the modem before a `push` or a `reboot-to`.** `push` ends in `reboot-to`, a raw reboot syscall that stops no unit, so `omamobile-modem.service` never runs its clean stop and its `modem-up` marker stays. On the 7 Pro, where the modem starts at boot (device-cheetah 0.1.43+), the next boot counts that as an unclean end ("ended without a clean stop: a hang or a reset"); from `omamobile-modem` 0.1.19 it starts the modem all the same (before, it skipped the modem once), and a second such end before a clean stop holds it off until `omamobile-modem-start --retry`. So a skipped stop no longer costs a boot's modem, but it uses up the one unclean end the guard allows. This happened on 2026-11-08 after a `reboot-to bootloader` taken to charge a flat battery. So run `systemctl stop omamobile-modem` first, as part of the reboot the human said yes to; a reboot that needs no reason can be `systemctl reboot` instead, which stops it. The stop powers the CP off (one recovered UFS error-handler pass, as any reboot with the modem up costs) and, with the NV overlay on, captures its writes. For now it takes about 40 s and ends as "failed", with the CP's power-off logged as a crash; the marker is still removed ([#532](https://github.com/derekross/omarchy-mobile/issues/532)). This is not the restart the modem notes below forbid: nothing starts the modem again before the reboot. From `omamobile-modem` 0.1.21, with a device package whose `reboot-to` notes the boot it ends ([#403](https://github.com/derekross/omarchy-mobile/pull/403)), the next boot doesn't count a marker from that boot, so a `reboot-to` no longer uses up the unclean end (one already counted stays counted); the CP's ordered power-off and the NV capture still come only from the unit's stop, so the rule stands. [MODEM-PLAN](device/cheetah/MODEM-PLAN.md) M4.6b @@ -104,6 +104,7 @@ tools/phone-ssh CMD -> run anything; stream files with ssh 'cat > f' < f | `packages/linux-omamobile/stage KERNEL_OUT`, `tools/stage-boot-files` | Stage a kernel build for the kernel package, and a device's dtbo, overlays and release initramfs for its device package (gitignored `prebuilt/`, `boot-files/`); laptop only, no phone | | `omamobile-omarchy-patches status\|verify\|apply` (on the phone) | The Omarchy patch series: what is applied, already upstream or failed; `apply` re-applies it all or nothing (the pacman hook does this after every Omarchy upgrade). Log: `/var/log/omamobile/omarchy-patches.log` | | `tools/build-packages`, `tools/build-rootfs` | aarch64 packages (signed, `out/repo`) and the root image, built on the laptop in an Arch Linux ARM container (qemu-user); no phone | +| `tools/pkg-version PACKAGE`, `--commit PACKAGE VERSION` | A package's version, counted from `main`'s history (the series in `version`, then one per commit touching the package; off `main`, `..g` on top), and the commit a version was built from. Read-only. The build tools put it in their copies as `.pkgver`; it refuses a shallow clone | | `tools/install-phone` | The installer: fastboot checks, the owner's answers into a local image copy, then only slot B's images and `userdata`. Asks the human to type the codename; `--dry-run` first. Never run it without the human's go | | `tools/nv-backup DIR`, `--check DIR` | The read-only backup of the radio and calibration partitions (the descriptor's `NV_PARTS` and `NV_BACKUP_EXTRA`) over USB SSH, found by `PARTNAME`, refused unless all are read-only and unmounted, each copy verified against a second read on the phone; `--check` is the checksum check of section 1 against such a backup. The output holds the IMEI: never commit or share it | | `tools/phone-provision` | After a fresh install: Google's files from the user's factory image and the phone's own data from the backup. The run is named, never guessed, and there is no default backup directory: `--first-install --nv-backup DIR` (board id from the phone, NV checksums from the owner's `nv-backup`) or `--restore DIR` (a `phone-config.tar`; `--backup DIR` is the older spelling). `--fingerprint` copies only the calibration and `persist:/ss` copies (the runner makes both itself on a new install), `--restore-td` also Trusty's TD and the enrolled fingers, valid only if no storageproxyd ran since the backup; it never starts the service | @@ -217,7 +218,7 @@ Each entry gives the gotcha, then the reason or the fix. Details are in the link - pointer handlers declared directly on a window get no events, so put them on an Item inside it; - Qt 6.12's `QtQuick/Color` shadows Omarchy's `Commons.Color`, so import `qs.Commons as Commons`. - **pacman.conf order on aarch64:** `[omamobile]`, then `[omarchy]`, then Arch Linux ARM's repositories, so our Mesa and Omarchy's builds win. Use `omarchy update`, not `pacman -Syu`: on the phone it hands over to `omamobile-update` (patch 0012), which refuses a wrong order, low battery, another kernel or a bootloader package (`linux-omamobile` passes only when `omamobile-boot-update preflight` does), skips Snapper, the AUR and gum prompts, and holds boot-related migrations ([RELEASES](docs/RELEASES.md) §5.4). -- **Omarchy upgrades overwrite our Omarchy patches;** `omamobile-omarchy`'s pacman hook puts them back (all or nothing, from Omarchy's own files). Two families are selected by the installed Omarchy version: 4.5, which `[omamobile]` holds phones at since 2026-11-11 (`rootfs/packages.pinned`), uses `packages/omamobile-omarchy/patches/` (`patches/omarchy` links only to that family); a phone still on 4.0.6 uses `packages/omamobile-omarchy/legacy-4.0.6/` until its next `omarchy update`. Fixes go in `patches/`; `legacy-4.0.6/` takes only what a phone needs to get through that update. Bump the package version and make the selected family apply with `--fuzz=0` on the Omarchy the phone runs: `packages/omamobile-omarchy/test/all` applies it to the real aarch64 package. A patch Omarchy has absorbed is reported as upstream: drop it. +- **Omarchy upgrades overwrite our Omarchy patches;** `omamobile-omarchy`'s pacman hook puts them back (all or nothing, from Omarchy's own files). Two families are selected by the installed Omarchy version: 4.5, which `[omamobile]` holds phones at since 2026-11-11 (`rootfs/packages.pinned`), uses `packages/omamobile-omarchy/patches/` (`patches/omarchy` links only to that family); a phone still on 4.0.6 uses `packages/omamobile-omarchy/legacy-4.0.6/` until its next `omarchy update`. Fixes go in `patches/`; `legacy-4.0.6/` takes only what a phone needs to get through that update. Make the selected family apply with `--fuzz=0` on the Omarchy the phone runs: `packages/omamobile-omarchy/test/all` applies it to the real aarch64 package. A patch Omarchy has absorbed is reported as upstream: drop it. - **`environment.d` can't unset a variable:** `VAR=` with an empty value is a syntax error, and the generator skips the line silently, so the old value stays. Set an explicit value instead (`omamobile-shell` uses `none`). - **GeoClue answers no client until an authorization agent is registered for the caller's user,** and queues the call with no timeout, so every client just times out. `omamobile-gnss` runs GeoClue's demo agent as a user unit; app allow-list entries skip only the agent's question, not the agent. - **Firewall changes** (ufw is on): arm `systemd-run --on-active=90 /usr/bin/ufw disable` first, then check with a fresh SSH connection (`tools/phone-ssh --fresh`). diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f8816e5b5..5b4b5b311 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -305,7 +305,8 @@ Findings that matter beyond one subsystem go into `device//NOTES.md`, ### 6.3 This repository -- **Commit subjects** name the area, then say what changed: `omamobile-gnss: package GNSS with location on demand`, `device-cheetah 0.1.15: reconnect USB after a replug`, `shell 0.1.17: …`, `DISPLAY-PLAN: D3b-1b result, …`, `NOTES: …`. When a commit changes a package, bump its `version` file and put the new version in the subject. +- **Commit subjects** name the area, then say what changed: `omamobile-gnss: package GNSS with location on demand`, `omamobile-device-cheetah: reconnect USB after a replug`, `DISPLAY-PLAN: D3b-1b result, …`, `NOTES: …`. +- **Package versions are counted, not written.** Leave `version` alone: [`tools/pkg-version`](tools/pkg-version) gives every commit on `main` that touches a package the next number of its series (the first two numbers in `version`), so two merges can't ship one number. A build off `main` gets `..g`, which `pacman` orders between `main`'s builds. Change `version` only to start a new series (`0.2` to `0.3`); a third number there is read as a floor and nothing else, so an old-style bump does no harm. A dependency on a change that isn't on `main` yet can't name its number: depend on a version `main` has already shipped, or on a name the other package `provides`. - **Bodies** explain the why and what was tested. Wrap at 72 columns. If an AI assistant co-wrote the commit, end with a `Co-Authored-By:` trailer, as the history does. - **Every file has an SPDX header** (§7). - **Describe what something is built from, not which other project it's based on.** Docs, the README, device notes and the website don't name or compare other mobile Linux projects or distributions: say "Arch Linux ARM with the `linux-megi` kernel", not "based on X". Citing a properly licensed source for a fact (upstream Linux, Google's GPL kernel, postmarketOS, Mesa, Omarchy) is fine, and expected. diff --git a/docs/KEYBOARD-LAYOUTS.md b/docs/KEYBOARD-LAYOUTS.md index c6cf33690..dd8b75994 100644 --- a/docs/KEYBOARD-LAYOUTS.md +++ b/docs/KEYBOARD-LAYOUTS.md @@ -66,6 +66,6 @@ Do not edit a generated file. Every file but the two hand-made terminal ones is 3. Run `squeekboard/generate --check`. It strips the generator's additions from each file, regenerates and compares (lines 170-189, 201-211). 4. Run the tests from `packages/omamobile-shell/`: `test/all` runs `python3 -B test/keyboard-layouts.py` (every layout as squeekboard 1.43.1 parses it, the action row in every view, the globe keysym, known keysyms when libxkbcommon is installed; it exits 77, a skip, without PyYAML) and, only when that passes, `squeekboard/generate --check`; then `bash test/keyboard-languages.sh` (`omamobile-keyboard-languages` against a fake `gsettings`) (`test/all` lines 428-436, 463). Each can also be run on its own. 5. From the repository root, run `tools/pr-check` and `tests/packages` before pushing (see the tools table in `AGENTS.md`). -6. Bump `version` and note the change in the package `README.md` and this page. +6. Note the change in the package `README.md` and this page. A new language is selectable once the package is installed with its portrait file in `squeekboard/keyboards/`: `omamobile-keyboard-languages list` then offers every top-level portrait file in the installed directory, and `omamobile-setup-user` links it at the next login. To try one before packaging, set `OMAMOBILE_KEYBOARDS_DIR` to the source directory for the list. diff --git a/docs/RELEASES.md b/docs/RELEASES.md index 513cb67f1..86439d100 100644 --- a/docs/RELEASES.md +++ b/docs/RELEASES.md @@ -414,8 +414,8 @@ automatic boot-update policy. | Thing | Version | Where it is recorded | | --- | --- | --- | | Kernel | `uname -r`: `7.3.0-rc6-omamobile-g`; pkgver `7.3.0rc6.r.g` (§4) | annotated tag `kernel-` (`.1`, `.2` for a respin) on `omamobile` in linux-omarchy-mobile; the scheme is a proposal for the maintainer to confirm | -| Packages | each package's `version` file, bumped in the commit that changes it (CONTRIBUTING §6.3) | the package | -| Descriptor | none of its own; a change to it is a device-package change and bumps that package | `omamobile-device-` | +| Packages | the series in each package's `version` file, then the count of commits on `main` that touched the package (`tools/pkg-version`, CONTRIBUTING §6.3) | `main`'s history: `tools/pkg-version --commit ` | +| Descriptor | none of its own; a change to it is a device-package change and gives that package a new version | `omamobile-device-` | | Bundle | calendar version ``, with `.1`, `.2` for a respin the same day | tag `release-` in this repository, covering every device released that day; `MANIFEST` pins the kernel tag, every package version and both commits | A release never contains a kernel or package that isn't in `[omamobile]` at the same moment, so a bundle install and `omarchy update` meet at the same versions. The first release is `2026.MM.DD`, labelled "developer preview", for the Pixel 7 Pro only (§12.12). @@ -482,7 +482,7 @@ Per release, in order. Stop at any failed step. `tools/release` runs the checkli 2. **Publish and tag** [`kernel`]: `tools/publish-kernel --dry-run --tag kernel- `, read what it would push, then run it without `--dry-run`. If it stops because `omamobile` moved, rebase, test what changed, and repeat. The stage checks that the annotated tag is on GitHub's `omamobile` and that the release worktree (`$KERNEL_BASE/wt-release`) is exactly that commit and clean. 3. **Build** [`build`] the kernel from the tag in the pinned container with the pinned clang (the stage checks `toolchain.txt`), release `LOCALVERSION` (`bin/omamobile kernel --release`), into the fixed `$KERNEL_BASE/out-kernel-release` (byte-identical builds need the same paths; the stage refuses that directory when it holds anything but a release build); stage `linux-omamobile` from it (`packages/linux-omamobile/stage`, §4). 4. **Images** [`images`] for every device: `DEVICE= bin/omamobile initramfs --release`, then `DEVICE= bin/omamobile images`, twice, checksums equal; then the device package's boot files (§5), for a device package whose `install` ships them (`OMAMOBILE_BOOT_FILES`): kept when `tools/stage-boot-files --check` finds them current, since the device package in `out/repo` was built from them, and then the boot images are built from their initramfs, so the bundle boots the bytes every phone's hook writes later; when they are stale, staged again only for a new device-package version (the stage asks for the bump when `out/repo` already has the current one), then `tools/build-packages packages/`. -5. **Packages** [`packages`]: every changed package has a bumped `version`, its `test/all` passes, `tools/build-packages` builds and signs them and the database on the laptop (`tools/repo-build` on a phone only as an opt-in shortcut). The stage checks that `out/repo` is signed by the release key, holds every package the image installs at this checkout's version, and that development publishes exactly it (`tools/repo-publish --no-build development`); it pins that index. `linux-omamobile` and `omamobile-boot-update` are among the image's packages (decision 10); `tools/build-packages` builds `linux-omamobile` only when named (`tools/build-packages packages/linux-omamobile`), and the stage checks the device package carries the staged boot files' initramfs. Then [`rootfs`] the root image on the stable channel from the pinned index, carrying both, and [`bundle`] the signed bundle. +5. **Packages** [`packages`]: every changed package has a new version (counted by `tools/pkg-version`), its `test/all` passes, `tools/build-packages` builds and signs them and the database on the laptop (`tools/repo-build` on a phone only as an opt-in shortcut). The stage checks that `out/repo` is signed by the release key, holds every package the image installs at this checkout's version, and that development publishes exactly it (`tools/repo-publish --no-build development`); it pins that index. `linux-omamobile` and `omamobile-boot-update` are among the image's packages (decision 10); `tools/build-packages` builds `linux-omamobile` only when named (`tools/build-packages packages/linux-omamobile`), and the stage checks the device package carries the staged boot files' initramfs. Then [`rootfs`] the root image on the stable channel from the pinned index, carrying both, and [`bundle`] the signed bundle. 6. **Test install** [`test-install`] on each released device, attended (this gates the release, §12.10): the signed bundle's `install` on a phone whose stock slot A and backups are known good; first boot, device package installed, `omarchy update` clean (the installed phone follows stable, and `promote` comes after this step: the stage first asks the server whether stable has an index, and with none, which can only be before the first release to a server, prints the one-time promotion of the pinned index and stops; later releases find the previous release there), then a package-hook kernel update and a reboot into it; on the Pixel 7 Pro with a SIM, after `tools/phone-provision` and the carrier settings, the modem stack comes up at boot on its own ([MODEM-PLAN](../device/cheetah/MODEM-PLAN.md) M4.6b) and the phone registers. The bundle is signed before this step, so the bytes tested are the bytes released; `test-install --passed ""` records it. 7. **Identifiers** [`identifiers`]: grep the bundle, the root image's file list, `MANIFEST` and the release notes for MAC addresses (`[0-9a-f]{2}(:[0-9a-f]{2}){5}`), serial numbers, SSIDs and account names; confirm no file from a factory image is in any artifact. The stage also reads the root image's `/etc`, `/root` and our own directories and the release initramfs; serials, SSIDs and account names come from a private list outside the repository (`~/.config/omamobile/release-identifiers`, one per line). `tools/release scan FILE...` checks any file the same way. 8. **Verify** [`verify`] the release's signature from a clean keyring: the bundle's `SHA256SUMS.sig` by the release key, every file against `SHA256SUMS`, and the root image against the SHA-256 the signed `MANIFEST` names (the bundle stage signed it; the root image needs no signature of its own, since the installer and `manifest.json` authorise it only through that signed record); upload [`upload`] them to `pkgs.omamobile.org/releases/` (§6) with `tools/release-upload --dry-run out/bundle/omamobile--`, then `tools/release-upload --full --latest out/bundle/omamobile--`, files before the index (`upload --done` reads them back with `--verify-only`); promote [`promote`] the release's packages to `stable`: `tools/repo-publish stable --expect-index ` promotes development's index and files unchanged, signatures included, and only if development's index is still the one the release was built and tested from. diff --git a/docs/REMOTE-TESTING.md b/docs/REMOTE-TESTING.md index 03153019a..dc4a32e67 100644 --- a/docs/REMOTE-TESTING.md +++ b/docs/REMOTE-TESTING.md @@ -14,7 +14,7 @@ It is opt-in. `omamobile-remote` and the patched `wlrctl` are in `packages/`, no On the phone, from the repository built by `tools/build-packages`: ``` -pacman -U wlrctl-0.2.2-1-aarch64.pkg.tar.* omamobile-remote-0.1.2-1-any.pkg.tar.* +pacman -U wlrctl-0.2.2-1-aarch64.pkg.tar.* omamobile-remote-*-any.pkg.tar.* ``` From your computer, an ssh key to the phone's user (USB networking is the easy way: `ssh user@172.16.42.1` on the images that have it). Every command below is run as that user: From cee48bfab4820421679320a86d310e12f1aed497 Mon Sep 17 00:00:00 2001 From: saiththerobo Date: Thu, 12 Nov 2026 08:55:40 +0000 Subject: [PATCH 04/19] tools/pkg-version: refuse a version file that doesn't parse The history skips a commit whose version file doesn't parse, so a HEAD with "0.2-beta" in it built under the number of the commit before: new contents under a published version, the collision the tool exists to end. The version path now checks the file at the commit it builds and refuses, as the branch path already did. tests/pkg-version covers it, and its --main case compares the output instead of piping it into grep -q (AGENTS, Userspace). Co-Authored-By: Claude Opus 5.5 --- tests/pkg-version | 9 ++++++++- tools/pkg-version | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/pkg-version b/tests/pkg-version index aa8268b78..56aa25a55 100755 --- a/tests/pkg-version +++ b/tests/pkg-version @@ -93,7 +93,7 @@ echo 0.4 > packages/demo/version; commit "demo 0.4 on a branch" v=$(pv demo) [[ $v =~ ^0\.4\.0pre3\.g[0-9a-f]{7}$ ]] || fail "a new series on a branch: got $v" ok "a new series on a branch builds below main's first of it ($v)" -pv --main other demo | grep -qx 0.4.0 || fail "--main names the line to count on" +[[ $(pv --main other demo) == 0.4.0 ]] || fail "--main names the line to count on" ok "--main names the line to count on" git checkout -q main @@ -112,6 +112,13 @@ rm -rf "$t/copy2" && mkdir "$t/copy2" is "$(cat "$t/copy2/demo/.pkgver")" 0.3.4 "a stale .pkgver in the directory loses to the fresh one" rm packages/demo/.pkgver +# A version file that doesn't parse is refused, not built under the +# number before it. +git checkout -q -b badfile; echo 0.3-beta > packages/demo/version; commit "demo: a bad version file" +pv --main badfile demo >/dev/null && fail "a version file that doesn't parse is refused" +ok "a version file that doesn't parse is refused" +git checkout -q main + # Without the history: refuse, never guess. git clone -q --depth 1 "file://$r" "$t/shallow" (cd "$t/shallow" && tools/pkg-version demo) >/dev/null 2>&1 && fail "a shallow clone is refused" diff --git a/tools/pkg-version b/tools/pkg-version index 18ade63ce..08c55c2c0 100755 --- a/tools/pkg-version +++ b/tools/pkg-version @@ -138,6 +138,9 @@ case $mode in esac [[ -n $(git ls-tree "$rev" -- "$path/version") ]] || die "$path/version doesn't exist at $rev" +# The history skips a version file that doesn't parse, so without this its +# commit would build under the number before it +parse "$(file_at "$rev")" >/dev/null || die "$path/version doesn't hold a version (0.2 or 0.2.5) at $rev" if git merge-base --is-ancestor "$rev" "$main"; then v=$(walk "$rev" | tail -1 | cut -d' ' -f2) [[ -n $v ]] || die "$path/version doesn't hold a version (0.2 or 0.2.5) at $rev" From 622689608388fbfd6ffa87dc2acd0049f6da6fd2 Mon Sep 17 00:00:00 2001 From: saiththerobo Date: Thu, 12 Nov 2026 08:55:40 +0000 Subject: [PATCH 05/19] build-packages: a package without a version is skipped, not the run A version tools/pkg-version can't work out (a version file that doesn't parse) stopped the whole build through pkg_tar's alarm_die, and with it the nightly publish for every phone (review lesson L-420). It is now checked with the boot files before anything is built: that package is skipped and named, the rest is built and signed, and the run exits 3 with the package in .skipped, which repo-publish already treats as "publish the rest, then fail". The messages name both reasons. tests/stage-boot-files adds such a package to its skip run. Co-Authored-By: Claude Opus 5.5 --- tests/stage-boot-files | 10 ++++++++-- tools/build-packages | 20 ++++++++++++++------ tools/repo-publish | 5 +++-- 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/tests/stage-boot-files b/tests/stage-boot-files index 165ea9f53..d1bbba31f 100755 --- a/tests/stage-boot-files +++ b/tests/stage-boot-files @@ -72,6 +72,10 @@ A printf 'pkgname=%s\npkgver=$(cat "${startdir:-.}/version")\npkgrel=1\narch=(any)\n' "$p" > "$R/packages/$p/PKGBUILD" done printf '#!/bin/bash\nboot=${OMAMOBILE_BOOT_FILES:-boot-files}\n' > "$R/packages/omamobile-device-testdev/install" + # A package whose version tools/pkg-version can't work out (a version file + # that holds none): skipped like stale boot files, not the whole run + mkdir -p "$R/packages/nover" && echo none > "$R/packages/nover/version" + printf 'pkgname=nover\npkgver=$(cat "${startdir:-.}/.pkgver" 2>/dev/null || "${startdir:-.}/../../tools/pkg-version" "${startdir:-.}")\npkgrel=1\narch=(any)\n' > "$R/packages/nover/PKGBUILD" # The container: makepkg's result, a package with its .PKGINFO cat > "$t/bin/docker" <<'D' #!/bin/bash @@ -95,14 +99,16 @@ D ( cd "$R" && git init -q && git add -A ) rc=0 (cd "$R" && PATH=$t/bin:$PATH TMPDIR=$t/tmp ALARM_TEST_CACHE=$t/cache BUILT_LOG=$t/built tools/build-packages --nocheck --local testdev \ - packages/plain packages/omamobile-device-testdev) > "$t/bp.log" 2>&1 || rc=$? + packages/plain packages/omamobile-device-testdev packages/nover) > "$t/bp.log" 2>&1 || rc=$? gpgconf --homedir "$kd/gnupg" --kill gpg-agent 2>/dev/null || true [[ $rc == 3 ]] || { cat "$t/bp.log"; fail "build-packages exits 3 when a device package's boot files are missing (got $rc)"; } [[ $(cat "$t/built") == plain ]] || { cat "$t/bp.log"; fail "the other package is built, the device package is not"; } [[ -f $R/out/testdev/repo/aarch64/plain-1-1-any.pkg.tar.zst.sig ]] || { cat "$t/bp.log"; fail "and the other package is signed into the repository"; } grep -c 'SKIPPED: omamobile-device-testdev' "$t/bp.log" >/dev/null && grep -c 'not built, boot files missing or stale: omamobile-device-testdev' "$t/bp.log" >/dev/null \ || { cat "$t/bp.log"; fail "the skip is named, before the build and at the end"; } - [[ $(cat "$R/out/testdev/repo/.skipped") == omamobile-device-testdev ]] || fail "the skip list is in repo/.skipped" + grep -c 'SKIPPED: nover: no version' "$t/bp.log" >/dev/null && grep -c 'not built, no version: nover' "$t/bp.log" >/dev/null \ + || { cat "$t/bp.log"; fail "a package with no version is skipped and named, the rest built"; } + [[ $(cat "$R/out/testdev/repo/.skipped") == $'omamobile-device-testdev\nnover' ]] || fail "the skip list is in repo/.skipped" # Exit 3 from anything else is 1: a repo-add that returns 3 printf '#!/bin/bash\nexit 3\n' > "$t/bin/repo-add" rm -rf "$R/out/testdev/repo/aarch64"/* diff --git a/tools/build-packages b/tools/build-packages index b2feb8c06..7e49cc088 100755 --- a/tools/build-packages +++ b/tools/build-packages @@ -68,7 +68,7 @@ SLOW=(mesa hyprland libcamera) # Packed from a staged kernel build: built only when named (see above) NAMED_ONLY=(linux-omamobile) repo=out/repo/aarch64 -# Exit 3 means exactly "built and signed everything but the skipped device +# Exit 3 means exactly "built and signed everything but the skipped # packages", which /../.skipped then lists: any other exit with 3 (a # gpg, tar or repo-add that happened to return it) becomes 1. Set before # anything can fail; the old list goes once the repository is known @@ -284,10 +284,15 @@ done # Staged inputs, checked before anything is built: a release kernel from a # published tag (named only, so a refusal stops the run), and boot files # that match this tree (a refusal skips that package and fails the run at -# the end) -skipped=() kept=() +# the end), and a version tools/pkg-version can work out (the same) +skipped=() noversion=() kept=() for d in "${build[@]}"; do name=$(basename "$d") + if [[ $(pkg_version "$d") == -* ]]; then + echo "SKIPPED: $name: no version (run tools/pkg-version $d for why); building the rest" >&2 + noversion+=("$name") + continue + fi if [[ " ${NAMED_ONLY[*]} " == *" $name "* ]]; then "$d/stage" --verify "$d/prebuilt" || alarm_die "$name: the staged kernel is not a published release; nothing built" fi @@ -455,9 +460,12 @@ sign_and_index ls -1 "$repo" | grep -E '\.pkg\.tar\.zst$' # Exit 3: everything else is built and signed (tools/repo-publish publishes # it, then fails too); any other failure exits 1 earlier -if ((${#skipped[@]})); then - printf '\e[31merror:\e[0m %s\n' "not built, boot files missing or stale: ${skipped[*]} (the rest is built and signed; stage them with tools/stage-boot-files)" >&2 +if ((${#skipped[@]} + ${#noversion[@]})); then + ((${#skipped[@]} == 0)) || + printf '\e[31merror:\e[0m %s\n' "not built, boot files missing or stale: ${skipped[*]} (the rest is built and signed; stage them with tools/stage-boot-files)" >&2 + ((${#noversion[@]} == 0)) || + printf '\e[31merror:\e[0m %s\n' "not built, no version: ${noversion[*]} (the rest is built and signed; tools/pkg-version says why)" >&2 mkdir -p "$(dirname "$skipfile")" - printf '%s\n' "${skipped[@]}" > "$skipfile" + printf '%s\n' "${skipped[@]}" "${noversion[@]}" | sed '/^$/d' > "$skipfile" exit 3 fi diff --git a/tools/repo-publish b/tools/repo-publish index 89b3646bf..b0f961908 100755 --- a/tools/repo-publish +++ b/tools/repo-publish @@ -281,7 +281,8 @@ upload() { if [[ $channel == development ]]; then if ((build)); then say "Building what changed" - # 3: a device package was skipped (its boot files are missing or stale) + # 3: a package was skipped (a device package's boot files are missing + # or stale, or tools/pkg-version gave no version) # and everything else built: publish that, then fail the run rc=0; tools/build-packages --all || rc=$? # 3 with its list in out/repo/.skipped, and nothing else, is a skip @@ -330,4 +331,4 @@ else [[ $code == 200 ]] || die "$URL/$channel/$ARCH/omamobile.db answers $code" fi say "Done: $URL/$channel/$ARCH" -((skipped_build == 0)) || die "published without the device package(s) tools/build-packages skipped (boot files missing or stale): stage them and publish again" +((skipped_build == 0)) || die "published without the package(s) tools/build-packages skipped (boot files missing or stale, or no version): see its error lines, then publish again" From f912cd269d252d44c730549ee5729f8018dba03e Mon Sep 17 00:00:00 2001 From: saiththerobo Date: Thu, 12 Nov 2026 08:55:40 +0000 Subject: [PATCH 06/19] packages: the version file a package installs holds its own version 23 packages install their version file under /usr/share/omamobile, and runbooks read it on the phone (SUSPEND-PLAN cats device-cheetah's and the shell's); with versions counted, the file only gives the series and a stale third number. Each PKGBUILD now hands pkgver to install as OMAMOBILE_PKGVER, and install writes it over the copy (without it, as in the package tests, the file is copied as before). omamobile-remote takes its printed version the same way instead of a second argument. omamobile-voice's test compared pkgver with tools/pkg-version, which a build tool's copy doesn't have (makepkg's check() on the phone or in the container); it reads .pkgver there. Every package's test/all in a copy without the repository now gives the same results as main's. tests/pkg-version checks that every package shipping the file hands pkgver over, and runs the installs that need no build (10 of 23). Co-Authored-By: Claude Opus 5.5 --- packages/omamobile-boot-update/PKGBUILD | 2 +- packages/omamobile-boot-update/install | 3 +++ packages/omamobile-device-akita/PKGBUILD | 2 +- packages/omamobile-device-akita/install | 3 +++ packages/omamobile-device-cheetah/PKGBUILD | 2 +- packages/omamobile-device-cheetah/install | 3 +++ packages/omamobile-device-felix/PKGBUILD | 2 +- packages/omamobile-device-felix/install | 3 +++ packages/omamobile-device-husky/PKGBUILD | 2 +- packages/omamobile-device-husky/install | 3 +++ packages/omamobile-device-lynx/PKGBUILD | 2 +- packages/omamobile-device-lynx/install | 3 +++ packages/omamobile-device-oriole/PKGBUILD | 2 +- packages/omamobile-device-oriole/install | 3 +++ packages/omamobile-device-panther/PKGBUILD | 2 +- packages/omamobile-device-panther/install | 3 +++ packages/omamobile-device-raven/PKGBUILD | 2 +- packages/omamobile-device-raven/install | 3 +++ packages/omamobile-device-tegu/PKGBUILD | 2 +- packages/omamobile-device-tegu/install | 3 +++ packages/omamobile-fingerprint/PKGBUILD | 2 +- packages/omamobile-fingerprint/install | 3 +++ packages/omamobile-firstboot/PKGBUILD | 2 +- packages/omamobile-firstboot/install | 3 +++ packages/omamobile-gnss/PKGBUILD | 2 +- packages/omamobile-gnss/install | 3 +++ packages/omamobile-mirror/PKGBUILD | 2 +- packages/omamobile-mirror/install | 3 +++ packages/omamobile-mmd/PKGBUILD | 2 +- packages/omamobile-mmd/install | 3 +++ packages/omamobile-modem-sit/PKGBUILD | 2 +- packages/omamobile-modem-sit/install | 3 +++ packages/omamobile-modem/PKGBUILD | 2 +- packages/omamobile-modem/install | 3 +++ packages/omamobile-omarchy/PKGBUILD | 2 +- packages/omamobile-omarchy/install | 3 +++ packages/omamobile-owl-widgets/PKGBUILD | 2 +- packages/omamobile-owl-widgets/install | 3 +++ packages/omamobile-remote/PKGBUILD | 2 +- packages/omamobile-remote/install | 8 +++---- packages/omamobile-remote/test/all | 2 +- packages/omamobile-shell/PKGBUILD | 2 +- packages/omamobile-shell/install | 3 +++ packages/omamobile-speaker-tuning/PKGBUILD | 2 +- packages/omamobile-speaker-tuning/install | 3 +++ packages/omamobile-telephony-tegu/PKGBUILD | 2 +- packages/omamobile-telephony-tegu/install | 3 +++ packages/omamobile-voice/test/all | 7 ++++-- packages/omamobile-waydroid/PKGBUILD | 2 +- packages/omamobile-waydroid/install | 3 +++ tests/pkg-version | 27 +++++++++++++++++++++- 51 files changed, 129 insertions(+), 32 deletions(-) diff --git a/packages/omamobile-boot-update/PKGBUILD b/packages/omamobile-boot-update/PKGBUILD index 8ea50ee12..5c9899c6b 100644 --- a/packages/omamobile-boot-update/PKGBUILD +++ b/packages/omamobile-boot-update/PKGBUILD @@ -16,5 +16,5 @@ check() { } package() { - "$startdir/install" "$pkgdir" + OMAMOBILE_PKGVER=$pkgver "$startdir/install" "$pkgdir" } diff --git a/packages/omamobile-boot-update/install b/packages/omamobile-boot-update/install index a6d090061..5a3d574fd 100755 --- a/packages/omamobile-boot-update/install +++ b/packages/omamobile-boot-update/install @@ -21,3 +21,6 @@ install -Dm644 avb/testkey_rsa4096.pem "$d/usr/share/omamobile-boot-update/avb/t install -Dm644 avb/SOURCE "$d/usr/share/omamobile-boot-update/avb/SOURCE" install -Dm644 avb/LICENSE "$d/usr/share/licenses/omamobile-boot-update/LICENSE.avb" install -Dm644 version "$d/usr/share/omamobile/boot-update/version" +# The package's own version (tools/pkg-version), which the file's +# series doesn't give +[[ -z ${OMAMOBILE_PKGVER:-} ]] || echo "$OMAMOBILE_PKGVER" > "$d/usr/share/omamobile/boot-update/version" diff --git a/packages/omamobile-device-akita/PKGBUILD b/packages/omamobile-device-akita/PKGBUILD index b4559400d..04ec1963b 100644 --- a/packages/omamobile-device-akita/PKGBUILD +++ b/packages/omamobile-device-akita/PKGBUILD @@ -23,5 +23,5 @@ check() { } package() { - "$startdir/install" "$pkgdir" "$srcdir/build" + OMAMOBILE_PKGVER=$pkgver "$startdir/install" "$pkgdir" "$srcdir/build" } diff --git a/packages/omamobile-device-akita/install b/packages/omamobile-device-akita/install index 17c516fdc..8bda3e319 100755 --- a/packages/omamobile-device-akita/install +++ b/packages/omamobile-device-akita/install @@ -25,3 +25,6 @@ install -Dm644 etc/omamobile-mirrorlist \ "$destination/etc/pacman.d/omamobile-mirrorlist" install -Dm644 LICENSE "$destination/usr/share/licenses/omamobile-device-akita/LICENSE" install -Dm644 version "$destination/usr/share/omamobile/device-akita/version" +# The package's own version (tools/pkg-version), which the file's +# series doesn't give +[[ -z ${OMAMOBILE_PKGVER:-} ]] || echo "$OMAMOBILE_PKGVER" > "$destination/usr/share/omamobile/device-akita/version" diff --git a/packages/omamobile-device-cheetah/PKGBUILD b/packages/omamobile-device-cheetah/PKGBUILD index fdd7df522..642ebd576 100644 --- a/packages/omamobile-device-cheetah/PKGBUILD +++ b/packages/omamobile-device-cheetah/PKGBUILD @@ -24,5 +24,5 @@ check() { } package() { - "$startdir/install" "$pkgdir" "$srcdir/build" + OMAMOBILE_PKGVER=$pkgver "$startdir/install" "$pkgdir" "$srcdir/build" } diff --git a/packages/omamobile-device-cheetah/install b/packages/omamobile-device-cheetah/install index dd17e0143..f242175c1 100755 --- a/packages/omamobile-device-cheetah/install +++ b/packages/omamobile-device-cheetah/install @@ -22,6 +22,9 @@ install -Dm644 etc/omamobile-mirrorlist "$destination/etc/pacman.d/omamobile-mir install -Dm644 LICENSE "$destination/usr/share/licenses/omamobile-device-cheetah/LICENSE" install -Dm644 LICENSE.Apache-2.0 "$destination/usr/share/licenses/omamobile-device-cheetah/LICENSE.Apache-2.0" install -Dm644 version "$destination/usr/share/omamobile/device-cheetah/version" +# The package's own version (tools/pkg-version), which the file's +# series doesn't give +[[ -z ${OMAMOBILE_PKGVER:-} ]] || echo "$OMAMOBILE_PKGVER" > "$destination/usr/share/omamobile/device-cheetah/version" # The boot files omamobile-boot-update builds slot B's images from # (docs/RELEASES.md §5.1): the descriptor, the board dtbo, the compiled DTB diff --git a/packages/omamobile-device-felix/PKGBUILD b/packages/omamobile-device-felix/PKGBUILD index 34441b4ac..9c53110e4 100644 --- a/packages/omamobile-device-felix/PKGBUILD +++ b/packages/omamobile-device-felix/PKGBUILD @@ -23,5 +23,5 @@ check() { } package() { - "$startdir/install" "$pkgdir" "$srcdir/build" + OMAMOBILE_PKGVER=$pkgver "$startdir/install" "$pkgdir" "$srcdir/build" } diff --git a/packages/omamobile-device-felix/install b/packages/omamobile-device-felix/install index 4c8428eaa..07760a049 100755 --- a/packages/omamobile-device-felix/install +++ b/packages/omamobile-device-felix/install @@ -27,3 +27,6 @@ install -Dm644 etc/omamobile-mirrorlist \ "$destination/etc/pacman.d/omamobile-mirrorlist" install -Dm644 LICENSE "$destination/usr/share/licenses/omamobile-device-felix/LICENSE" install -Dm644 version "$destination/usr/share/omamobile/device-felix/version" +# The package's own version (tools/pkg-version), which the file's +# series doesn't give +[[ -z ${OMAMOBILE_PKGVER:-} ]] || echo "$OMAMOBILE_PKGVER" > "$destination/usr/share/omamobile/device-felix/version" diff --git a/packages/omamobile-device-husky/PKGBUILD b/packages/omamobile-device-husky/PKGBUILD index 5ac9b30c4..0c2e9eaa3 100644 --- a/packages/omamobile-device-husky/PKGBUILD +++ b/packages/omamobile-device-husky/PKGBUILD @@ -23,5 +23,5 @@ check() { } package() { - "$startdir/install" "$pkgdir" "$srcdir/build" + OMAMOBILE_PKGVER=$pkgver "$startdir/install" "$pkgdir" "$srcdir/build" } diff --git a/packages/omamobile-device-husky/install b/packages/omamobile-device-husky/install index 8c258e53f..26e30c0a5 100755 --- a/packages/omamobile-device-husky/install +++ b/packages/omamobile-device-husky/install @@ -54,3 +54,6 @@ install -Dm644 etc/omamobile-mirrorlist \ "$destination/etc/pacman.d/omamobile-mirrorlist" install -Dm644 LICENSE "$destination/usr/share/licenses/omamobile-device-husky/LICENSE" install -Dm644 version "$destination/usr/share/omamobile/device-husky/version" +# The package's own version (tools/pkg-version), which the file's +# series doesn't give +[[ -z ${OMAMOBILE_PKGVER:-} ]] || echo "$OMAMOBILE_PKGVER" > "$destination/usr/share/omamobile/device-husky/version" diff --git a/packages/omamobile-device-lynx/PKGBUILD b/packages/omamobile-device-lynx/PKGBUILD index 4f42139f3..ebb353042 100644 --- a/packages/omamobile-device-lynx/PKGBUILD +++ b/packages/omamobile-device-lynx/PKGBUILD @@ -23,5 +23,5 @@ check() { } package() { - "$startdir/install" "$pkgdir" "$srcdir/build" + OMAMOBILE_PKGVER=$pkgver "$startdir/install" "$pkgdir" "$srcdir/build" } diff --git a/packages/omamobile-device-lynx/install b/packages/omamobile-device-lynx/install index 1f63549dc..2d909a9f7 100755 --- a/packages/omamobile-device-lynx/install +++ b/packages/omamobile-device-lynx/install @@ -33,3 +33,6 @@ install -Dm644 etc/omamobile-mirrorlist \ install -Dm644 LICENSE "$destination/usr/share/licenses/omamobile-device-lynx/LICENSE" install -Dm644 LICENSE.Apache-2.0 "$destination/usr/share/licenses/omamobile-device-lynx/LICENSE.Apache-2.0" install -Dm644 version "$destination/usr/share/omamobile/device-lynx/version" +# The package's own version (tools/pkg-version), which the file's +# series doesn't give +[[ -z ${OMAMOBILE_PKGVER:-} ]] || echo "$OMAMOBILE_PKGVER" > "$destination/usr/share/omamobile/device-lynx/version" diff --git a/packages/omamobile-device-oriole/PKGBUILD b/packages/omamobile-device-oriole/PKGBUILD index 11af2410c..736490f4f 100644 --- a/packages/omamobile-device-oriole/PKGBUILD +++ b/packages/omamobile-device-oriole/PKGBUILD @@ -16,4 +16,4 @@ backup=(etc/UPower/UPower.conf.d/20-omamobile-critical-power.conf etc/pacman.d/o build() { "$startdir/build" "$srcdir/build"; } check() { "$startdir/test/all"; } -package() { "$startdir/install" "$pkgdir" "$srcdir/build"; } +package() { OMAMOBILE_PKGVER=$pkgver "$startdir/install" "$pkgdir" "$srcdir/build"; } diff --git a/packages/omamobile-device-oriole/install b/packages/omamobile-device-oriole/install index 4cf89033f..59d6ddb17 100755 --- a/packages/omamobile-device-oriole/install +++ b/packages/omamobile-device-oriole/install @@ -23,3 +23,6 @@ for file in LICENSE; do install -Dm644 "$file" "$destination/usr/share/licenses/omamobile-device-oriole/$file" done install -Dm644 version "$destination/usr/share/omamobile/device-oriole/version" +# The package's own version (tools/pkg-version), which the file's +# series doesn't give +[[ -z ${OMAMOBILE_PKGVER:-} ]] || echo "$OMAMOBILE_PKGVER" > "$destination/usr/share/omamobile/device-oriole/version" diff --git a/packages/omamobile-device-panther/PKGBUILD b/packages/omamobile-device-panther/PKGBUILD index a934de44c..57a0141ae 100644 --- a/packages/omamobile-device-panther/PKGBUILD +++ b/packages/omamobile-device-panther/PKGBUILD @@ -23,5 +23,5 @@ check() { } package() { - "$startdir/install" "$pkgdir" "$srcdir/build" + OMAMOBILE_PKGVER=$pkgver "$startdir/install" "$pkgdir" "$srcdir/build" } diff --git a/packages/omamobile-device-panther/install b/packages/omamobile-device-panther/install index fa535d334..381cc8f5d 100755 --- a/packages/omamobile-device-panther/install +++ b/packages/omamobile-device-panther/install @@ -67,3 +67,6 @@ install -Dm644 etc/omamobile-mirrorlist \ "$destination/etc/pacman.d/omamobile-mirrorlist" install -Dm644 LICENSE "$destination/usr/share/licenses/omamobile-device-panther/LICENSE" install -Dm644 version "$destination/usr/share/omamobile/device-panther/version" +# The package's own version (tools/pkg-version), which the file's +# series doesn't give +[[ -z ${OMAMOBILE_PKGVER:-} ]] || echo "$OMAMOBILE_PKGVER" > "$destination/usr/share/omamobile/device-panther/version" diff --git a/packages/omamobile-device-raven/PKGBUILD b/packages/omamobile-device-raven/PKGBUILD index 3f6b38b2d..a2ff65646 100644 --- a/packages/omamobile-device-raven/PKGBUILD +++ b/packages/omamobile-device-raven/PKGBUILD @@ -20,5 +20,5 @@ build() { } package() { - "$startdir/install" "$pkgdir" "$srcdir/build" + OMAMOBILE_PKGVER=$pkgver "$startdir/install" "$pkgdir" "$srcdir/build" } diff --git a/packages/omamobile-device-raven/install b/packages/omamobile-device-raven/install index f32025f73..1b6db9489 100755 --- a/packages/omamobile-device-raven/install +++ b/packages/omamobile-device-raven/install @@ -21,3 +21,6 @@ install -Dm644 etc/omamobile-mirrorlist "$destination/etc/pacman.d/omamobile-mir install -Dm644 LICENSE "$destination/usr/share/licenses/omamobile-device-raven/LICENSE" install -Dm644 LICENSE.Apache-2.0 "$destination/usr/share/licenses/omamobile-device-raven/LICENSE.Apache-2.0" install -Dm644 version "$destination/usr/share/omamobile/device-raven/version" +# The package's own version (tools/pkg-version), which the file's +# series doesn't give +[[ -z ${OMAMOBILE_PKGVER:-} ]] || echo "$OMAMOBILE_PKGVER" > "$destination/usr/share/omamobile/device-raven/version" diff --git a/packages/omamobile-device-tegu/PKGBUILD b/packages/omamobile-device-tegu/PKGBUILD index 9f563fda1..487b1519d 100644 --- a/packages/omamobile-device-tegu/PKGBUILD +++ b/packages/omamobile-device-tegu/PKGBUILD @@ -25,5 +25,5 @@ check() { } package() { - "$startdir/install" "$pkgdir" "$srcdir/build" + OMAMOBILE_PKGVER=$pkgver "$startdir/install" "$pkgdir" "$srcdir/build" } diff --git a/packages/omamobile-device-tegu/install b/packages/omamobile-device-tegu/install index 049fa4c1d..534a139b7 100755 --- a/packages/omamobile-device-tegu/install +++ b/packages/omamobile-device-tegu/install @@ -27,3 +27,6 @@ install -Dm644 device.conf "$destination/usr/share/omamobile/device.conf" install -Dm644 etc/omamobile-mirrorlist "$destination/etc/pacman.d/omamobile-mirrorlist" install -Dm644 LICENSE "$destination/usr/share/licenses/omamobile-device-tegu/LICENSE" install -Dm644 version "$destination/usr/share/omamobile/device-tegu/version" +# The package's own version (tools/pkg-version), which the file's +# series doesn't give +[[ -z ${OMAMOBILE_PKGVER:-} ]] || echo "$OMAMOBILE_PKGVER" > "$destination/usr/share/omamobile/device-tegu/version" diff --git a/packages/omamobile-fingerprint/PKGBUILD b/packages/omamobile-fingerprint/PKGBUILD index e13c8d8be..c1c06b1d8 100644 --- a/packages/omamobile-fingerprint/PKGBUILD +++ b/packages/omamobile-fingerprint/PKGBUILD @@ -18,5 +18,5 @@ check() { } package() { - "$startdir/install" "$pkgdir" + OMAMOBILE_PKGVER=$pkgver "$startdir/install" "$pkgdir" } diff --git a/packages/omamobile-fingerprint/install b/packages/omamobile-fingerprint/install index 58c8aec76..3f54d962a 100755 --- a/packages/omamobile-fingerprint/install +++ b/packages/omamobile-fingerprint/install @@ -34,3 +34,6 @@ install -Dm755 vendor/systemd/system-sleep/omamobile-fprintd-resume "$d/usr/lib/ install -Dm644 vendor/modprobe.d/omamobile-fingerprint-lhbm.conf "$d/usr/lib/modprobe.d/omamobile-fingerprint-lhbm.conf" install -Dm644 LICENSE "$d/usr/share/licenses/omamobile-fingerprint/LICENSE" install -Dm644 version "$d/usr/share/omamobile/fingerprint/version" +# The package's own version (tools/pkg-version), which the file's +# series doesn't give +[[ -z ${OMAMOBILE_PKGVER:-} ]] || echo "$OMAMOBILE_PKGVER" > "$d/usr/share/omamobile/fingerprint/version" diff --git a/packages/omamobile-firstboot/PKGBUILD b/packages/omamobile-firstboot/PKGBUILD index 285c241bd..b41dba4fb 100644 --- a/packages/omamobile-firstboot/PKGBUILD +++ b/packages/omamobile-firstboot/PKGBUILD @@ -17,5 +17,5 @@ check() { } package() { - "$startdir/install" "$pkgdir" + OMAMOBILE_PKGVER=$pkgver "$startdir/install" "$pkgdir" } diff --git a/packages/omamobile-firstboot/install b/packages/omamobile-firstboot/install index 8ceaf7fdc..155cac898 100755 --- a/packages/omamobile-firstboot/install +++ b/packages/omamobile-firstboot/install @@ -14,3 +14,6 @@ ln -sfn ../omamobile-firstboot.service "$d/usr/lib/systemd/system/multi-user.tar install -Dm644 ssh/10-omamobile.conf "$d/etc/ssh/sshd_config.d/10-omamobile.conf" install -Dm644 LICENSE "$d/usr/share/licenses/omamobile-firstboot/LICENSE" install -Dm644 version "$d/usr/share/omamobile/firstboot/version" +# The package's own version (tools/pkg-version), which the file's +# series doesn't give +[[ -z ${OMAMOBILE_PKGVER:-} ]] || echo "$OMAMOBILE_PKGVER" > "$d/usr/share/omamobile/firstboot/version" diff --git a/packages/omamobile-gnss/PKGBUILD b/packages/omamobile-gnss/PKGBUILD index 88cbce8b4..2987364ac 100644 --- a/packages/omamobile-gnss/PKGBUILD +++ b/packages/omamobile-gnss/PKGBUILD @@ -17,5 +17,5 @@ check() { } package() { - "$startdir/install" "$pkgdir" + OMAMOBILE_PKGVER=$pkgver "$startdir/install" "$pkgdir" } diff --git a/packages/omamobile-gnss/install b/packages/omamobile-gnss/install index 96b042414..bef8da550 100755 --- a/packages/omamobile-gnss/install +++ b/packages/omamobile-gnss/install @@ -38,3 +38,6 @@ install -Dm644 etc/geoclue/conf.d/90-omamobile-gnss.conf "$d/etc/geoclue/conf.d/ install -Dm644 etc/omamobile/gnss.conf "$d/etc/omamobile/gnss.conf" install -Dm644 LICENSE "$d/usr/share/licenses/omamobile-gnss/LICENSE" install -Dm644 version "$d/usr/share/omamobile/gnss/version" +# The package's own version (tools/pkg-version), which the file's +# series doesn't give +[[ -z ${OMAMOBILE_PKGVER:-} ]] || echo "$OMAMOBILE_PKGVER" > "$d/usr/share/omamobile/gnss/version" diff --git a/packages/omamobile-mirror/PKGBUILD b/packages/omamobile-mirror/PKGBUILD index 863931674..d2a1d6822 100644 --- a/packages/omamobile-mirror/PKGBUILD +++ b/packages/omamobile-mirror/PKGBUILD @@ -17,5 +17,5 @@ check() { } package() { - "$startdir/install" "$pkgdir" + OMAMOBILE_PKGVER=$pkgver "$startdir/install" "$pkgdir" } diff --git a/packages/omamobile-mirror/install b/packages/omamobile-mirror/install index e4b69682e..b1ccfba59 100755 --- a/packages/omamobile-mirror/install +++ b/packages/omamobile-mirror/install @@ -16,3 +16,6 @@ install -Dm644 share/mirror.conf.example "$d/usr/share/omamobile/mirror/mirror.c install -Dm644 README.md "$d/usr/share/doc/omamobile-mirror/README.md" install -Dm644 LICENSE "$d/usr/share/licenses/omamobile-mirror/LICENSE" install -Dm644 version "$d/usr/share/omamobile/mirror/version" +# The package's own version (tools/pkg-version), which the file's +# series doesn't give +[[ -z ${OMAMOBILE_PKGVER:-} ]] || echo "$OMAMOBILE_PKGVER" > "$d/usr/share/omamobile/mirror/version" diff --git a/packages/omamobile-mmd/PKGBUILD b/packages/omamobile-mmd/PKGBUILD index 180d3884b..998c1be14 100644 --- a/packages/omamobile-mmd/PKGBUILD +++ b/packages/omamobile-mmd/PKGBUILD @@ -21,5 +21,5 @@ check() { } package() { - "$startdir/install" "$pkgdir" + OMAMOBILE_PKGVER=$pkgver "$startdir/install" "$pkgdir" } diff --git a/packages/omamobile-mmd/install b/packages/omamobile-mmd/install index 1e622c944..0a11f0f14 100755 --- a/packages/omamobile-mmd/install +++ b/packages/omamobile-mmd/install @@ -13,3 +13,6 @@ install -Dm644 dbus/org.freedesktop.ModemManager1.conf "$d/usr/share/dbus-1/syst install -Dm644 polkit/org.freedesktop.ModemManager1.policy "$d/usr/share/polkit-1/actions/org.freedesktop.ModemManager1.policy" install -Dm644 LICENSE "$d/usr/share/licenses/omamobile-mmd/LICENSE" install -Dm644 version "$d/usr/share/omamobile/mmd/version" +# The package's own version (tools/pkg-version), which the file's +# series doesn't give +[[ -z ${OMAMOBILE_PKGVER:-} ]] || echo "$OMAMOBILE_PKGVER" > "$d/usr/share/omamobile/mmd/version" diff --git a/packages/omamobile-modem-sit/PKGBUILD b/packages/omamobile-modem-sit/PKGBUILD index f2ea587d4..7e14b2d48 100644 --- a/packages/omamobile-modem-sit/PKGBUILD +++ b/packages/omamobile-modem-sit/PKGBUILD @@ -20,5 +20,5 @@ check() { } package() { - "$startdir/install" "$pkgdir" + OMAMOBILE_PKGVER=$pkgver "$startdir/install" "$pkgdir" } diff --git a/packages/omamobile-modem-sit/install b/packages/omamobile-modem-sit/install index c0db4b484..aace83042 100755 --- a/packages/omamobile-modem-sit/install +++ b/packages/omamobile-modem-sit/install @@ -18,3 +18,6 @@ install -Dm644 networkmanager/90-omamobile-rmnet.conf "$d/usr/lib/NetworkManager install -Dm644 etc/omamobile/modem-sit.conf "$d/etc/omamobile/modem-sit.conf" install -Dm644 LICENSE "$d/usr/share/licenses/omamobile-modem-sit/LICENSE" install -Dm644 version "$d/usr/share/omamobile/modem-sit/version" +# The package's own version (tools/pkg-version), which the file's +# series doesn't give +[[ -z ${OMAMOBILE_PKGVER:-} ]] || echo "$OMAMOBILE_PKGVER" > "$d/usr/share/omamobile/modem-sit/version" diff --git a/packages/omamobile-modem/PKGBUILD b/packages/omamobile-modem/PKGBUILD index 73a6b5342..261353da4 100644 --- a/packages/omamobile-modem/PKGBUILD +++ b/packages/omamobile-modem/PKGBUILD @@ -15,5 +15,5 @@ check() { } package() { - "$startdir/install" "$pkgdir" + OMAMOBILE_PKGVER=$pkgver "$startdir/install" "$pkgdir" } diff --git a/packages/omamobile-modem/install b/packages/omamobile-modem/install index 047e54656..412fb6e95 100755 --- a/packages/omamobile-modem/install +++ b/packages/omamobile-modem/install @@ -32,3 +32,6 @@ install -Dm644 udev/61-omamobile-vendor-udisks-ignore.rules "$d/usr/lib/udev/rul install -Dm644 README.md "$d/usr/share/doc/omamobile-modem/README.md" install -Dm644 LICENSE "$d/usr/share/licenses/omamobile-modem/LICENSE" install -Dm644 version "$d/usr/share/omamobile/modem/version" +# The package's own version (tools/pkg-version), which the file's +# series doesn't give +[[ -z ${OMAMOBILE_PKGVER:-} ]] || echo "$OMAMOBILE_PKGVER" > "$d/usr/share/omamobile/modem/version" diff --git a/packages/omamobile-omarchy/PKGBUILD b/packages/omamobile-omarchy/PKGBUILD index 2c587d80b..8bd483807 100644 --- a/packages/omamobile-omarchy/PKGBUILD +++ b/packages/omamobile-omarchy/PKGBUILD @@ -17,5 +17,5 @@ check() { } package() { - "$startdir/install" "$pkgdir" + OMAMOBILE_PKGVER=$pkgver "$startdir/install" "$pkgdir" } diff --git a/packages/omamobile-omarchy/install b/packages/omamobile-omarchy/install index 783e2296f..136dc4aec 100755 --- a/packages/omamobile-omarchy/install +++ b/packages/omamobile-omarchy/install @@ -33,6 +33,9 @@ install -Dm644 libalpm/95-omamobile-omarchy-patches.hook "$d/usr/share/libalpm/h install -Dm644 LICENSE "$d/usr/share/licenses/omamobile-omarchy/LICENSE" install -Dm644 LICENSE.omarchy "$d/usr/share/licenses/omamobile-omarchy/omarchy-MIT" install -Dm644 version "$d/usr/share/omamobile/omarchy/version" +# The package's own version (tools/pkg-version), which the file's +# series doesn't give +[[ -z ${OMAMOBILE_PKGVER:-} ]] || echo "$OMAMOBILE_PKGVER" > "$d/usr/share/omamobile/omarchy/version" for f in legacy-4.0.6/*.patch; do install -Dm644 "$f" "$d/usr/share/omamobile/omarchy/legacy-4.0.6/${f##*/}" done diff --git a/packages/omamobile-owl-widgets/PKGBUILD b/packages/omamobile-owl-widgets/PKGBUILD index 0007e23a6..d0e20af10 100644 --- a/packages/omamobile-owl-widgets/PKGBUILD +++ b/packages/omamobile-owl-widgets/PKGBUILD @@ -24,5 +24,5 @@ check() { } package() { - "$startdir/install" "$pkgdir" "$srcdir/omarchy-widgets" + OMAMOBILE_PKGVER=$pkgver "$startdir/install" "$pkgdir" "$srcdir/omarchy-widgets" } diff --git a/packages/omamobile-owl-widgets/install b/packages/omamobile-owl-widgets/install index 77c975581..a86aebd53 100755 --- a/packages/omamobile-owl-widgets/install +++ b/packages/omamobile-owl-widgets/install @@ -33,3 +33,6 @@ install -Dm644 "$index" "$share/index.json" [[ -f $store/order.txt ]] && install -Dm644 "$store/order.txt" "$share/order.txt" install -Dm644 "$store/LICENSE" "$destination/usr/share/licenses/omamobile-owl-widgets/LICENSE" install -Dm644 "$here/version" "$share/version" +# The package's own version (tools/pkg-version), which the file's +# series doesn't give +[[ -z ${OMAMOBILE_PKGVER:-} ]] || echo "$OMAMOBILE_PKGVER" > "$share/version" diff --git a/packages/omamobile-remote/PKGBUILD b/packages/omamobile-remote/PKGBUILD index 98d8b6fc4..1292f40c4 100644 --- a/packages/omamobile-remote/PKGBUILD +++ b/packages/omamobile-remote/PKGBUILD @@ -15,5 +15,5 @@ check() { } package() { - "$startdir/install" "$pkgdir" "$pkgver" + OMAMOBILE_PKGVER=$pkgver "$startdir/install" "$pkgdir" } diff --git a/packages/omamobile-remote/install b/packages/omamobile-remote/install index 432f433a5..86bcbece4 100755 --- a/packages/omamobile-remote/install +++ b/packages/omamobile-remote/install @@ -1,8 +1,8 @@ #!/bin/bash # SPDX-License-Identifier: MIT -# Stage the package into DESTDIR (./install DESTDIR [VERSION], an absolute -# path; VERSION, the PKGBUILD's pkgver, is what `omamobile-remote version` -# prints). It +# Stage the package into DESTDIR (./install DESTDIR, an absolute path; +# OMAMOBILE_PKGVER, the PKGBUILD's pkgver, is what `omamobile-remote +# version` prints). It # installs scripts only: no unit, no udev rule, no group, no network listener. # Nothing here runs until somebody logs in over ssh and runs it. set -euo pipefail @@ -11,6 +11,6 @@ d=${1:?usage: install DESTDIR} cd "$(dirname "$(readlink -f "$0")")" install -Dm755 bin/omamobile-remote "$d/usr/bin/omamobile-remote" -sed -i "s/@VERSION@/${2:-unknown}/" "$d/usr/bin/omamobile-remote" +sed -i "s/@VERSION@/${OMAMOBILE_PKGVER:-unknown}/" "$d/usr/bin/omamobile-remote" install -Dm644 README.md "$d/usr/share/doc/omamobile-remote/README.md" install -Dm644 LICENSE "$d/usr/share/licenses/omamobile-remote/LICENSE" diff --git a/packages/omamobile-remote/test/all b/packages/omamobile-remote/test/all index 74c764057..7f97aa783 100755 --- a/packages/omamobile-remote/test/all +++ b/packages/omamobile-remote/test/all @@ -19,7 +19,7 @@ export OMAMOBILE_REMOTE_PROC=$tmp/noproc # --- the printed version is the package's: install puts pkgver in mkdir -p "$tmp/dest" -./install "$tmp/dest" 0.1.7.2.gabc1234 >/dev/null +OMAMOBILE_PKGVER=0.1.7.2.gabc1234 ./install "$tmp/dest" >/dev/null check "omamobile-remote version prints the version install was given" \ test "$("$tmp/dest/usr/bin/omamobile-remote" version)" = "omamobile-remote 0.1.7.2.gabc1234" diff --git a/packages/omamobile-shell/PKGBUILD b/packages/omamobile-shell/PKGBUILD index e670c8411..ddf800c18 100644 --- a/packages/omamobile-shell/PKGBUILD +++ b/packages/omamobile-shell/PKGBUILD @@ -26,7 +26,7 @@ backup=(etc/xdg/xdg-desktop-portal/hyprland-portals.conf) install=omamobile-shell.install package() { - "$startdir/install" "$pkgdir" + OMAMOBILE_PKGVER=$pkgver "$startdir/install" "$pkgdir" } check() { diff --git a/packages/omamobile-shell/install b/packages/omamobile-shell/install index f886a7c8d..a83482f36 100755 --- a/packages/omamobile-shell/install +++ b/packages/omamobile-shell/install @@ -74,3 +74,6 @@ install -Dm644 LICENSE "$destination/usr/share/licenses/omamobile-shell/LICENSE" # come from omamobile-owl-widgets, which ships the store's licence. install -Dm644 widgets/LICENSE-owl-guide "$destination/usr/share/licenses/omamobile-shell/LICENSE-owl-guide" install -Dm644 version "$destination/usr/share/omamobile/shell/version" +# The package's own version (tools/pkg-version), which the file's +# series doesn't give +[[ -z ${OMAMOBILE_PKGVER:-} ]] || echo "$OMAMOBILE_PKGVER" > "$destination/usr/share/omamobile/shell/version" diff --git a/packages/omamobile-speaker-tuning/PKGBUILD b/packages/omamobile-speaker-tuning/PKGBUILD index 399ac3f93..17a328a56 100644 --- a/packages/omamobile-speaker-tuning/PKGBUILD +++ b/packages/omamobile-speaker-tuning/PKGBUILD @@ -15,5 +15,5 @@ check() { } package() { - "$startdir/install" "$pkgdir" + OMAMOBILE_PKGVER=$pkgver "$startdir/install" "$pkgdir" } diff --git a/packages/omamobile-speaker-tuning/install b/packages/omamobile-speaker-tuning/install index 0c57a3eaf..0f8d5fc15 100755 --- a/packages/omamobile-speaker-tuning/install +++ b/packages/omamobile-speaker-tuning/install @@ -21,3 +21,6 @@ install -Dm644 systemd/omamobile-speaker-tuning.service "$d/usr/lib/systemd/syst install -Dm644 etc/omamobile/speaker-tuning.conf "$d/etc/omamobile/speaker-tuning.conf" install -Dm644 LICENSE "$d/usr/share/licenses/omamobile-speaker-tuning/LICENSE" install -Dm644 version "$d/usr/share/omamobile/speaker-tuning/version" +# The package's own version (tools/pkg-version), which the file's +# series doesn't give +[[ -z ${OMAMOBILE_PKGVER:-} ]] || echo "$OMAMOBILE_PKGVER" > "$d/usr/share/omamobile/speaker-tuning/version" diff --git a/packages/omamobile-telephony-tegu/PKGBUILD b/packages/omamobile-telephony-tegu/PKGBUILD index 7acede794..a0e8fe600 100644 --- a/packages/omamobile-telephony-tegu/PKGBUILD +++ b/packages/omamobile-telephony-tegu/PKGBUILD @@ -15,5 +15,5 @@ check() { } package() { - "$startdir/install" "$pkgdir" + OMAMOBILE_PKGVER=$pkgver "$startdir/install" "$pkgdir" } diff --git a/packages/omamobile-telephony-tegu/install b/packages/omamobile-telephony-tegu/install index df5c69d86..1d26b7544 100755 --- a/packages/omamobile-telephony-tegu/install +++ b/packages/omamobile-telephony-tegu/install @@ -10,3 +10,6 @@ install -Dm644 systemd/10-tegu-attach.conf "$d/usr/lib/systemd/system/omamobile- install -Dm644 README.md "$d/usr/share/doc/omamobile-telephony-tegu/README.md" install -Dm644 LICENSE "$d/usr/share/licenses/omamobile-telephony-tegu/LICENSE" install -Dm644 version "$d/usr/share/omamobile/telephony-tegu/version" +# The package's own version (tools/pkg-version), which the file's +# series doesn't give +[[ -z ${OMAMOBILE_PKGVER:-} ]] || echo "$OMAMOBILE_PKGVER" > "$d/usr/share/omamobile/telephony-tegu/version" diff --git a/packages/omamobile-voice/test/all b/packages/omamobile-voice/test/all index d0b4822c4..67e4dddfb 100755 --- a/packages/omamobile-voice/test/all +++ b/packages/omamobile-voice/test/all @@ -18,8 +18,11 @@ bash -n "$here/PKGBUILD" || fail "PKGBUILD parses" eval "$(startdir=$here bash -c 'source "$startdir/PKGBUILD" printf "pkgname=%q pkgver=%q commit=%q model=%q url0=%q sum0=%q\n" "$pkgname" "$pkgver" "$_commit" "$_model" "${source[0]}" "${sha256sums[0]}" printf "deps=%q\n" "${depends[*]:-}"')" -[[ $pkgname == omamobile-voice && $pkgver == "$("$repo/tools/pkg-version" "$here")" ]] || fail "name and version" -ok "PKGBUILD parses, version from tools/pkg-version" +# The version: a build tool's copy carries it as .pkgver (no git there), +# the repository works it out with tools/pkg-version +if [[ -f $here/.pkgver ]]; then want=$(cat "$here/.pkgver"); else want=$("$repo/tools/pkg-version" "$here"); fi +[[ $pkgname == omamobile-voice && -n $pkgver && $pkgver == "$want" ]] || fail "name and version" +ok "PKGBUILD parses, version from .pkgver or tools/pkg-version" [[ $commit =~ ^[0-9a-f]{40}$ ]] || fail "the source is pinned to a full commit, not a branch: $commit" [[ $url0 == "$model-$commit::https://huggingface.co/ggerganov/whisper.cpp/resolve/$commit/$model" ]] || fail "the model's URL names the pinned commit: $url0" diff --git a/packages/omamobile-waydroid/PKGBUILD b/packages/omamobile-waydroid/PKGBUILD index a83dd3541..175a98ec9 100644 --- a/packages/omamobile-waydroid/PKGBUILD +++ b/packages/omamobile-waydroid/PKGBUILD @@ -17,5 +17,5 @@ check() { } package() { - "$startdir/install" "$pkgdir" + OMAMOBILE_PKGVER=$pkgver "$startdir/install" "$pkgdir" } diff --git a/packages/omamobile-waydroid/install b/packages/omamobile-waydroid/install index f549dfc22..d40148578 100755 --- a/packages/omamobile-waydroid/install +++ b/packages/omamobile-waydroid/install @@ -20,3 +20,6 @@ install -Dm644 libalpm/90-omamobile-waydroid.hook "$d/usr/share/libalpm/hooks/90 install -Dm644 etc/omamobile/waydroid.conf "$d/etc/omamobile/waydroid.conf" install -Dm644 LICENSE "$d/usr/share/licenses/omamobile-waydroid/LICENSE" install -Dm644 version "$d/usr/share/omamobile/waydroid/version" +# The package's own version (tools/pkg-version), which the file's +# series doesn't give +[[ -z ${OMAMOBILE_PKGVER:-} ]] || echo "$OMAMOBILE_PKGVER" > "$d/usr/share/omamobile/waydroid/version" diff --git a/tests/pkg-version b/tests/pkg-version index 56aa25a55..4b14e05a7 100755 --- a/tests/pkg-version +++ b/tests/pkg-version @@ -140,8 +140,33 @@ else ok "# skip: no vercmp for pacman's order" fi -# This repository's own history, replayed from its first commit. +# Every package that puts its version file on the phone writes the +# package's version there, not the file's series: its PKGBUILD hands pkgver +# to install, and install writes it (run here for the packages whose install +# needs no build). cd "$here" +shipped=0 ran=0 +for i in packages/*/install; do + p=$(basename "$(dirname "$i")") + [[ $p != linux-omamobile ]] || continue # pkgrel only, its pkgver is the kernel's + grep -c -E 'install -Dm644 (version|"\$here/version") ' "$i" >/dev/null || continue + grep -c 'OMAMOBILE_PKGVER=$pkgver "$startdir/install"' "packages/$p/PKGBUILD" >/dev/null || + fail "$p: its PKGBUILD doesn't hand pkgver to install" + rm -rf "$t/inst" + # Some installs need a build first (prebuilt/, a source tree): those that + # run here are checked, and enough of them must run + if OMAMOBILE_PKGVER=9.8.7.6.gabc1234 "$i" "$t/inst" >/dev/null 2>&1; then + [[ -n $(grep -rlx 9.8.7.6.gabc1234 "$t/inst/usr/share/omamobile" 2>/dev/null) ]] || + fail "$p: install writes the version it is given" + ran=$((ran + 1)) + fi + shipped=$((shipped + 1)) +done +((shipped >= 20)) || fail "only $shipped packages ship a version file: the pattern no longer matches" +((ran >= 5)) || fail "only $ran of $shipped installs ran here" +ok "the $shipped packages that ship a version file hand it pkgver, and the $ran installs that run here write it" + +# This repository's own history, replayed from its first commit. if [[ $(git rev-parse --is-shallow-repository) == true ]]; then ok "# skip: a shallow clone has no history to replay" exit 0 From 0d482556f31eeb26df0a6e0d4f5355fb70e0bdcf Mon Sep 17 00:00:00 2001 From: saiththerobo Date: Thu, 12 Nov 2026 10:18:52 +0000 Subject: [PATCH 07/19] tools/pkg-version: edits not committed yet are their own version A build of edits not committed yet got the commit's version, so build-packages took the package as up to date and skipped it, and the phone got a build of different contents under a published number. Before this change, the hand-written bump avoided that only because the contributor bumped as they edited. Without --rev, the package's tree as it stands (tracked and new files, gitignored ones left out) is compared with HEAD's; when they differ, its tree id is added: 0.2.130.d5e0b7a2. pacman orders it above the commit's build and below the next commit's (checked with vercmp), each edit is a new version, and undoing the edits gives the commit's version back. A package not committed at all builds as 0.1.0pre0.d, below its first commit's 0.1.0pre1. Co-Authored-By: Claude Opus 5.5 --- CONTRIBUTING.md | 2 +- tests/pkg-version | 27 ++++++++++++++++ tools/pkg-version | 81 +++++++++++++++++++++++++++++++++++------------ 3 files changed, 88 insertions(+), 22 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5b4b5b311..751f6f8cc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -306,7 +306,7 @@ Findings that matter beyond one subsystem go into `device//NOTES.md`, ### 6.3 This repository - **Commit subjects** name the area, then say what changed: `omamobile-gnss: package GNSS with location on demand`, `omamobile-device-cheetah: reconnect USB after a replug`, `DISPLAY-PLAN: D3b-1b result, …`, `NOTES: …`. -- **Package versions are counted, not written.** Leave `version` alone: [`tools/pkg-version`](tools/pkg-version) gives every commit on `main` that touches a package the next number of its series (the first two numbers in `version`), so two merges can't ship one number. A build off `main` gets `..g`, which `pacman` orders between `main`'s builds. Change `version` only to start a new series (`0.2` to `0.3`); a third number there is read as a floor and nothing else, so an old-style bump does no harm. A dependency on a change that isn't on `main` yet can't name its number: depend on a version `main` has already shipped, or on a name the other package `provides`. +- **Package versions are counted, not written.** Leave `version` alone: [`tools/pkg-version`](tools/pkg-version) gives every commit on `main` that touches a package the next number of its series (the first two numbers in `version`), so two merges can't ship one number. A build off `main` gets `..g`, which `pacman` orders between `main`'s builds, and edits not committed yet add `.d`, a new version for each edit, so `tools/build-packages` rebuilds them without `--force`. Change `version` only to start a new series (`0.2` to `0.3`); a third number there is read as a floor and nothing else, so an old-style bump does no harm. A dependency on a change that isn't on `main` yet can't name its number: depend on a version `main` has already shipped, or on a name the other package `provides`. - **Bodies** explain the why and what was tested. Wrap at 72 columns. If an AI assistant co-wrote the commit, end with a `Co-Authored-By:` trailer, as the history does. - **Every file has an SPDX header** (§7). - **Describe what something is built from, not which other project it's based on.** Docs, the README, device notes and the website don't name or compare other mobile Linux projects or distributions: say "Arch Linux ARM with the `linux-megi` kernel", not "based on X". Citing a properly licensed source for a fact (upstream Linux, Google's GPL kernel, postmarketOS, Mesa, Omarchy) is fine, and expected. diff --git a/tests/pkg-version b/tests/pkg-version index 4b14e05a7..c963cf1eb 100755 --- a/tests/pkg-version +++ b/tests/pkg-version @@ -97,6 +97,30 @@ ok "a new series on a branch builds below main's first of it ($v)" ok "--main names the line to count on" git checkout -q main +# Edits not committed yet: their own version, one per edit, between the +# commit's and the next. +change code; v1=$(pv demo) +[[ $v1 =~ ^0\.3\.4\.d[0-9a-f]{7}$ ]] || fail "an uncommitted edit: got $v1" +ok "an uncommitted edit builds above the commit ($v1)" +change code; v2=$(pv demo) +[[ $v2 =~ ^0\.3\.4\.d[0-9a-f]{7}$ && $v2 != "$v1" ]] || fail "a second edit: got $v2 after $v1" +ok "each edit is a new version ($v2)" +is "$(pv --rev HEAD demo)" 0.3.4 "--rev names the commit alone" +git checkout -q -- packages/demo +is "$(pv demo)" 0.3.4 "undone edits build the commit's version" +change new-file; v1=$(pv demo) +[[ $v1 =~ \.d[0-9a-f]{7}$ ]] || fail "a new file not added yet: got $v1" +ok "a new file counts before git add ($v1)" +rm packages/demo/new-file +mkdir -p packages/demo/src && echo x > packages/demo/src/ignored && printf '%s\n' src/ .pkgver > packages/.gitignore +git add packages/.gitignore && commit "ignore makepkg's src and .pkgver, as this repository does" +is "$(pv demo)" 0.3.4 "a gitignored file (makepkg's src/) doesn't" +mkdir -p packages/newpkg && echo 0.1 > packages/newpkg/version +v=$(pv newpkg) +[[ $v =~ ^0\.1\.0pre0\.d[0-9a-f]{7}$ ]] || fail "an uncommitted package: got $v" +ok "a package not committed yet builds below its first commit ($v)" +rm -rf packages/newpkg packages/demo/src + # The copy a build container or the phone gets: .pkgver, and the PKGBUILD # reads it there without git. ( @@ -135,6 +159,9 @@ if command -v vercmp >/dev/null; then lt() { [[ $(vercmp "$1" "$2") == -1 ]] || fail "vercmp $1 < $2"; } lt 0.3.4 0.3.4.1.gabc1234; lt 0.3.4.1.gfffffff 0.3.4.2.g0000000; lt 0.3.4.2.g0000000 0.3.5 lt 0.1.0pre1.gabc1234 0.1.0; lt 0.1.0pre9.gabc1234 0.1.0pre10.gabc1234; lt 0.4.0pre3.gabc1234 0.4.0 + lt 0.3.4 0.3.4.dabc1234; lt 0.3.4.dfff1234 0.3.5; lt 0.3.4.dfff1234 0.3.4.1.g0000000 + lt 0.3.4.1.gabc1234 0.3.4.1.gabc1234.d0000000; lt 0.3.4.1.gfff1234.dfff1234 0.3.4.2.g0000000 + lt 0.1.0pre0.dfff1234 0.1.0pre1.g0000000 ok "pacman orders branch builds between main's builds" else ok "# skip: no vercmp for pacman's order" diff --git a/tools/pkg-version b/tools/pkg-version index 08c55c2c0..51ddeb594 100755 --- a/tools/pkg-version +++ b/tools/pkg-version @@ -28,6 +28,12 @@ # touch the package builds main's version. A package (or a series) that main # doesn't have yet builds as 0.1.0pre1.g4f2a9c1, below main's first 0.1.0. # +# Edits not committed yet (without --rev) add the package's tree as it +# stands: 0.2.130.d5e0b7a2, a new version for each edit, above the commit's +# and below the next one, so build-packages builds them and pacman takes +# them over the commit's build. A package not committed at all builds as +# 0.1.0pre0.d5e0b7a2. +# # It needs the history: in a shallow clone or a copy without .git it refuses # rather than guess. Tools that build from a copy (build-packages, # repo-build, phone-install-package) run it here first and put the result in @@ -38,11 +44,11 @@ set -euo pipefail die() { echo "pkg-version: $*" >&2; exit 1; } -main=${OMAMOBILE_MAIN_REF:-} rev=HEAD mode=version want= +main=${OMAMOBILE_MAIN_REF:-} rev=HEAD explicit_rev='' mode=version want= while (($#)); do case $1 in --main) main=${2:?--main needs a ref}; shift 2 ;; - --rev) rev=${2:?--rev needs a commit}; shift 2 ;; + --rev) rev=${2:?--rev needs a commit} explicit_rev=1; shift 2 ;; --history) mode=history; shift ;; --commit) mode=commit; shift ;; -h|--help) source "$(dirname -- "${BASH_SOURCE[0]}")/lib/usage.sh"; usage_from_header "$0"; exit 0 ;; @@ -137,24 +143,57 @@ case $mode in die "$pkg $want was never built on $main" ;; esac -[[ -n $(git ls-tree "$rev" -- "$path/version") ]] || die "$path/version doesn't exist at $rev" -# The history skips a version file that doesn't parse, so without this its -# commit would build under the number before it -parse "$(file_at "$rev")" >/dev/null || die "$path/version doesn't hold a version (0.2 or 0.2.5) at $rev" -if git merge-base --is-ancestor "$rev" "$main"; then - v=$(walk "$rev" | tail -1 | cut -d' ' -f2) - [[ -n $v ]] || die "$path/version doesn't hold a version (0.2 or 0.2.5) at $rev" - echo "$v" +# The package as it stands in the working tree, when that isn't HEAD's: a +# tree id over its tracked and new files (gitignored ones left out, as git +# leaves them), so each edit is its own version and a build of it is never +# taken for the commit's +worktree() { + local idx t + idx=$(mktemp -u) + if ! { GIT_INDEX_FILE=$idx git read-tree HEAD && GIT_INDEX_FILE=$idx git add -A -- "$path" && + t=$(GIT_INDEX_FILE=$idx git write-tree); }; then + rm -f "$idx" + die "can't read the working tree of $path" + fi + rm -f "$idx" + t=$(git rev-parse -q --verify "$t:$path") || return 0 + [[ $t == "$(git rev-parse -q --verify "HEAD:$path" || true)" ]] || echo "${t:0:7}" +} +local_edits= +[[ -n $explicit_rev ]] || local_edits=$(worktree) + +# The version REV builds at, from the history alone +committed() { + [[ -n $(git ls-tree "$rev" -- "$path/version") ]] || die "$path/version doesn't exist at $rev" + # The history skips a version file that doesn't parse, so without this its + # commit would build under the number before it + parse "$(file_at "$rev")" >/dev/null || die "$path/version doesn't hold a version (0.2 or 0.2.5) at $rev" + if git merge-base --is-ancestor "$rev" "$main"; then + v=$(walk "$rev" | tail -1 | cut -d' ' -f2) + [[ -n $v ]] || die "$path/version doesn't hold a version (0.2 or 0.2.5) at $rev" + echo "$v" + return 0 + fi + + base=$(git merge-base "$rev" "$main") || die "$rev shares no history with $main" + n=$(git rev-list --count --first-parent "$base..$rev" -- "$path") + v=$(walk "$base" | tail -1 | cut -d' ' -f2) + if ((n == 0)) && [[ -n $v ]]; then echo "$v"; return 0; fi + read -r s z < <(parse "$(file_at "$rev")") || die "$path/version doesn't hold a version (0.2 or 0.2.5) at $rev" + sha=$(git rev-parse --short=7 "$rev") + # A new package, or a branch that starts a new series: main's first build + # of it will be S.Z, and pacman orders 0.1.0pre1 below 0.1.0. + if [[ -z $v || ${v%.*} != "$s" ]]; then echo "$s.${z:-0}pre$n.g$sha"; return 0; fi + echo "$v.$n.g$sha" +} + +if [[ -n $local_edits && -z $(git ls-tree HEAD -- "$path/version") ]]; then + # A package not committed yet: below its first commit's 0.1.0pre1 + read -r s z < <(parse "$(cat "$path/version" 2>/dev/null)") || + die "$path/version doesn't hold a version (0.2 or 0.2.5)" + echo "$s.${z:-0}pre0.d$local_edits" exit 0 fi - -base=$(git merge-base "$rev" "$main") || die "$rev shares no history with $main" -n=$(git rev-list --count --first-parent "$base..$rev" -- "$path") -v=$(walk "$base" | tail -1 | cut -d' ' -f2) -if ((n == 0)) && [[ -n $v ]]; then echo "$v"; exit 0; fi -read -r s z < <(parse "$(file_at "$rev")") || die "$path/version doesn't hold a version (0.2 or 0.2.5) at $rev" -sha=$(git rev-parse --short=7 "$rev") -# A new package, or a branch that starts a new series: main's first build -# of it will be S.Z, and pacman orders 0.1.0pre1 below 0.1.0. -if [[ -z $v || ${v%.*} != "$s" ]]; then echo "$s.${z:-0}pre$n.g$sha"; exit 0; fi -echo "$v.$n.g$sha" +v=$(committed) +# Edits not committed yet: above the commit's version, below the next commit's +echo "$v${local_edits:+.d$local_edits}" From e6e22ba7c11b49d9f753be2a1c028f0a3085e26b Mon Sep 17 00:00:00 2001 From: saiththerobo Date: Thu, 12 Nov 2026 10:22:02 +0000 Subject: [PATCH 08/19] tools/repo-publish: never publish a test build With versions counted by tools/pkg-version, a build off main carries .g and a build of edits not committed yet carries .d. Both sort above the published build, so if the maintainer's out/repo held one from local testing and was published as it stood (--no-build development), every phone would take it over main's on the next update. stage() now refuses an index that lists one, before it copies anything, and names it; --from-main rebuilds main's version over it. The pattern matches only tools/pkg-version's 7-digit form, so the release kernel's 12-digit .g passes, and the test checks both. Co-Authored-By: Claude Opus 5.5 --- docs/RELEASES.md | 2 +- tests/repo-publish-stage | 14 ++++++++++++++ tools/repo-publish | 9 +++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/docs/RELEASES.md b/docs/RELEASES.md index 86439d100..1d2c51d37 100644 --- a/docs/RELEASES.md +++ b/docs/RELEASES.md @@ -482,7 +482,7 @@ Per release, in order. Stop at any failed step. `tools/release` runs the checkli 2. **Publish and tag** [`kernel`]: `tools/publish-kernel --dry-run --tag kernel- `, read what it would push, then run it without `--dry-run`. If it stops because `omamobile` moved, rebase, test what changed, and repeat. The stage checks that the annotated tag is on GitHub's `omamobile` and that the release worktree (`$KERNEL_BASE/wt-release`) is exactly that commit and clean. 3. **Build** [`build`] the kernel from the tag in the pinned container with the pinned clang (the stage checks `toolchain.txt`), release `LOCALVERSION` (`bin/omamobile kernel --release`), into the fixed `$KERNEL_BASE/out-kernel-release` (byte-identical builds need the same paths; the stage refuses that directory when it holds anything but a release build); stage `linux-omamobile` from it (`packages/linux-omamobile/stage`, §4). 4. **Images** [`images`] for every device: `DEVICE= bin/omamobile initramfs --release`, then `DEVICE= bin/omamobile images`, twice, checksums equal; then the device package's boot files (§5), for a device package whose `install` ships them (`OMAMOBILE_BOOT_FILES`): kept when `tools/stage-boot-files --check` finds them current, since the device package in `out/repo` was built from them, and then the boot images are built from their initramfs, so the bundle boots the bytes every phone's hook writes later; when they are stale, staged again only for a new device-package version (the stage asks for the bump when `out/repo` already has the current one), then `tools/build-packages packages/`. -5. **Packages** [`packages`]: every changed package has a new version (counted by `tools/pkg-version`), its `test/all` passes, `tools/build-packages` builds and signs them and the database on the laptop (`tools/repo-build` on a phone only as an opt-in shortcut). The stage checks that `out/repo` is signed by the release key, holds every package the image installs at this checkout's version, and that development publishes exactly it (`tools/repo-publish --no-build development`); it pins that index. `linux-omamobile` and `omamobile-boot-update` are among the image's packages (decision 10); `tools/build-packages` builds `linux-omamobile` only when named (`tools/build-packages packages/linux-omamobile`), and the stage checks the device package carries the staged boot files' initramfs. Then [`rootfs`] the root image on the stable channel from the pinned index, carrying both, and [`bundle`] the signed bundle. +5. **Packages** [`packages`]: every changed package has a new version (counted by `tools/pkg-version`; `tools/repo-publish` refuses a branch build, `.g`, or one of uncommitted edits, `.d`), its `test/all` passes, `tools/build-packages` builds and signs them and the database on the laptop (`tools/repo-build` on a phone only as an opt-in shortcut). The stage checks that `out/repo` is signed by the release key, holds every package the image installs at this checkout's version, and that development publishes exactly it (`tools/repo-publish --no-build development`); it pins that index. `linux-omamobile` and `omamobile-boot-update` are among the image's packages (decision 10); `tools/build-packages` builds `linux-omamobile` only when named (`tools/build-packages packages/linux-omamobile`), and the stage checks the device package carries the staged boot files' initramfs. Then [`rootfs`] the root image on the stable channel from the pinned index, carrying both, and [`bundle`] the signed bundle. 6. **Test install** [`test-install`] on each released device, attended (this gates the release, §12.10): the signed bundle's `install` on a phone whose stock slot A and backups are known good; first boot, device package installed, `omarchy update` clean (the installed phone follows stable, and `promote` comes after this step: the stage first asks the server whether stable has an index, and with none, which can only be before the first release to a server, prints the one-time promotion of the pinned index and stops; later releases find the previous release there), then a package-hook kernel update and a reboot into it; on the Pixel 7 Pro with a SIM, after `tools/phone-provision` and the carrier settings, the modem stack comes up at boot on its own ([MODEM-PLAN](../device/cheetah/MODEM-PLAN.md) M4.6b) and the phone registers. The bundle is signed before this step, so the bytes tested are the bytes released; `test-install --passed ""` records it. 7. **Identifiers** [`identifiers`]: grep the bundle, the root image's file list, `MANIFEST` and the release notes for MAC addresses (`[0-9a-f]{2}(:[0-9a-f]{2}){5}`), serial numbers, SSIDs and account names; confirm no file from a factory image is in any artifact. The stage also reads the root image's `/etc`, `/root` and our own directories and the release initramfs; serials, SSIDs and account names come from a private list outside the repository (`~/.config/omamobile/release-identifiers`, one per line). `tools/release scan FILE...` checks any file the same way. 8. **Verify** [`verify`] the release's signature from a clean keyring: the bundle's `SHA256SUMS.sig` by the release key, every file against `SHA256SUMS`, and the root image against the SHA-256 the signed `MANIFEST` names (the bundle stage signed it; the root image needs no signature of its own, since the installer and `manifest.json` authorise it only through that signed record); upload [`upload`] them to `pkgs.omamobile.org/releases/` (§6) with `tools/release-upload --dry-run out/bundle/omamobile--`, then `tools/release-upload --full --latest out/bundle/omamobile--`, files before the index (`upload --done` reads them back with `--verify-only`); promote [`promote`] the release's packages to `stable`: `tools/repo-publish stable --expect-index ` promotes development's index and files unchanged, signatures included, and only if development's index is still the one the release was built and tested from. diff --git a/tests/repo-publish-stage b/tests/repo-publish-stage index 8bef0715b..b35f5d47b 100755 --- a/tests/repo-publish-stage +++ b/tests/repo-publish-stage @@ -220,3 +220,17 @@ expect_index v2 expect "without a record, a no-op keeps v1 and drops what the failed v3 copied" base-1-1 app-1-1 app-2-1 stages v3 "stages v3 after that" expect "and the next change keeps only the set it replaces" base-1-1 app-2-1 app-3-1 + +# A branch build or a build of uncommitted edits is never published, and +# the channel is left as it was. +before=$(have) +make_repo vg base-1-1 app-0.2.1.1.gabc1234-1 +if run_stage vg; then fail "refuses a branch build"; fi +grep -c 'test builds' "$t/log" >/dev/null || fail "says why a branch build is refused" +make_repo vd base-1-1 app-0.2.1.dabc1234-1 +if run_stage vd; then fail "refuses a build of uncommitted edits"; fi +[[ $(have) == "$before" ]] || fail "a refused test build changes nothing in the channel" +pass "test builds (.g, .d) are refused and change nothing" +make_repo vk base-1-1 linux-omamobile-7.3.0rc6.r4521.g0123456789ab-1 +stages vk "a release kernel's 12-digit commit is not a test build" +pass "a release kernel's 12-digit commit is not a test build" diff --git a/tools/repo-publish b/tools/repo-publish index b0f961908..f4d2da2a5 100755 --- a/tools/repo-publish +++ b/tools/repo-publish @@ -195,6 +195,15 @@ stage() { mkdir -p "$to" local new current="" previous new=$(db_files "$from") + # A branch build (.g) or a build of edits not committed yet + # (.d) is a test build, never published: tools/pkg-version gives + # main's commits plain numbers + local test_builds + test_builds=$(grep -E '\.[gd][0-9a-f]{7}-[^-]+-[^-]+\.pkg\.tar\.' <<<"$new" || true) + if [[ -n $test_builds ]]; then + echo "$from holds test builds, not built from main (tools/repo-publish --from-main builds main's): $(tr '\n' ' ' <<<"$test_builds")" >&2 + return 1 + fi if [[ -f $to.sets ]]; then current=$(sed -n 's/^current //p' "$to.sets") previous=$(sed -n 's/^previous //p' "$to.sets") From 9af97d1c4a243aa543b2f79bbeb6e6290a6a38d6 Mon Sep 17 00:00:00 2001 From: saiththerobo Date: Thu, 12 Nov 2026 10:34:05 +0000 Subject: [PATCH 09/19] tools/release: ask for a commit under the device package, not a bump The images and packages stages stopped with "bump packages//version" when the boot files were stale and out/repo already had the current version. With versions counted by tools/pkg-version, a hand-written bump is no longer how a package gets a new version: any commit under the package is, and boot files are gitignored, so staging them alone gives none. The stages now ask for a commit under the device package, and print the next number to write into its version file when there is nothing else to change (read as a floor, that commit gives exactly that number). tests/release checks both lines. Co-Authored-By: Claude Opus 5.5 --- tests/release | 13 +++++++------ tools/release | 22 ++++++++++++++++++---- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/tests/release b/tests/release index aa4883c81..226b3f02e 100755 --- a/tests/release +++ b/tests/release @@ -14,7 +14,7 @@ # (none: the one-time promotion; no answer: stop), # the test-install record, the tag stage refusing notes with placeholders, # the images stage keeping current boot files and asking for a device-package -# version bump before restaging stale ones (a stand-in stage-boot-files), +# new version before restaging stale ones (a stand-in stage-boot-files), # the bundle check against a bundle laid out as make-bundle builds it # (INSTALL.md and make-bundle's provision tools allowed, nothing else), and # the upload stage running the real tools/release-upload --dry-run on a @@ -233,7 +233,7 @@ if run --version "$V" tag; then fail "notes with placeholders are refused"; fi grep -q 'placeholders' "$t/log" || fail "says the notes have placeholders" pass "test-install records only the release kernel on a signed bundle; tag refuses unfinished notes" -# --- images: current boot files are kept; stale ones need a version bump --- +# --- images: current boot files are kept; stale ones need a new version --- # A stand-in for #320's tools/stage-boot-files: --check passes when # $t/bf-current exists; staging is only printed in a dry run mkdir -p "$R/packages/omamobile-boot-update" "$R/packages/omamobile-device-testdev" "$RELEASE_KERNEL_OUT/include/config" @@ -260,16 +260,17 @@ printf 'pkgname = omamobile-device-testdev\npkgbase = omamobile-device-testdev\n repo-add -q omamobile.db.tar.gz omamobile-device-testdev-0.1.5-1-any.pkg.tar.zst) >/dev/null 2>&1 || fail "a repository fixture" mv "$R/out/repo" "$t/repo.saved" && mkdir -p "$R/out/repo" && cp -a "$t/repo2" "$R/out/repo/aarch64" if run --version "$V" --dry-run images; then fail "stale boot files at a version out/repo already has are refused"; fi -grep -q 'a device-package version bump is needed' "$t/log" || fail "says a version bump is needed" -grep -q 'bump packages/omamobile-device-testdev/version' "$t/log" || fail "prints the bump and the rebuild" -# a bumped version (out/repo doesn't have it yet): stage, then build it +grep -q 'a new device-package version is needed' "$t/log" || fail "says a new version is needed" +grep -q 'commit a change under packages/omamobile-device-testdev' "$t/log" || fail "says a commit under the package gives the new version" +grep -q 'echo 0.1.6 > packages/omamobile-device-testdev/version' "$t/log" || fail "prints the next number to write when nothing else changes" +# a new version (out/repo doesn't have it yet): stage, then build it sed -i 's/pkgver=0.1.5/pkgver=0.1.6/' "$R/packages/omamobile-device-testdev/PKGBUILD" run --version "$V" --dry-run images || fail "stale boot files for a new device-package version are staged" grep -q 'would run: tools/stage-boot-files' "$t/log" || fail "stages the boot files for the new version" grep -q 'next: tools/build-packages packages/omamobile-device-testdev' "$t/log" || fail "names the device package to build next" rm -rf "$R/out/repo" && mv "$t/repo.saved" "$R/out/repo" rm -rf "$R/packages/omamobile-boot-update" "$R/packages/omamobile-device-testdev" "$R/tools/stage-boot-files" "$RELEASE_KERNEL_OUT" -pass "images keeps current boot files and builds from their initramfs, and asks for a device-package version bump before restaging stale ones" +pass "images keeps current boot files and builds from their initramfs, and asks for a new device-package version before restaging stale ones" # --- upload: the real tools/release-upload --dry-run on a signed bundle --- for tool in rsync sha256sum; do diff --git a/tools/release b/tools/release index 354cc6d50..3fed2d452 100755 --- a/tools/release +++ b/tools/release @@ -207,6 +207,20 @@ pkg_info() { echo "${epoch:+$epoch:}$pkgver-$pkgrel ${pkgname[*]}" ) } +# The first line Derek is shown when a device package needs a new version +# for new boot files: tools/pkg-version counts any commit under the +# package, and with nothing else to change, writing its next number into +# version (read as a floor) is such a commit +new_version_hint() { + local v + v=$(pkg_info "$1" | cut -d' ' -f1) + v=${v%-*} + if [[ $v =~ ^[0-9]+(\.[0-9]+)+$ ]]; then + echo "# commit a change under packages/$1 (tools/pkg-version counts it; with nothing else to change: echo ${v%.*}.$((${v##*.} + 1)) > packages/$1/version), then:" + else + echo "# commit a change under packages/$1 (tools/pkg-version counts it as a new version), then:" + fi +} # "name version" for every package an index lists db_versions() { bsdtar -xOf "$1" --include='*/desc' | @@ -349,10 +363,10 @@ st_images() { [[ ! -f out/repo/aarch64/omamobile.db.tar.gz ]] || have_v=$(db_versions out/repo/aarch64/omamobile.db.tar.gz | awk -v n="$dpkg" '$1 == n { print $2 }') if [[ $have_v == "$want_v" ]]; then - derek "# bump packages/$dpkg/version (a new version for new boot files), commit it, then:" \ + derek "$(new_version_hint "$dpkg")" \ "tools/release --version $version images # stages them" \ "tools/build-packages packages/$dpkg" - die "$bf is stale or missing and out/repo already has $dpkg $want_v: a device-package version bump is needed" + die "$bf is stale or missing and out/repo already has $dpkg $want_v: a new device-package version is needed" fi KERNEL_OUT=$RELEASE_KERNEL_OUT DEVICE=$DEVICE run tools/stage-boot-files note "staged for $dpkg $want_v (out/repo: ${have_v:-none}); next: tools/build-packages packages/$dpkg" @@ -386,7 +400,7 @@ st_images() { # The device package's dtbo is the bundle's, as its initramfs is if ((kept)) && ships_boot_files; then cmp -s "$bf/dtbo.img" "$RELEASE_KERNEL_OUT/images/dtbo.img" || - die "$bf/dtbo.img differs from the bundle's dtbo.img: the device package and the bundle would boot different dtbos (bump packages/$dpkg/version, then run this stage again)" + die "$bf/dtbo.img differs from the bundle's dtbo.img: the device package and the bundle would boot different dtbos (commit a change under packages/$dpkg for a new version, then run this stage again)" note "the bundle's dtbo.img is the device package's ($bf)" fi # The release initramfs has no builder keys (make-bundle checks it again) @@ -488,7 +502,7 @@ st_packages() { want_sum=$(awk '$2 == "initramfs.cpio.lz4" { print $1 }' "$bf") got_sum=$({ bsdtar -xOf "out/repo/aarch64/$pf" "usr/lib/omamobile/$DEVICE/initramfs.cpio.lz4" 2>/dev/null || true; } | sha256sum | cut -d' ' -f1) [[ -n $want_sum && $got_sum == "$want_sum" ]] || { - derek "# bump packages/$dpkg/version (same version, other boot files), commit it, then:" \ + derek "$(new_version_hint "$dpkg")" \ "tools/release --version $version images # restages the boot files" \ "tools/build-packages packages/$dpkg" die "$pf does not carry the staged release initramfs (packages/$dpkg/boot-files): it was built from other boot files at the same version" From a4f1fd148d3ad6bb905df42fc642af018389ad24 Mon Sep 17 00:00:00 2001 From: saiththerobo Date: Thu, 12 Nov 2026 10:34:05 +0000 Subject: [PATCH 10/19] CONTRIBUTING, AGENTS, RELEASES: how versions went from written to counted MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit RELEASES §7.1 describes the change over: before the merge the version files are the published versions; the merge commit starts the count and moves every counted package one number up (published once by the next nightly); pull requests opened before it merge as they are, with a bump above the count taken as a floor; the third numbers stay as floors until the maintainer cuts the files to their series; and going back means writing the counted versions into the files first, since their stale numbers sit below what phones have. CONTRIBUTING and AGENTS now say a commit subject carries no version (it isn't known until the merge), a doc names a version only once main has shipped it, and which packages still carry hand-written versions (those built from another project's release, the kernel and the keyring). AGENTS' commit subject example lost its version, its pkg-version row gains .d, and the reviewer agent checks subjects and docs too. Co-Authored-By: Claude Opus 5.5 --- .claude/agents/omamobile-reviewer.md | 6 ++++-- AGENTS.md | 5 +++-- CONTRIBUTING.md | 4 ++-- docs/RELEASES.md | 17 +++++++++++++++-- packages/omamobile-shell/README.md | 2 +- 5 files changed, 25 insertions(+), 9 deletions(-) diff --git a/.claude/agents/omamobile-reviewer.md b/.claude/agents/omamobile-reviewer.md index c1b7e20ac..4231ae504 100644 --- a/.claude/agents/omamobile-reviewer.md +++ b/.claude/agents/omamobile-reviewer.md @@ -128,8 +128,10 @@ that would land wrong. cited; Google's copyright kept on imported code; SPDX headers. - **Conventions:** area prefixes (this repo) or subsystem prefixes from `git log --oneline ` (kernel); bodies that say why with evidence; - no package `version` bump (`tools/pkg-version` counts it; a new series - only on purpose); a human + no package `version` bump and no version in a subject (`tools/pkg-version` + counts it; a new series only on purpose, a third number above the count + only if the jump is wanted, RELEASES §7.1); no unshipped version named in + docs; a human Signed-off-by on kernel commits and never an AI one; the plan updated with a gated runbook (Expect/Pass, stop condition, rollback, risk) for anything run on a phone. diff --git a/AGENTS.md b/AGENTS.md index d1960232f..952b43013 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -42,7 +42,7 @@ Omarchy Mobile runs native Omarchy (Arch Linux ARM, Hyprland, Omarchy's packages - **Kernel branches:** one subsystem per branch (`omamobile-`). `omamobile` on GitHub is the one source of the release kernel: community pull requests land there as rebase merges, the maintainer's curated, signed-off commits land as a fast-forward of a local release branch built on the current `github/omamobile` (`tools/publish-kernel`), and releases are tags on it (`kernel-`, [RELEASES](docs/RELEASES.md) §8). It is never rewritten or force-pushed. `omamobile-int` is a local integration branch for test kernels only, no longer published and no release source. Don't rebase or force-push branches someone else is merging from. - **Commit messages:** - Kernel commits are upstream-style: the subsystem prefix from `git log --oneline `, the why, and the evidence. AI agents never add `Signed-off-by:` (`Documentation/process/coding-assistants.rst`): the human signs off. - - This repository uses an area prefix (`omamobile-gnss: …`, `device-cheetah 0.1.15: …`, `DISPLAY-PLAN: …`), a body that explains why, and the attribution trailer the session asks for. + - This repository uses an area prefix (`omamobile-gnss: …`, `omamobile-device-cheetah: …`, `DISPLAY-PLAN: …`; no package version, which is counted at merge), a body that explains why, and the attribution trailer the session asks for. - **Reviewing pull requests:** use the `omamobile-reviewer` agent (`.claude/agents/omamobile-reviewer.md`), one PR (or a few related ones) per run. It reads the review lessons ([docs/review/LESSONS.md](docs/review/LESSONS.md) is their index, the entries are in `docs/review/lessons/`), runs `tools/pr-check` or `tools/kernel-pr-check`, and returns a verdict, a draft comment and candidate lessons. Nothing is posted until the maintainer says so; confirmed lessons (and corrections, when a review was wrong) are added to the lesson files in a `docs/review: …` commit, so the next review knows them. - **Commit only your own files when others have uncommitted work**, with a temporary index: @@ -56,6 +56,7 @@ Omarchy Mobile runs native Omarchy (Arch Linux ARM, Hyprland, Omarchy's packages ``` This leaves other people's staged and unstaged changes alone. +- **Package versions are counted, never written** ([CONTRIBUTING](CONTRIBUTING.md) §6.3): don't change a package's `version` file except to start a new series, and don't put a version in a commit subject. A doc or plan written in a pull request can't know the number its change will ship as: name the pull request or the commit, and add the number (`tools/pkg-version --history `) once `main` has it. Versions already in the docs (`omamobile-modem` 0.1.15+) are published ones and stay right. The packages built from another project's release (Mesa, Hyprland, libcamera and the others whose PKGBUILD sets `pkgver` itself), `linux-omamobile` and `omamobile-keyring` still carry hand-written versions. - **Moving a feature from bring-up into a package:** enable nothing that isn't hang-safe, and delete the bring-up files from `/etc/modprobe.d` on the phone (`omamobile-*-bringup.conf`, and any hand-copied package file). A file in `/etc/modprobe.d` replaces the package's `/usr/lib/modprobe.d` file of the same name, so a stale `omamobile-aoc.conf` there hid the package's new blacklist. - **Kernel releases change with every push** (`7.3.0-rc6-omamobile-push1-NNNNN-g`). `bin/omamobile push` runs `modules-push` when the tarball's checksum differs. Without its modules a new kernel boots without its drivers, the GPU among them. `modules-push` replaces `/usr/lib/modules/` as a whole; on the 9a that once took a hand-installed panel driver with it, and the display stayed on the boot logo. It now refuses when the folder holds modules added or swapped by hand since the last push (it records what each push installed in `.omamobile-modules.sha256`), and `OMAMOBILE_MODULES_REPLACE=1` overrides that, wiping them. Pin a daily release whose folder carries hand-installed modules (`/usr/lib/modules/.omamobile-pinned`), and keep a copy before overriding (`tar -C /usr/lib/modules -cf … `). - **Stop the modem before a `push` or a `reboot-to`.** `push` ends in `reboot-to`, a raw reboot syscall that stops no unit, so `omamobile-modem.service` never runs its clean stop and its `modem-up` marker stays. On the 7 Pro, where the modem starts at boot (device-cheetah 0.1.43+), the next boot counts that as an unclean end ("ended without a clean stop: a hang or a reset"); from `omamobile-modem` 0.1.19 it starts the modem all the same (before, it skipped the modem once), and a second such end before a clean stop holds it off until `omamobile-modem-start --retry`. So a skipped stop no longer costs a boot's modem, but it uses up the one unclean end the guard allows. This happened on 2026-11-08 after a `reboot-to bootloader` taken to charge a flat battery. So run `systemctl stop omamobile-modem` first, as part of the reboot the human said yes to; a reboot that needs no reason can be `systemctl reboot` instead, which stops it. The stop powers the CP off (one recovered UFS error-handler pass, as any reboot with the modem up costs) and, with the NV overlay on, captures its writes. For now it takes about 40 s and ends as "failed", with the CP's power-off logged as a crash; the marker is still removed ([#532](https://github.com/derekross/omarchy-mobile/issues/532)). This is not the restart the modem notes below forbid: nothing starts the modem again before the reboot. From `omamobile-modem` 0.1.21, with a device package whose `reboot-to` notes the boot it ends ([#403](https://github.com/derekross/omarchy-mobile/pull/403)), the next boot doesn't count a marker from that boot, so a `reboot-to` no longer uses up the unclean end (one already counted stays counted); the CP's ordered power-off and the NV capture still come only from the unit's stop, so the rule stands. [MODEM-PLAN](device/cheetah/MODEM-PLAN.md) M4.6b @@ -104,7 +105,7 @@ tools/phone-ssh CMD -> run anything; stream files with ssh 'cat > f' < f | `packages/linux-omamobile/stage KERNEL_OUT`, `tools/stage-boot-files` | Stage a kernel build for the kernel package, and a device's dtbo, overlays and release initramfs for its device package (gitignored `prebuilt/`, `boot-files/`); laptop only, no phone | | `omamobile-omarchy-patches status\|verify\|apply` (on the phone) | The Omarchy patch series: what is applied, already upstream or failed; `apply` re-applies it all or nothing (the pacman hook does this after every Omarchy upgrade). Log: `/var/log/omamobile/omarchy-patches.log` | | `tools/build-packages`, `tools/build-rootfs` | aarch64 packages (signed, `out/repo`) and the root image, built on the laptop in an Arch Linux ARM container (qemu-user); no phone | -| `tools/pkg-version PACKAGE`, `--commit PACKAGE VERSION` | A package's version, counted from `main`'s history (the series in `version`, then one per commit touching the package; off `main`, `..g` on top), and the commit a version was built from. Read-only. The build tools put it in their copies as `.pkgver`; it refuses a shallow clone | +| `tools/pkg-version PACKAGE`, `--commit PACKAGE VERSION` | A package's version, counted from `main`'s history (the series in `version`, then one per commit touching the package; off `main`, `..g` on top; edits not committed yet, `.d`), and the commit a version was built from. Read-only. The build tools put it in their copies as `.pkgver`; it refuses a shallow clone | | `tools/install-phone` | The installer: fastboot checks, the owner's answers into a local image copy, then only slot B's images and `userdata`. Asks the human to type the codename; `--dry-run` first. Never run it without the human's go | | `tools/nv-backup DIR`, `--check DIR` | The read-only backup of the radio and calibration partitions (the descriptor's `NV_PARTS` and `NV_BACKUP_EXTRA`) over USB SSH, found by `PARTNAME`, refused unless all are read-only and unmounted, each copy verified against a second read on the phone; `--check` is the checksum check of section 1 against such a backup. The output holds the IMEI: never commit or share it | | `tools/phone-provision` | After a fresh install: Google's files from the user's factory image and the phone's own data from the backup. The run is named, never guessed, and there is no default backup directory: `--first-install --nv-backup DIR` (board id from the phone, NV checksums from the owner's `nv-backup`) or `--restore DIR` (a `phone-config.tar`; `--backup DIR` is the older spelling). `--fingerprint` copies only the calibration and `persist:/ss` copies (the runner makes both itself on a new install), `--restore-td` also Trusty's TD and the enrolled fingers, valid only if no storageproxyd ran since the backup; it never starts the service | diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 751f6f8cc..35525f14d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -305,8 +305,8 @@ Findings that matter beyond one subsystem go into `device//NOTES.md`, ### 6.3 This repository -- **Commit subjects** name the area, then say what changed: `omamobile-gnss: package GNSS with location on demand`, `omamobile-device-cheetah: reconnect USB after a replug`, `DISPLAY-PLAN: D3b-1b result, …`, `NOTES: …`. -- **Package versions are counted, not written.** Leave `version` alone: [`tools/pkg-version`](tools/pkg-version) gives every commit on `main` that touches a package the next number of its series (the first two numbers in `version`), so two merges can't ship one number. A build off `main` gets `..g`, which `pacman` orders between `main`'s builds, and edits not committed yet add `.d`, a new version for each edit, so `tools/build-packages` rebuilds them without `--force`. Change `version` only to start a new series (`0.2` to `0.3`); a third number there is read as a floor and nothing else, so an old-style bump does no harm. A dependency on a change that isn't on `main` yet can't name its number: depend on a version `main` has already shipped, or on a name the other package `provides`. +- **Commit subjects** name the area, then say what changed: `omamobile-gnss: package GNSS with location on demand`, `omamobile-device-cheetah: reconnect USB after a replug`, `DISPLAY-PLAN: D3b-1b result, …`, `NOTES: …`. No package version: it is counted when the change lands on `main`. +- **Package versions are counted, not written.** Leave `version` alone: [`tools/pkg-version`](tools/pkg-version) gives every commit on `main` that touches a package the next number of its series (the first two numbers in `version`), so two merges can't ship one number. A build off `main` gets `..g`, which `pacman` orders between `main`'s builds, and edits not committed yet add `.d`, a new version for each edit, so `tools/build-packages` rebuilds them without `--force`. Change `version` only to start a new series (`0.2` to `0.3`); a third number there is read as a floor and nothing else, so an old-style bump does no harm. A dependency on a change that isn't on `main` yet can't name its number: depend on a version `main` has already shipped, or on a name the other package `provides`. The same goes for docs: name a version only once `main` has shipped it (`tools/pkg-version --history ` lists them), and the pull request until then. Packages built from another project's release (Mesa, Hyprland, libcamera and the others whose PKGBUILD sets `pkgver` itself), `linux-omamobile` and `omamobile-keyring` keep hand-written versions: raise `pkgrel` (or the kernel package's `version`, which is its `pkgrel`) for a packaging change. How the project moved from written to counted versions, and what happens to pull requests opened before, is in [RELEASES](docs/RELEASES.md) §7.1. - **Bodies** explain the why and what was tested. Wrap at 72 columns. If an AI assistant co-wrote the commit, end with a `Co-Authored-By:` trailer, as the history does. - **Every file has an SPDX header** (§7). - **Describe what something is built from, not which other project it's based on.** Docs, the README, device notes and the website don't name or compare other mobile Linux projects or distributions: say "Arch Linux ARM with the `linux-megi` kernel", not "based on X". Citing a properly licensed source for a fact (upstream Linux, Google's GPL kernel, postmarketOS, Mesa, Omarchy) is fine, and expected. diff --git a/docs/RELEASES.md b/docs/RELEASES.md index 1d2c51d37..71f7b86d2 100644 --- a/docs/RELEASES.md +++ b/docs/RELEASES.md @@ -214,7 +214,7 @@ One package for every device, in `[omamobile]`. - **`stage KERNEL_OUT [PREBUILT]`**, on the build machine, after `bin/omamobile kernel` and `modules` (or anything that leaves the same files): copies `include/config/kernel.release`, `arch/arm64/boot/Image`, every DTB under `arch/arm64/boot/dts/exynos/google` (`DTB_DIRS` adds others) and `modules-.tar.zst` into the package's gitignored `prebuilt/`, with `SHA256SUMS`. `KERNEL_DIR` must be the clean checkout of a published release: its HEAD the release's commit and carrying a `kernel-[.N]` tag, the tag on the published repository (`LINUX_OMAMOBILE_REMOTE`, default GitHub's `linux-omarchy-mobile`) pointing at that commit, and the commit on its `omamobile` branch. `git rev-list --count HEAD` is the commit count for pkgver; the commit, the count and the tag go in `SOURCE`, which `install` requires. `stage --verify` checks a staged `prebuilt/` again (checksums, `SOURCE`, the tag on the published repository). - **Refusals:** a development release (`-omamobile-push1-…`, or any release not of the form `[-rcN]-omamobile[-]-g`), a `-dirty` tree, no `KERNEL_DIR`, a `KERNEL_DIR` at another commit or with uncommitted changes, a commit without a release tag (a test build or an `omamobile-int` snapshot), a tag the published repository doesn't have or that isn't on its `omamobile`, an `Image` without arm64's header magic, a modules tarball of another release or without `modules.order`, no DTBs, and at packing time a `prebuilt/` that fails its checksums. -- **pkgver** from the staged release (`lib/pkgver`, as §4 and §7 say), **pkgrel** from the package's `version` file (packaging changes only). With nothing staged pkgver is `0` and `package()` refuses. `tools/build-packages` builds it only when named, never by default or with `--all` (so a `prebuilt/` staged for a test never reaches the daily publish, which carries `prebuilt/` directories along), and runs `stage --verify` first. +- **pkgver** from the staged release (`lib/pkgver`, as §4 and §7 say), **pkgrel** from the package's `version` file (packaging changes only; written by hand, as `tools/pkg-version` doesn't count this package). With nothing staged pkgver is `0` and `package()` refuses. `tools/build-packages` builds it only when named, never by default or with `--all` (so a `prebuilt/` staged for a test never reaches the daily publish, which carries `prebuilt/` directories along), and runs `stage --verify` first. - **`/usr/share/omamobile/linux/kernel.release`** names the release the package installed, for the boot hook (§5.3), and `SOURCE` beside it the tag and commit. - **Layout** as above. depmod's own files (`modules.dep`, `.alias`, `.symbols` …) are left out, as Arch's kernels leave them out: kmod's `60-depmod.hook` makes them on the phone, and the boot hook refuses a release without them. `options=(!strip !debug)`: makepkg must not touch the `Image` or the stripped modules. `depends=(kmod omamobile-boot-update)`. @@ -420,6 +420,19 @@ automatic boot-update policy. A release never contains a kernel or package that isn't in `[omamobile]` at the same moment, so a bundle install and `omarchy update` meet at the same versions. The first release is `2026.MM.DD`, labelled "developer preview", for the Pixel 7 Pro only (§12.12). +### 7.1 From written to counted package versions + +Until the pull request that added `tools/pkg-version` (issue #689), each pull request wrote its package's next version into `version` by hand. Two open pull requests could write the same number and both merge, and a stacked or rebased one had to be renumbered at every merge. The count replaces that for every package whose PKGBUILD reads it; the others keep hand-written versions (CONTRIBUTING §6.3). + +1. **Before the merge,** each `version` file holds the last number written by hand, which is the version `[omamobile]` publishes. +2. **The merge commit starts the count.** For each package, `tools/pkg-version` takes the version as `main` held it just before that commit, and every later commit on `main`'s first-parent line that touches the package is the next number. The merge commit itself touches all 30 counted packages (their PKGBUILDs), so each moves one number up, and the first development publish after it rebuilds all 30 once (`shell` 0.2.126 to 0.2.127). Nothing is written by hand, and no version that was published comes back. +3. **From then on,** a merge needs no version change. Squash merges, merge commits and direct pushes count once each, in the order they land; a commit that changes only tests or docs under a package counts too. `tools/pkg-version --commit ` finds the commit a published version was built from, and `--history ` lists them all. +4. **Pull requests opened before the change** merge as they are. A `version` hunk at or below the count changes nothing; a number above it is taken as a floor, so the package jumps to it: drop such a hunk at review unless the jump is wanted. A conflict on `version` resolves to `main`'s file. A versioned dependency on another open pull request's number (`depends=('omamobile-shell>=0.2.130')`) may name a number the count gives to something else: check it against `tools/pkg-version` at merge, or depend on a shipped version. +5. **The `version` files keep their old third numbers** for now, so contributors who still bump do no harm while they adjust. They go stale; once the pull requests from before the change have drained, one commit can cut every file to its series (`0.2`). That commit touches every package, so each moves one number up again and is republished once; it is the maintainer's call when. +6. **Going back** to hand-written versions means first writing each package's current version (`tools/pkg-version `) into its `version` file: the files' stale numbers are below what phones have installed, and `pacman` would not upgrade from them. + +The review lessons about version collisions and renumbering (L-12, L-217, L-275, L-404, L-426, L-477, L-551, L-640) no longer apply to the counted packages once this lands. + ## 8. The kernel branches - **`omamobile` on GitHub is the one source of the release kernel.** It starts from a squashed commit holding the upstream tag's tree (v7.3-rc6), with every commit after it unchanged, and it only moves forward: pull requests and release tags point at its commit ids, so nothing rewrites or force-pushes it. @@ -481,7 +494,7 @@ Per release, in order. Stop at any failed step. `tools/release` runs the checkli 1. **Kernel** [`kernel`]: a release branch on the current `github/omamobile` holds everything the release needs as curated, signed-off commits (§8); `tools/kernel-pr-check --build OUT --merge github/omamobile ` passes; it boots on each released device, with `uname -r` and the result in that device's NOTES (the stage looks for the exact release, `-omamobile-g`, in `device//NOTES.md` only: a plan's Expect line or a `-push1` build of the commit doesn't count). 2. **Publish and tag** [`kernel`]: `tools/publish-kernel --dry-run --tag kernel- `, read what it would push, then run it without `--dry-run`. If it stops because `omamobile` moved, rebase, test what changed, and repeat. The stage checks that the annotated tag is on GitHub's `omamobile` and that the release worktree (`$KERNEL_BASE/wt-release`) is exactly that commit and clean. 3. **Build** [`build`] the kernel from the tag in the pinned container with the pinned clang (the stage checks `toolchain.txt`), release `LOCALVERSION` (`bin/omamobile kernel --release`), into the fixed `$KERNEL_BASE/out-kernel-release` (byte-identical builds need the same paths; the stage refuses that directory when it holds anything but a release build); stage `linux-omamobile` from it (`packages/linux-omamobile/stage`, §4). -4. **Images** [`images`] for every device: `DEVICE= bin/omamobile initramfs --release`, then `DEVICE= bin/omamobile images`, twice, checksums equal; then the device package's boot files (§5), for a device package whose `install` ships them (`OMAMOBILE_BOOT_FILES`): kept when `tools/stage-boot-files --check` finds them current, since the device package in `out/repo` was built from them, and then the boot images are built from their initramfs, so the bundle boots the bytes every phone's hook writes later; when they are stale, staged again only for a new device-package version (the stage asks for the bump when `out/repo` already has the current one), then `tools/build-packages packages/`. +4. **Images** [`images`] for every device: `DEVICE= bin/omamobile initramfs --release`, then `DEVICE= bin/omamobile images`, twice, checksums equal; then the device package's boot files (§5), for a device package whose `install` ships them (`OMAMOBILE_BOOT_FILES`): kept when `tools/stage-boot-files --check` finds them current, since the device package in `out/repo` was built from them, and then the boot images are built from their initramfs, so the bundle boots the bytes every phone's hook writes later; when they are stale, staged again only for a new device-package version (when `out/repo` already has the current one, the stage asks for a commit under the device package, which `tools/pkg-version` counts as the next version; boot files are gitignored, so staging them alone gives none), then `tools/build-packages packages/`. 5. **Packages** [`packages`]: every changed package has a new version (counted by `tools/pkg-version`; `tools/repo-publish` refuses a branch build, `.g`, or one of uncommitted edits, `.d`), its `test/all` passes, `tools/build-packages` builds and signs them and the database on the laptop (`tools/repo-build` on a phone only as an opt-in shortcut). The stage checks that `out/repo` is signed by the release key, holds every package the image installs at this checkout's version, and that development publishes exactly it (`tools/repo-publish --no-build development`); it pins that index. `linux-omamobile` and `omamobile-boot-update` are among the image's packages (decision 10); `tools/build-packages` builds `linux-omamobile` only when named (`tools/build-packages packages/linux-omamobile`), and the stage checks the device package carries the staged boot files' initramfs. Then [`rootfs`] the root image on the stable channel from the pinned index, carrying both, and [`bundle`] the signed bundle. 6. **Test install** [`test-install`] on each released device, attended (this gates the release, §12.10): the signed bundle's `install` on a phone whose stock slot A and backups are known good; first boot, device package installed, `omarchy update` clean (the installed phone follows stable, and `promote` comes after this step: the stage first asks the server whether stable has an index, and with none, which can only be before the first release to a server, prints the one-time promotion of the pinned index and stops; later releases find the previous release there), then a package-hook kernel update and a reboot into it; on the Pixel 7 Pro with a SIM, after `tools/phone-provision` and the carrier settings, the modem stack comes up at boot on its own ([MODEM-PLAN](../device/cheetah/MODEM-PLAN.md) M4.6b) and the phone registers. The bundle is signed before this step, so the bytes tested are the bytes released; `test-install --passed ""` records it. 7. **Identifiers** [`identifiers`]: grep the bundle, the root image's file list, `MANIFEST` and the release notes for MAC addresses (`[0-9a-f]{2}(:[0-9a-f]{2}){5}`), serial numbers, SSIDs and account names; confirm no file from a factory image is in any artifact. The stage also reads the root image's `/etc`, `/root` and our own directories and the release initramfs; serials, SSIDs and account names come from a private list outside the repository (`~/.config/omamobile/release-identifiers`, one per line). `tools/release scan FILE...` checks any file the same way. diff --git a/packages/omamobile-shell/README.md b/packages/omamobile-shell/README.md index 71f4ac874..f811a1453 100644 --- a/packages/omamobile-shell/README.md +++ b/packages/omamobile-shell/README.md @@ -100,6 +100,6 @@ Open, save and choose-a-folder requests through the portal (Qt, GTK, Electron an `hypr/phone.lua` maximizes every app between the bar and the dock, with no gaps, no border and full opacity (Omarchy's 0.96-0.985 let the home widgets show through). When the maximized window closes, the next one takes the screen (`misc:exit_window_retains_fullscreen`). Modal dialogs float centred at their own size, never bigger than the screen; picture-in-picture is 300x169 in the top-right corner. `omamobile-setup-user` sets the monitor scale to 3 with `GDK_SCALE` to match, gives foot 6 px padding, a scrollback multiplier of 3 and a 300 ms long press, and adds Chromium's Wayland input-method flags, each once and only over Omarchy's own values. -The package contract follows omarchy-mac's: `./install DESTDIR` stages files and enables nothing, `test/all` runs the package's own tests, and `version` holds the version. +The package contract follows omarchy-mac's: `./install DESTDIR` stages files and enables nothing, `test/all` runs the package's own tests, and `version` holds the version series (`tools/pkg-version` counts the rest from `main`'s history). Develop on a desktop with `phone/dev/run-desktop` from the repo root. From 025a4e6b15bdd62d8076bab72ef0b0ee0689dc83 Mon Sep 17 00:00:00 2001 From: saiththerobo Date: Thu, 12 Nov 2026 10:44:41 +0000 Subject: [PATCH 11/19] tests: release-signing and pinned-packages copy pkg-tar.sh and pkg-version Both run tools/build-packages in a copy of the repository, which since tools/pkg-version sources tools/lib/pkg-tar.sh. The copies lacked it, so build-packages stopped at its source line ("No such file or directory") and release-signing's first refusal check failed in CI. Both skip on a machine without repo-add, which is how this was missed before the push. Co-Authored-By: Claude Opus 5.5 --- tests/pinned-packages | 4 ++-- tests/release-signing | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/pinned-packages b/tests/pinned-packages index edf58de52..d7aa5d577 100755 --- a/tests/pinned-packages +++ b/tests/pinned-packages @@ -29,8 +29,8 @@ cleanup() { trap cleanup EXIT mkdir -p "$R/tools/lib" "$R/rootfs" "$R/packages/omamobile-keyring" "$R/keys" "$t/up" "$t/imp" -cp tools/build-packages "$R/tools/" -cp tools/lib/alarm.sh tools/lib/signing.sh "$R/tools/lib/" +cp tools/build-packages tools/pkg-version "$R/tools/" +cp tools/lib/alarm.sh tools/lib/signing.sh tools/lib/pkg-tar.sh "$R/tools/lib/" run() { (cd "$R" && "$@") > "$t/log" 2>&1; } # The release key as tools/release-key-init makes it, trusted by the keyring diff --git a/tests/release-signing b/tests/release-signing index c2252c1c0..8e4b6dca8 100755 --- a/tests/release-signing +++ b/tests/release-signing @@ -27,8 +27,8 @@ cleanup() { trap cleanup EXIT mkdir -p "$R/tools/lib" "$R/packages/omamobile-keyring" "$R/keys" "$R/out/repo/aarch64" "$t/bin" -cp tools/build-packages tools/repo-publish "$R/tools/" -cp tools/lib/alarm.sh tools/lib/signing.sh "$R/tools/lib/" +cp tools/build-packages tools/repo-publish tools/pkg-version "$R/tools/" +cp tools/lib/alarm.sh tools/lib/signing.sh tools/lib/pkg-tar.sh "$R/tools/lib/" run() { (cd "$R" && PATH="$t/bin:$PATH" "$@") > "$t/log" 2>&1; } # The original key: one signing key. The release key as tools/release-key-init From e289d29e6db7bd1ccd985e54b039242ab3e68f5c Mon Sep 17 00:00:00 2001 From: saiththerobo Date: Thu, 12 Nov 2026 16:04:26 +0000 Subject: [PATCH 12/19] tools/pkg-version: the count starts at the package's own opt-in Review of #690: the count started at the commit that added the tool, found by its path, so moving tools/pkg-version restarted every count from the stale version files (0.2.130 back to 0.2.126, a published number for other contents, with nothing failing). And OMAMOBILE_PKGVER_SINCE, meant for the history replay, moved every counted version when it was set in a build's environment. A commit now counts when its PKGBUILD, as that commit has it, reads .pkgver; before that the version file is the version. The start is the package's opt-in, which a move of the tool can't change: moving it touches the PKGBUILDs, one more number. A package that keeps a written version simply never counts. The replay takes --count-from on the command line, with --history only; the environment variable is gone. pkg_tar finds a counted PKGBUILD by the same .pkgver line. tests/pkg-version adds a package that keeps its written version, a move of the tool, the old variable ignored and --count-from refused outside --history. tests/all runs the suite and parses the tool on lines of their own at the end, not in the long for lines. Co-Authored-By: Claude Opus 5.5 --- tests/all | 8 +++-- tests/pkg-version | 60 +++++++++++++++++++++++++------- tools/lib/pkg-tar.sh | 4 +-- tools/pkg-version | 83 ++++++++++++++++++++++++-------------------- 4 files changed, 101 insertions(+), 54 deletions(-) diff --git a/tests/all b/tests/all index fec93d682..7cc78bed5 100755 --- a/tests/all +++ b/tests/all @@ -33,7 +33,7 @@ set -euo pipefail cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." for f in tools/install-phone tools/phone-provision tools/nv-backup tools/build-rootfs tools/build-packages tools/make-bundle \ tools/local-key-init tools/fetch-published tools/fetch-toolchain tools/repo-publish tools/repo-build tools/release tools/release-upload tools/server/releases-nginx.sh \ - tools/lib/alarm.sh tools/lib/alarm-setup tools/lib/signing.sh tools/lib/bundle-tar.sh tools/lib/usage.sh tools/pkg-version tools/lib/pkg-tar.sh rootfs/build-inside rootfs/resolve.sh tests/*; do + tools/lib/alarm.sh tools/lib/alarm-setup tools/lib/signing.sh tools/lib/bundle-tar.sh tools/lib/usage.sh rootfs/build-inside rootfs/resolve.sh tests/*; do [[ -f $f ]] || continue # tests/owl is the OWL conformance suite's folder [[ $f == *.py ]] && continue bash -n "$f" || { echo "not ok - $f parses" >&2; exit 1; } @@ -49,7 +49,7 @@ python3 tests/boot-arch-label.py python3 tests/persistent-root-boot.py python3 tests/initramfs-root-policy.py python3 tests/bt-uart-gpio.py -for t in tests/pr-check tests/kernel-pr-check tests/phone-smoke tests/alarm-wake-test tests/install-phone tests/build-rootfs tests/rootfs-resolve tests/phone-provision tests/nv-backup tests/initramfs-grow tests/images-layout tests/boot-update-parity tests/stage-boot-files tests/build-packages-host-tools tests/initramfs-reproducible tests/device-overlays tests/simplefb-trigger tests/initramfs-steps tests/storage-guard tests/usb-product tests/grep-q-pipes tests/boot-method tests/modules-push tests/make-bundle-keys tests/make-bundle tests/release-signing tests/pinned-packages tests/flame-probe tests/dipper-probe packages/omamobile-firstboot/test/all packages/omamobile-device-felix/test/all packages/omamobile-device-lynx/test/all packages/omamobile-device-panther/test/all tests/local-builds tests/phone-install-package tests/publish-kernel tests/fetch-toolchain tests/release-upload tests/extract-camera-data tests/release tests/lineage-ref tests/repo-publish tests/repo-publish-stage tests/extract-vendor-firmware tests/alpine-fetch-callers tests/alpine-fetch tests/tools-help tests/install-phone-initramfs tests/pkg-version; do +for t in tests/pr-check tests/kernel-pr-check tests/phone-smoke tests/alarm-wake-test tests/install-phone tests/build-rootfs tests/rootfs-resolve tests/phone-provision tests/nv-backup tests/initramfs-grow tests/images-layout tests/boot-update-parity tests/stage-boot-files tests/build-packages-host-tools tests/initramfs-reproducible tests/device-overlays tests/simplefb-trigger tests/initramfs-steps tests/storage-guard tests/usb-product tests/grep-q-pipes tests/boot-method tests/modules-push tests/make-bundle-keys tests/make-bundle tests/release-signing tests/pinned-packages tests/flame-probe tests/dipper-probe packages/omamobile-firstboot/test/all packages/omamobile-device-felix/test/all packages/omamobile-device-lynx/test/all packages/omamobile-device-panther/test/all tests/local-builds tests/phone-install-package tests/publish-kernel tests/fetch-toolchain tests/release-upload tests/extract-camera-data tests/release tests/lineage-ref tests/repo-publish tests/repo-publish-stage tests/extract-vendor-firmware tests/alpine-fetch-callers tests/alpine-fetch tests/tools-help tests/install-phone-initramfs; do echo "# $t" "$t" done @@ -84,3 +84,7 @@ echo "# tests/factory-index" # the build index of Google's factory images, aga tests/factory-index echo "# tests/phone-demo-notes" tests/phone-demo-notes +echo "# tests/pkg-version" # the counted package versions, and the tool and its library parse +bash -n tools/pkg-version +bash -n tools/lib/pkg-tar.sh +tests/pkg-version diff --git a/tests/pkg-version b/tests/pkg-version index c963cf1eb..3b3496de3 100755 --- a/tests/pkg-version +++ b/tests/pkg-version @@ -1,12 +1,13 @@ #!/bin/bash # SPDX-License-Identifier: MIT # tools/pkg-version (and tools/lib/pkg-tar.sh) against a throwaway repository: -# the count from the commit that added the tool, a third number as a floor -# only, two PRs that wrote the same number, a new series, branch builds, and -# the refusals without history. Then a replay of this repository's own -# history as if the count had started at its first commit: no package may -# keep or lower its version across a commit that touched it, or fall below -# the number its version file gave. +# the count from the commit whose PKGBUILD opts in, a third number as a floor +# only, two PRs that wrote the same number, a new series, branch builds, a +# package that keeps a written version, a moved tool, and the refusals +# without history. Then this repository's own rules (boot-file packages keep +# written versions) and a replay of its history as if the count had started +# at its first commit: no package may keep or lower its version across a +# commit that touched it, or fall below the number its version file gave. set -euo pipefail here=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd) t=$(mktemp -d) @@ -32,19 +33,23 @@ change code; commit "demo: a change that forgot its bump" cp "$here/tools/lib/pkg-tar.sh" tools/lib/ echo "pkgname=demo" > packages/demo/PKGBUILD cat >> packages/demo/PKGBUILD <<'EOF' -pkgver=$(cat "${startdir:-.}/.pkgver" 2>/dev/null || "${startdir:-.}/../../tools/pkg-version" "${startdir:-.}") +pkgver=$(cat "${startdir:-.}/version") pkgrel=1 EOF commit "demo: a PKGBUILD" is "$(git show HEAD~1:packages/demo/version)" 0.2.5 "fixture" +cp -r packages/demo packages/kept; commit "kept: a package that keeps its written version" -# The tool lands: the count starts here, from the file as it stood. +# The tool lands; nothing counts until a PKGBUILD reads .pkgver. cp "$here/tools/pkg-version" tools/; commit "tools/pkg-version" is "$(pv demo)" 0.2.5 "the commit that adds the tool doesn't change a package's version" +sed -i 's|^pkgver=.*|pkgver=$(cat "${startdir:-.}/.pkgver" 2>/dev/null \|\| "${startdir:-.}/../../tools/pkg-version" "${startdir:-.}")|' packages/demo/PKGBUILD +commit "demo: read the counted version" +is "$(pv demo)" 0.2.6 "the commit that opts in is the next number after the published one" change code; commit "demo: a change, no bump" -is "$(pv demo)" 0.2.6 "a commit touching the package is the next number" +is "$(pv demo)" 0.2.7 "a commit touching the package is the next number" echo 0.2.6 > packages/demo/version; change code; commit "demo 0.2.6: an old-style bump to a taken number" -is "$(pv demo)" 0.2.7 "a third number at or below the count changes nothing" +is "$(pv demo)" 0.2.8 "a third number at or below the count changes nothing" echo 0.2.20 > packages/demo/version; commit "demo 0.2.20: a jump" is "$(pv demo)" 0.2.20 "a higher third number is a floor" c20=$(git rev-parse HEAD) @@ -56,9 +61,16 @@ change code; commit "demo: a change" is "$(pv demo)" 0.3.1 "and counts on" is "$(pv --commit demo 0.2.20)" "$c20" "--commit finds the commit a version was built from" is "$(pv --commit demo 0.2.5)" "$(git rev-list --max-parents=0 HEAD)" "--commit finds a version from before the tool" -is "$(pv --history demo | wc -l)" 9 "--history lists every commit that touched the package" +is "$(pv --history demo | wc -l)" 10 "--history lists every commit that touched the package" pv --commit demo 0.9.9 >/dev/null && fail "an unknown version is refused" ok "an unknown version is refused" +change code kept; commit "kept: a change, no bump" +is "$(pv kept)" 0.2.5 "a package whose PKGBUILD doesn't read .pkgver keeps its written version" +echo 0.2.6 > packages/kept/version; commit "kept 0.2.6" +is "$(pv kept)" 0.2.6 "and takes the next one when it is written" +is "$(OMAMOBILE_PKGVER_SINCE=$(git rev-list --max-parents=0 HEAD) pv demo)" 0.3.1 "the old start override in the environment changes nothing" +pv --count-from HEAD demo >/dev/null && fail "--count-from is refused without --history" +ok "--count-from is refused without --history" # Two PRs both write 0.3.2, squash-merged one after the other: the merge # shows no conflict, and each lands with its own number. @@ -78,6 +90,16 @@ git checkout -q -b pr-c; change c; commit "c1"; change c; commit "c2" git checkout -q main; git merge -q --no-ff -m "Merge pr-c" pr-c is "$(pv demo)" 0.3.4 "a merge commit counts once, not per commit it brings" +# The tool moves (and its PKGBUILD line with it): one more number, never a +# restart from the stale version file. +git checkout -q -b moved +mkdir -p tools/bin && git mv tools/pkg-version tools/bin/pkg-version +sed -i 's|tools/pkg-version|tools/bin/pkg-version|' packages/demo/PKGBUILD; commit "tools: move pkg-version" +is "$(tools/bin/pkg-version --main moved demo)" 0.3.5 "moving the tool is one more number" +change code; commit "demo: after the move" +is "$(tools/bin/pkg-version --main moved demo)" 0.3.6 "and the count goes on" +git checkout -q main + # Branch builds against main. git checkout -q -b other; echo x > README.md; commit "elsewhere" is "$(pv demo)" 0.3.4 "a branch that doesn't touch the package builds main's version" @@ -193,6 +215,18 @@ done ((ran >= 5)) || fail "only $ran of $shipped installs ran here" ok "the $shipped packages that ship a version file hand it pkgver, and the $ran installs that run here write it" +# A package that ships boot files keeps a written version (they reach +# release phones' slot B only after the maintainer has booted them). +boot=0 +for i in packages/*/install; do + grep -c OMAMOBILE_BOOT_FILES "$i" >/dev/null || continue + p=$(basename "$(dirname "$i")") + grep -c -F '/.pkgver"' "packages/$p/PKGBUILD" >/dev/null && fail "$p ships boot files and counts its version" + boot=$((boot + 1)) +done +((boot >= 1)) || fail "no package ships boot files: the pattern no longer matches" +ok "the $boot package(s) that ship boot files keep a written version" + # This repository's own history, replayed from its first commit. if [[ $(git rev-parse --is-shallow-repository) == true ]]; then ok "# skip: a shallow clone has no history to replay" @@ -201,7 +235,7 @@ fi first=$(git rev-list --max-parents=0 HEAD | tail -1) checked=0 commits=0 for f in packages/*/PKGBUILD; do - grep -qF tools/pkg-version "$f" || continue + grep -c -F '/.pkgver"' "$f" >/dev/null || continue p=$(basename "$(dirname "$f")") prev= while read -r c v; do @@ -214,7 +248,7 @@ for f in packages/*/PKGBUILD; do [[ $(printf '%s\n' "$file" "$v" | sort -V | tail -1) == "$v" ]] || fail "$p: $v at $c is below its file's $file" fi prev=$v commits=$((commits + 1)) - done < <(OMAMOBILE_PKGVER_SINCE=$first tools/pkg-version --main HEAD --history "$p") + done < <(tools/pkg-version --main HEAD --history --count-from "$first" "$p") checked=$((checked + 1)) done ok "replayed $checked packages over $commits commits from the first one: every commit a new number, none below its file's" diff --git a/tools/lib/pkg-tar.sh b/tools/lib/pkg-tar.sh index de5b933b3..274d241e1 100644 --- a/tools/lib/pkg-tar.sh +++ b/tools/lib/pkg-tar.sh @@ -4,7 +4,7 @@ # history (the build container, the phone): the directory as it is # (including gitignored prebuilt files the PKGBUILDs install), minus # makepkg's work directories and old packages, plus .pkgver with the version -# tools/pkg-version works out here, for PKGBUILDs that ask it. +# tools/pkg-version works out here, for PKGBUILDs that read it. # # source tools/lib/pkg-tar.sh # pkg_tar packages/ | tar xf - -C DEST @@ -14,7 +14,7 @@ pkg_tar() { local dir=${1%/} name tmp v='' extra=() name=$(basename "$dir") - if grep -qF 'tools/pkg-version' "$dir/PKGBUILD"; then + if grep -c -F '/.pkgver"' "$dir/PKGBUILD" >/dev/null; then v=$("$(dirname -- "${BASH_SOURCE[0]}")/../pkg-version" "$dir") || return 1 fi tmp=$(mktemp -d) diff --git a/tools/pkg-version b/tools/pkg-version index 51ddeb594..79338363e 100755 --- a/tools/pkg-version +++ b/tools/pkg-version @@ -7,6 +7,9 @@ # tools/pkg-version --history PACKAGE " " for every # commit on main's line that # touched the package +# tools/pkg-version --history --count-from C PACKAGE the same, as if every +# commit from C counted (tests +# replay history with it) # tools/pkg-version --commit PACKAGE VERSION the commit that version was built from # # PACKAGE is a name (omamobile-shell) or its directory (packages/omamobile-shell). @@ -17,9 +20,16 @@ # main (the first-parent line of REF, default origin/main) every commit that # touches packages/ is the next number in the series, so two merges can # never ship one number with different contents, and a merge needs no version -# change at all. The count starts at the commit that added this tool, from the -# version file as it stood then, so no number already published comes back. -# Writing a new series (0.3) starts it at 0 (or at its third number, if given). +# change at all. Writing a new series (0.3) starts it at 0 (or at its third +# number, if given). +# +# A commit counts only when its PKGBUILD reads .pkgver, the version this tool +# hands a build: the package opts in, not the tool. Before that the version +# file is the version, as it was published, and the first commit that opts in +# is the next number after it, so no published number comes back. Where this +# tool lives doesn't matter (moving it can't restart a count), and a package +# that keeps a written version (the kernel, the keyring, a device package that +# ships boot files) never counts. # # Off main, a build is main's version at the merge base, then the branch's # own commits that touch the package and the commit: 0.2.130.1.g4f2a9c1. @@ -39,17 +49,20 @@ # repo-build, phone-install-package) run it here first and put the result in # the copy as .pkgver, which the PKGBUILDs read before asking git. # -# OMAMOBILE_PKGVER_SINCE= moves the start of the count (tests replay -# history with it); OMAMOBILE_MAIN_REF sets REF like --main. +# OMAMOBILE_MAIN_REF sets REF like --main. On a fork, point it at this +# repository's main (git fetch upstream; OMAMOBILE_MAIN_REF=upstream/main): +# a fork's own main that is behind gives branch builds that sort below the +# published packages. set -euo pipefail die() { echo "pkg-version: $*" >&2; exit 1; } -main=${OMAMOBILE_MAIN_REF:-} rev=HEAD explicit_rev='' mode=version want= +main=${OMAMOBILE_MAIN_REF:-} rev=HEAD explicit_rev='' mode=version want= count_from= while (($#)); do case $1 in --main) main=${2:?--main needs a ref}; shift 2 ;; --rev) rev=${2:?--rev needs a commit} explicit_rev=1; shift 2 ;; --history) mode=history; shift ;; + --count-from) count_from=${2:?--count-from needs a commit}; shift 2 ;; --commit) mode=commit; shift ;; -h|--help) source "$(dirname -- "${BASH_SOURCE[0]}")/lib/usage.sh"; usage_from_header "$0"; exit 0 ;; -*) die "unknown option $1" ;; @@ -59,6 +72,8 @@ done (($# >= 1)) || die "usage: tools/pkg-version [--main REF] [--rev REV] PACKAGE" pkg=${1%/}; pkg=${pkg##*/} [[ $mode != commit ]] || want=${2:?--commit needs PACKAGE VERSION} +# Only for a listing: a build's version never depends on it +[[ -z $count_from || $mode == history ]] || die "--count-from goes with --history only" [[ $pkg =~ ^[a-z0-9][a-z0-9.+_-]*$ ]] || die "not a package name: $1" # The repository: the package directory's, else this tool's. @@ -69,7 +84,6 @@ cd -- "$top" [[ $(git rev-parse --is-shallow-repository) == false ]] || die "a shallow clone can't count versions: git fetch --unshallow" path=packages/$pkg -self=tools/pkg-version if [[ -z $main ]]; then for main in origin/main main ''; do @@ -89,47 +103,42 @@ parse() { } file_at() { git show "$1:$path/version" 2>/dev/null; } -# Where the count starts on C's first-parent line: the commit that added this -# tool (or OMAMOBILE_PKGVER_SINCE), empty if C comes before it. -since() { - local c=$1 k - if [[ -n ${OMAMOBILE_PKGVER_SINCE:-} ]]; then - k=$(git rev-parse --verify "$OMAMOBILE_PKGVER_SINCE^{commit}") || die "no such commit $OMAMOBILE_PKGVER_SINCE" - git merge-base --is-ancestor "$k" "$c" && echo "$k" - return 0 +# Does commit F's PKGBUILD read .pkgver (its version counted)? With +# --count-from, every commit in FROM (filled by walk) counts instead. +counts() { + if [[ -n $count_from ]]; then + [[ -n ${from[$1]:-} ]] + return fi - git rev-list --first-parent "$c" -- "$self" | tail -1 # tail: head would SIGPIPE git under pipefail + git show "$1:$path/PKGBUILD" 2>/dev/null | grep -c -F '/.pkgver"' >/dev/null } # " " for each commit on C's first-parent line touching the -# package, oldest first. Before the start of the count the version file is -# the version, as it was published. +# package, oldest first. A commit that doesn't count has its version file's +# number, as it was published. walk() { - local c=$1 k s z S="" v=-1 f - k=$(since "$c") - local -a before=() after=() - if [[ -z $k ]]; then - mapfile -t before < <(git rev-list --first-parent --reverse "$c" -- "$path") - else - mapfile -t before < <(git rev-list --first-parent --reverse "$k^" -- "$path" 2>/dev/null) - mapfile -t after < <(git rev-list --first-parent --reverse "$k^..$c" -- "$path" 2>/dev/null || - git rev-list --first-parent --reverse "$c" -- "$path") + local c=$1 f s z S="" v=-1 + local -A from=() + if [[ -n $count_from ]]; then + local k + k=$(git rev-parse --verify "$count_from^{commit}") || die "no such commit $count_from" + if git merge-base --is-ancestor "$k" "$c"; then + while read -r f; do + from[$f]=1 + [[ $f != "$k" ]] || break + done < <(git rev-list --first-parent "$c") + fi fi - for f in "${before[@]}"; do - read -r s z < <(parse "$(file_at "$f")") || continue - S=$s v=${z:-0} - echo "$f $S.$v" - done - for f in "${after[@]}"; do + while read -r f; do read -r s z < <(parse "$(file_at "$f")") || continue - if [[ $s != "$S" ]]; then - S=$s v=${z:-0} - else + if [[ $s == "$S" ]] && counts "$f"; then v=$((v + 1)) [[ -z $z ]] || ((z <= v)) || v=$z + else + S=$s v=${z:-0} fi echo "$f $S.$v" - done + done < <(git rev-list --first-parent --reverse "$c" -- "$path") } case $mode in From e10d3956ba2ce67ec34fb3aedf232c4a8e6bdefa Mon Sep 17 00:00:00 2001 From: saiththerobo Date: Thu, 12 Nov 2026 16:04:26 +0000 Subject: [PATCH 13/19] omamobile-device-cheetah: keep a written version for its boot files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Review of #690: this package carries the boot files release phones write to slot B, and its version is the maintainer's switch: changes to initramfs/init or src/ merge without one, and the version is written only after an image built from them has booted on the 7 Pro. Counted, any merge under the package (a README included) would have been a new version at the next nightly, and tools/release's hint brought the hand-written number back for exactly this case. Its PKGBUILD reads version again, so tools/pkg-version never counts it, like linux-omamobile and omamobile-keyring; tests/pkg-version fails if a package with OMAMOBILE_BOOT_FILES in its install reads .pkgver. tools/release and RELEASES' images stage are main's again (bump the version). RELEASES §7.1 says how the count starts (29 packages), and drops the sentence retiring review lessons, which is the maintainer's to change; CONTRIBUTING says how a fork counts against this repository's main (OMAMOBILE_MAIN_REF). Co-Authored-By: Claude Opus 5.5 --- AGENTS.md | 2 +- CONTRIBUTING.md | 2 +- docs/RELEASES.md | 8 +++----- packages/omamobile-device-cheetah/PKGBUILD | 5 ++++- tools/release | 22 ++++------------------ 5 files changed, 13 insertions(+), 26 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 952b43013..51464f125 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -56,7 +56,7 @@ Omarchy Mobile runs native Omarchy (Arch Linux ARM, Hyprland, Omarchy's packages ``` This leaves other people's staged and unstaged changes alone. -- **Package versions are counted, never written** ([CONTRIBUTING](CONTRIBUTING.md) §6.3): don't change a package's `version` file except to start a new series, and don't put a version in a commit subject. A doc or plan written in a pull request can't know the number its change will ship as: name the pull request or the commit, and add the number (`tools/pkg-version --history `) once `main` has it. Versions already in the docs (`omamobile-modem` 0.1.15+) are published ones and stay right. The packages built from another project's release (Mesa, Hyprland, libcamera and the others whose PKGBUILD sets `pkgver` itself), `linux-omamobile` and `omamobile-keyring` still carry hand-written versions. +- **Package versions are counted, never written** ([CONTRIBUTING](CONTRIBUTING.md) §6.3): don't change a package's `version` file except to start a new series, and don't put a version in a commit subject. A doc or plan written in a pull request can't know the number its change will ship as: name the pull request or the commit, and add the number (`tools/pkg-version --history `) once `main` has it. Versions already in the docs (`omamobile-modem` 0.1.15+) are published ones and stay right. The packages built from another project's release (Mesa, Hyprland, libcamera and the others whose PKGBUILD sets `pkgver` itself), `linux-omamobile`, `omamobile-keyring` and `omamobile-device-cheetah` (its boot files get a version only after they have booted on the 7 Pro) still carry hand-written versions. - **Moving a feature from bring-up into a package:** enable nothing that isn't hang-safe, and delete the bring-up files from `/etc/modprobe.d` on the phone (`omamobile-*-bringup.conf`, and any hand-copied package file). A file in `/etc/modprobe.d` replaces the package's `/usr/lib/modprobe.d` file of the same name, so a stale `omamobile-aoc.conf` there hid the package's new blacklist. - **Kernel releases change with every push** (`7.3.0-rc6-omamobile-push1-NNNNN-g`). `bin/omamobile push` runs `modules-push` when the tarball's checksum differs. Without its modules a new kernel boots without its drivers, the GPU among them. `modules-push` replaces `/usr/lib/modules/` as a whole; on the 9a that once took a hand-installed panel driver with it, and the display stayed on the boot logo. It now refuses when the folder holds modules added or swapped by hand since the last push (it records what each push installed in `.omamobile-modules.sha256`), and `OMAMOBILE_MODULES_REPLACE=1` overrides that, wiping them. Pin a daily release whose folder carries hand-installed modules (`/usr/lib/modules/.omamobile-pinned`), and keep a copy before overriding (`tar -C /usr/lib/modules -cf … `). - **Stop the modem before a `push` or a `reboot-to`.** `push` ends in `reboot-to`, a raw reboot syscall that stops no unit, so `omamobile-modem.service` never runs its clean stop and its `modem-up` marker stays. On the 7 Pro, where the modem starts at boot (device-cheetah 0.1.43+), the next boot counts that as an unclean end ("ended without a clean stop: a hang or a reset"); from `omamobile-modem` 0.1.19 it starts the modem all the same (before, it skipped the modem once), and a second such end before a clean stop holds it off until `omamobile-modem-start --retry`. So a skipped stop no longer costs a boot's modem, but it uses up the one unclean end the guard allows. This happened on 2026-11-08 after a `reboot-to bootloader` taken to charge a flat battery. So run `systemctl stop omamobile-modem` first, as part of the reboot the human said yes to; a reboot that needs no reason can be `systemctl reboot` instead, which stops it. The stop powers the CP off (one recovered UFS error-handler pass, as any reboot with the modem up costs) and, with the NV overlay on, captures its writes. For now it takes about 40 s and ends as "failed", with the CP's power-off logged as a crash; the marker is still removed ([#532](https://github.com/derekross/omarchy-mobile/issues/532)). This is not the restart the modem notes below forbid: nothing starts the modem again before the reboot. From `omamobile-modem` 0.1.21, with a device package whose `reboot-to` notes the boot it ends ([#403](https://github.com/derekross/omarchy-mobile/pull/403)), the next boot doesn't count a marker from that boot, so a `reboot-to` no longer uses up the unclean end (one already counted stays counted); the CP's ordered power-off and the NV capture still come only from the unit's stop, so the rule stands. [MODEM-PLAN](device/cheetah/MODEM-PLAN.md) M4.6b diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 35525f14d..aa91f6d94 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -306,7 +306,7 @@ Findings that matter beyond one subsystem go into `device//NOTES.md`, ### 6.3 This repository - **Commit subjects** name the area, then say what changed: `omamobile-gnss: package GNSS with location on demand`, `omamobile-device-cheetah: reconnect USB after a replug`, `DISPLAY-PLAN: D3b-1b result, …`, `NOTES: …`. No package version: it is counted when the change lands on `main`. -- **Package versions are counted, not written.** Leave `version` alone: [`tools/pkg-version`](tools/pkg-version) gives every commit on `main` that touches a package the next number of its series (the first two numbers in `version`), so two merges can't ship one number. A build off `main` gets `..g`, which `pacman` orders between `main`'s builds, and edits not committed yet add `.d`, a new version for each edit, so `tools/build-packages` rebuilds them without `--force`. Change `version` only to start a new series (`0.2` to `0.3`); a third number there is read as a floor and nothing else, so an old-style bump does no harm. A dependency on a change that isn't on `main` yet can't name its number: depend on a version `main` has already shipped, or on a name the other package `provides`. The same goes for docs: name a version only once `main` has shipped it (`tools/pkg-version --history ` lists them), and the pull request until then. Packages built from another project's release (Mesa, Hyprland, libcamera and the others whose PKGBUILD sets `pkgver` itself), `linux-omamobile` and `omamobile-keyring` keep hand-written versions: raise `pkgrel` (or the kernel package's `version`, which is its `pkgrel`) for a packaging change. How the project moved from written to counted versions, and what happens to pull requests opened before, is in [RELEASES](docs/RELEASES.md) §7.1. +- **Package versions are counted, not written.** Leave `version` alone: [`tools/pkg-version`](tools/pkg-version) gives every commit on `main` that touches a package the next number of its series (the first two numbers in `version`), so two merges can't ship one number. A build off `main` gets `..g`, which `pacman` orders between `main`'s builds, and edits not committed yet add `.d`, a new version for each edit, so `tools/build-packages` rebuilds them without `--force`. Change `version` only to start a new series (`0.2` to `0.3`); a third number there is read as a floor and nothing else, so an old-style bump does no harm. A dependency on a change that isn't on `main` yet can't name its number: depend on a version `main` has already shipped, or on a name the other package `provides`. The same goes for docs: name a version only once `main` has shipped it (`tools/pkg-version --history ` lists them), and the pull request until then. Packages built from another project's release (Mesa, Hyprland, libcamera and the others whose PKGBUILD sets `pkgver` itself), `linux-omamobile`, `omamobile-keyring` and device packages that ship boot files (`OMAMOBILE_BOOT_FILES` in `install`: `omamobile-device-cheetah`, whose version the maintainer writes after the boot files have booted on the 7 Pro) keep hand-written versions: raise `pkgrel` (or the kernel package's `version`, which is its `pkgrel`) for a packaging change. On a fork whose own `main` is behind, count against this repository's: `git fetch upstream`, then `OMAMOBILE_MAIN_REF=upstream/main`, or a test build sorts below the published package. How the project moved from written to counted versions, and what happens to pull requests opened before, is in [RELEASES](docs/RELEASES.md) §7.1. - **Bodies** explain the why and what was tested. Wrap at 72 columns. If an AI assistant co-wrote the commit, end with a `Co-Authored-By:` trailer, as the history does. - **Every file has an SPDX header** (§7). - **Describe what something is built from, not which other project it's based on.** Docs, the README, device notes and the website don't name or compare other mobile Linux projects or distributions: say "Arch Linux ARM with the `linux-megi` kernel", not "based on X". Citing a properly licensed source for a fact (upstream Linux, Google's GPL kernel, postmarketOS, Mesa, Omarchy) is fine, and expected. diff --git a/docs/RELEASES.md b/docs/RELEASES.md index 71f7b86d2..6179d2c83 100644 --- a/docs/RELEASES.md +++ b/docs/RELEASES.md @@ -422,17 +422,15 @@ A release never contains a kernel or package that isn't in `[omamobile]` at the ### 7.1 From written to counted package versions -Until the pull request that added `tools/pkg-version` (issue #689), each pull request wrote its package's next version into `version` by hand. Two open pull requests could write the same number and both merge, and a stacked or rebased one had to be renumbered at every merge. The count replaces that for every package whose PKGBUILD reads it; the others keep hand-written versions (CONTRIBUTING §6.3). +Until the pull request that added `tools/pkg-version` (issue #689), each pull request wrote its package's next version into `version` by hand. Two open pull requests could write the same number and both merge, and a stacked or rebased one had to be renumbered at every merge. The count replaces that for every package whose PKGBUILD reads it; the others keep hand-written versions (CONTRIBUTING §6.3), `omamobile-device-cheetah` among them: its boot files reach release phones' slot B, and the maintainer gives them a version only after an image built from them has booted on the 7 Pro. 1. **Before the merge,** each `version` file holds the last number written by hand, which is the version `[omamobile]` publishes. -2. **The merge commit starts the count.** For each package, `tools/pkg-version` takes the version as `main` held it just before that commit, and every later commit on `main`'s first-parent line that touches the package is the next number. The merge commit itself touches all 30 counted packages (their PKGBUILDs), so each moves one number up, and the first development publish after it rebuilds all 30 once (`shell` 0.2.126 to 0.2.127). Nothing is written by hand, and no version that was published comes back. +2. **The merge commit starts the count.** A commit counts when the package's PKGBUILD, as that commit has it, reads `.pkgver` (the version `tools/pkg-version` hands a build); before that, the `version` file is the version. The merge commit makes 29 PKGBUILDs read it, so each of those packages moves one number up from the version `main` held just before, and the first development publish after it rebuilds the 29 once (`shell` 0.2.126 to 0.2.127). Nothing is written by hand, and no version that was published comes back. The start is the package's own opt-in, not the tool's: moving or renaming `tools/pkg-version` touches the PKGBUILDs, which is one more number, never a restart (`tests/pkg-version` moves it). 3. **From then on,** a merge needs no version change. Squash merges, merge commits and direct pushes count once each, in the order they land; a commit that changes only tests or docs under a package counts too. `tools/pkg-version --commit ` finds the commit a published version was built from, and `--history ` lists them all. 4. **Pull requests opened before the change** merge as they are. A `version` hunk at or below the count changes nothing; a number above it is taken as a floor, so the package jumps to it: drop such a hunk at review unless the jump is wanted. A conflict on `version` resolves to `main`'s file. A versioned dependency on another open pull request's number (`depends=('omamobile-shell>=0.2.130')`) may name a number the count gives to something else: check it against `tools/pkg-version` at merge, or depend on a shipped version. 5. **The `version` files keep their old third numbers** for now, so contributors who still bump do no harm while they adjust. They go stale; once the pull requests from before the change have drained, one commit can cut every file to its series (`0.2`). That commit touches every package, so each moves one number up again and is republished once; it is the maintainer's call when. 6. **Going back** to hand-written versions means first writing each package's current version (`tools/pkg-version `) into its `version` file: the files' stale numbers are below what phones have installed, and `pacman` would not upgrade from them. -The review lessons about version collisions and renumbering (L-12, L-217, L-275, L-404, L-426, L-477, L-551, L-640) no longer apply to the counted packages once this lands. - ## 8. The kernel branches - **`omamobile` on GitHub is the one source of the release kernel.** It starts from a squashed commit holding the upstream tag's tree (v7.3-rc6), with every commit after it unchanged, and it only moves forward: pull requests and release tags point at its commit ids, so nothing rewrites or force-pushes it. @@ -494,7 +492,7 @@ Per release, in order. Stop at any failed step. `tools/release` runs the checkli 1. **Kernel** [`kernel`]: a release branch on the current `github/omamobile` holds everything the release needs as curated, signed-off commits (§8); `tools/kernel-pr-check --build OUT --merge github/omamobile ` passes; it boots on each released device, with `uname -r` and the result in that device's NOTES (the stage looks for the exact release, `-omamobile-g`, in `device//NOTES.md` only: a plan's Expect line or a `-push1` build of the commit doesn't count). 2. **Publish and tag** [`kernel`]: `tools/publish-kernel --dry-run --tag kernel- `, read what it would push, then run it without `--dry-run`. If it stops because `omamobile` moved, rebase, test what changed, and repeat. The stage checks that the annotated tag is on GitHub's `omamobile` and that the release worktree (`$KERNEL_BASE/wt-release`) is exactly that commit and clean. 3. **Build** [`build`] the kernel from the tag in the pinned container with the pinned clang (the stage checks `toolchain.txt`), release `LOCALVERSION` (`bin/omamobile kernel --release`), into the fixed `$KERNEL_BASE/out-kernel-release` (byte-identical builds need the same paths; the stage refuses that directory when it holds anything but a release build); stage `linux-omamobile` from it (`packages/linux-omamobile/stage`, §4). -4. **Images** [`images`] for every device: `DEVICE= bin/omamobile initramfs --release`, then `DEVICE= bin/omamobile images`, twice, checksums equal; then the device package's boot files (§5), for a device package whose `install` ships them (`OMAMOBILE_BOOT_FILES`): kept when `tools/stage-boot-files --check` finds them current, since the device package in `out/repo` was built from them, and then the boot images are built from their initramfs, so the bundle boots the bytes every phone's hook writes later; when they are stale, staged again only for a new device-package version (when `out/repo` already has the current one, the stage asks for a commit under the device package, which `tools/pkg-version` counts as the next version; boot files are gitignored, so staging them alone gives none), then `tools/build-packages packages/`. +4. **Images** [`images`] for every device: `DEVICE= bin/omamobile initramfs --release`, then `DEVICE= bin/omamobile images`, twice, checksums equal; then the device package's boot files (§5), for a device package whose `install` ships them (`OMAMOBILE_BOOT_FILES`): kept when `tools/stage-boot-files --check` finds them current, since the device package in `out/repo` was built from them, and then the boot images are built from their initramfs, so the bundle boots the bytes every phone's hook writes later; when they are stale, staged again only for a new device-package version (the stage asks for the bump when `out/repo` already has the current one), then `tools/build-packages packages/`. 5. **Packages** [`packages`]: every changed package has a new version (counted by `tools/pkg-version`; `tools/repo-publish` refuses a branch build, `.g`, or one of uncommitted edits, `.d`), its `test/all` passes, `tools/build-packages` builds and signs them and the database on the laptop (`tools/repo-build` on a phone only as an opt-in shortcut). The stage checks that `out/repo` is signed by the release key, holds every package the image installs at this checkout's version, and that development publishes exactly it (`tools/repo-publish --no-build development`); it pins that index. `linux-omamobile` and `omamobile-boot-update` are among the image's packages (decision 10); `tools/build-packages` builds `linux-omamobile` only when named (`tools/build-packages packages/linux-omamobile`), and the stage checks the device package carries the staged boot files' initramfs. Then [`rootfs`] the root image on the stable channel from the pinned index, carrying both, and [`bundle`] the signed bundle. 6. **Test install** [`test-install`] on each released device, attended (this gates the release, §12.10): the signed bundle's `install` on a phone whose stock slot A and backups are known good; first boot, device package installed, `omarchy update` clean (the installed phone follows stable, and `promote` comes after this step: the stage first asks the server whether stable has an index, and with none, which can only be before the first release to a server, prints the one-time promotion of the pinned index and stops; later releases find the previous release there), then a package-hook kernel update and a reboot into it; on the Pixel 7 Pro with a SIM, after `tools/phone-provision` and the carrier settings, the modem stack comes up at boot on its own ([MODEM-PLAN](../device/cheetah/MODEM-PLAN.md) M4.6b) and the phone registers. The bundle is signed before this step, so the bytes tested are the bytes released; `test-install --passed ""` records it. 7. **Identifiers** [`identifiers`]: grep the bundle, the root image's file list, `MANIFEST` and the release notes for MAC addresses (`[0-9a-f]{2}(:[0-9a-f]{2}){5}`), serial numbers, SSIDs and account names; confirm no file from a factory image is in any artifact. The stage also reads the root image's `/etc`, `/root` and our own directories and the release initramfs; serials, SSIDs and account names come from a private list outside the repository (`~/.config/omamobile/release-identifiers`, one per line). `tools/release scan FILE...` checks any file the same way. diff --git a/packages/omamobile-device-cheetah/PKGBUILD b/packages/omamobile-device-cheetah/PKGBUILD index 642ebd576..6db29a9b7 100644 --- a/packages/omamobile-device-cheetah/PKGBUILD +++ b/packages/omamobile-device-cheetah/PKGBUILD @@ -1,7 +1,10 @@ # SPDX-License-Identifier: MIT # Maintainer: Derek Ross pkgname=omamobile-device-cheetah -pkgver=$(cat "${startdir:-.}/.pkgver" 2>/dev/null || "${startdir:-.}/../../tools/pkg-version" "${startdir:-.}") +# Written by hand, not counted (tools/pkg-version): the boot files this +# package ships go out under a new version only after they have booted on +# the Pixel 7 Pro, and the maintainer writes that version then +pkgver=$(cat "${startdir:-.}/version") pkgrel=1 pkgdesc="Omarchy Mobile support for the Google Pixel 7 Pro (cheetah): boot-slot success, storage guard, USB networking" arch=(aarch64) diff --git a/tools/release b/tools/release index 3fed2d452..354cc6d50 100755 --- a/tools/release +++ b/tools/release @@ -207,20 +207,6 @@ pkg_info() { echo "${epoch:+$epoch:}$pkgver-$pkgrel ${pkgname[*]}" ) } -# The first line Derek is shown when a device package needs a new version -# for new boot files: tools/pkg-version counts any commit under the -# package, and with nothing else to change, writing its next number into -# version (read as a floor) is such a commit -new_version_hint() { - local v - v=$(pkg_info "$1" | cut -d' ' -f1) - v=${v%-*} - if [[ $v =~ ^[0-9]+(\.[0-9]+)+$ ]]; then - echo "# commit a change under packages/$1 (tools/pkg-version counts it; with nothing else to change: echo ${v%.*}.$((${v##*.} + 1)) > packages/$1/version), then:" - else - echo "# commit a change under packages/$1 (tools/pkg-version counts it as a new version), then:" - fi -} # "name version" for every package an index lists db_versions() { bsdtar -xOf "$1" --include='*/desc' | @@ -363,10 +349,10 @@ st_images() { [[ ! -f out/repo/aarch64/omamobile.db.tar.gz ]] || have_v=$(db_versions out/repo/aarch64/omamobile.db.tar.gz | awk -v n="$dpkg" '$1 == n { print $2 }') if [[ $have_v == "$want_v" ]]; then - derek "$(new_version_hint "$dpkg")" \ + derek "# bump packages/$dpkg/version (a new version for new boot files), commit it, then:" \ "tools/release --version $version images # stages them" \ "tools/build-packages packages/$dpkg" - die "$bf is stale or missing and out/repo already has $dpkg $want_v: a new device-package version is needed" + die "$bf is stale or missing and out/repo already has $dpkg $want_v: a device-package version bump is needed" fi KERNEL_OUT=$RELEASE_KERNEL_OUT DEVICE=$DEVICE run tools/stage-boot-files note "staged for $dpkg $want_v (out/repo: ${have_v:-none}); next: tools/build-packages packages/$dpkg" @@ -400,7 +386,7 @@ st_images() { # The device package's dtbo is the bundle's, as its initramfs is if ((kept)) && ships_boot_files; then cmp -s "$bf/dtbo.img" "$RELEASE_KERNEL_OUT/images/dtbo.img" || - die "$bf/dtbo.img differs from the bundle's dtbo.img: the device package and the bundle would boot different dtbos (commit a change under packages/$dpkg for a new version, then run this stage again)" + die "$bf/dtbo.img differs from the bundle's dtbo.img: the device package and the bundle would boot different dtbos (bump packages/$dpkg/version, then run this stage again)" note "the bundle's dtbo.img is the device package's ($bf)" fi # The release initramfs has no builder keys (make-bundle checks it again) @@ -502,7 +488,7 @@ st_packages() { want_sum=$(awk '$2 == "initramfs.cpio.lz4" { print $1 }' "$bf") got_sum=$({ bsdtar -xOf "out/repo/aarch64/$pf" "usr/lib/omamobile/$DEVICE/initramfs.cpio.lz4" 2>/dev/null || true; } | sha256sum | cut -d' ' -f1) [[ -n $want_sum && $got_sum == "$want_sum" ]] || { - derek "$(new_version_hint "$dpkg")" \ + derek "# bump packages/$dpkg/version (same version, other boot files), commit it, then:" \ "tools/release --version $version images # restages the boot files" \ "tools/build-packages packages/$dpkg" die "$pf does not carry the staged release initramfs (packages/$dpkg/boot-files): it was built from other boot files at the same version" From 1984e88a59267bf2da15462699af0c85d8e01151 Mon Sep 17 00:00:00 2001 From: saiththerobo Date: Thu, 12 Nov 2026 16:04:26 +0000 Subject: [PATCH 14/19] omamobile-reviewer: leave the review rules as on main Review of #690: the maintainer changes the reviewer's checklist himself if counted versions land. Co-Authored-By: Claude Opus 5.5 --- .claude/agents/omamobile-reviewer.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.claude/agents/omamobile-reviewer.md b/.claude/agents/omamobile-reviewer.md index 4231ae504..7ab98af20 100644 --- a/.claude/agents/omamobile-reviewer.md +++ b/.claude/agents/omamobile-reviewer.md @@ -128,10 +128,7 @@ that would land wrong. cited; Google's copyright kept on imported code; SPDX headers. - **Conventions:** area prefixes (this repo) or subsystem prefixes from `git log --oneline ` (kernel); bodies that say why with evidence; - no package `version` bump and no version in a subject (`tools/pkg-version` - counts it; a new series only on purpose, a third number above the count - only if the jump is wanted, RELEASES §7.1); no unshipped version named in - docs; a human + package `version` bumped with the version in the subject; a human Signed-off-by on kernel commits and never an AI one; the plan updated with a gated runbook (Expect/Pass, stop condition, rollback, risk) for anything run on a phone. From 8497dcbce662a52ee47ac7332227e7e331f33ae9 Mon Sep 17 00:00:00 2001 From: saiththerobo Date: Thu, 12 Nov 2026 16:10:48 +0000 Subject: [PATCH 15/19] tests/release: main's again, with tools/release tools/release went back to asking for a device-package version bump (the device package that ships boot files keeps a written version), so its test expects main's text again. Co-Authored-By: Claude Opus 5.5 --- tests/release | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tests/release b/tests/release index 226b3f02e..aa4883c81 100755 --- a/tests/release +++ b/tests/release @@ -14,7 +14,7 @@ # (none: the one-time promotion; no answer: stop), # the test-install record, the tag stage refusing notes with placeholders, # the images stage keeping current boot files and asking for a device-package -# new version before restaging stale ones (a stand-in stage-boot-files), +# version bump before restaging stale ones (a stand-in stage-boot-files), # the bundle check against a bundle laid out as make-bundle builds it # (INSTALL.md and make-bundle's provision tools allowed, nothing else), and # the upload stage running the real tools/release-upload --dry-run on a @@ -233,7 +233,7 @@ if run --version "$V" tag; then fail "notes with placeholders are refused"; fi grep -q 'placeholders' "$t/log" || fail "says the notes have placeholders" pass "test-install records only the release kernel on a signed bundle; tag refuses unfinished notes" -# --- images: current boot files are kept; stale ones need a new version --- +# --- images: current boot files are kept; stale ones need a version bump --- # A stand-in for #320's tools/stage-boot-files: --check passes when # $t/bf-current exists; staging is only printed in a dry run mkdir -p "$R/packages/omamobile-boot-update" "$R/packages/omamobile-device-testdev" "$RELEASE_KERNEL_OUT/include/config" @@ -260,17 +260,16 @@ printf 'pkgname = omamobile-device-testdev\npkgbase = omamobile-device-testdev\n repo-add -q omamobile.db.tar.gz omamobile-device-testdev-0.1.5-1-any.pkg.tar.zst) >/dev/null 2>&1 || fail "a repository fixture" mv "$R/out/repo" "$t/repo.saved" && mkdir -p "$R/out/repo" && cp -a "$t/repo2" "$R/out/repo/aarch64" if run --version "$V" --dry-run images; then fail "stale boot files at a version out/repo already has are refused"; fi -grep -q 'a new device-package version is needed' "$t/log" || fail "says a new version is needed" -grep -q 'commit a change under packages/omamobile-device-testdev' "$t/log" || fail "says a commit under the package gives the new version" -grep -q 'echo 0.1.6 > packages/omamobile-device-testdev/version' "$t/log" || fail "prints the next number to write when nothing else changes" -# a new version (out/repo doesn't have it yet): stage, then build it +grep -q 'a device-package version bump is needed' "$t/log" || fail "says a version bump is needed" +grep -q 'bump packages/omamobile-device-testdev/version' "$t/log" || fail "prints the bump and the rebuild" +# a bumped version (out/repo doesn't have it yet): stage, then build it sed -i 's/pkgver=0.1.5/pkgver=0.1.6/' "$R/packages/omamobile-device-testdev/PKGBUILD" run --version "$V" --dry-run images || fail "stale boot files for a new device-package version are staged" grep -q 'would run: tools/stage-boot-files' "$t/log" || fail "stages the boot files for the new version" grep -q 'next: tools/build-packages packages/omamobile-device-testdev' "$t/log" || fail "names the device package to build next" rm -rf "$R/out/repo" && mv "$t/repo.saved" "$R/out/repo" rm -rf "$R/packages/omamobile-boot-update" "$R/packages/omamobile-device-testdev" "$R/tools/stage-boot-files" "$RELEASE_KERNEL_OUT" -pass "images keeps current boot files and builds from their initramfs, and asks for a new device-package version before restaging stale ones" +pass "images keeps current boot files and builds from their initramfs, and asks for a device-package version bump before restaging stale ones" # --- upload: the real tools/release-upload --dry-run on a signed bundle --- for tool in rsync sha256sum; do From 794422708ea3a04eaf4137a2de0f248a3725d68e Mon Sep 17 00:00:00 2001 From: saiththerobo Date: Sat, 14 Nov 2026 13:38:40 +0000 Subject: [PATCH 16/19] tools/pkg-version: a commit a merge brought in is a branch build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit committed() took a commit for main's when main could reach it, but the count runs on main's first-parent line, so a commit inside a branch that a merge commit brought in got a number main gives to other contents, with no .g for repo-publish to refuse. It now asks whether the commit is on that line, and otherwise builds it as a branch of the commit it left main at (the maintainer's fix on #690). tests/pkg-version checks out both commits of the merged pr-c: 0.3.3.1.g… and 0.3.3.2.g…. It also fails when a PKGBUILD reads a written version and isn't on the short list that keeps one (device-cheetah, the keyring), so a new package copied from an older PKGBUILD can't stay on one unnoticed. Co-Authored-By: Claude Opus 5.5 --- tests/pkg-version | 20 ++++++++++++++++++++ tools/pkg-version | 10 +++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/tests/pkg-version b/tests/pkg-version index 3b3496de3..643cdcf76 100755 --- a/tests/pkg-version +++ b/tests/pkg-version @@ -89,6 +89,14 @@ ok "a branch build is main's version at the base, its own commits and the commit git checkout -q -b pr-c; change c; commit "c1"; change c; commit "c2" git checkout -q main; git merge -q --no-ff -m "Merge pr-c" pr-c is "$(pv demo)" 0.3.4 "a merge commit counts once, not per commit it brings" +# The commits it brought are on main's history but not its line: branch +# builds of the commit they left main at, never one of main's numbers. +v=$(pv --rev pr-c~1 demo) +[[ $v == 0.3.3.1.g$(git rev-parse --short=7 pr-c~1) ]] || fail "a merged branch's first commit: got $v" +ok "a commit a merge brought in is a branch build ($v)" +v=$(pv --rev pr-c demo) +[[ $v == 0.3.3.2.g$(git rev-parse --short=7 pr-c) ]] || fail "a merged branch's second commit: got $v" +ok "and so is the next one ($v)" # The tool moves (and its PKGBUILD line with it): one more number, never a # restart from the stale version file. @@ -227,6 +235,18 @@ done ((boot >= 1)) || fail "no package ships boot files: the pattern no longer matches" ok "the $boot package(s) that ship boot files keep a written version" +# Only these keep a written version: a new package copied from an older +# PKGBUILD would otherwise stay on one without anyone noticing +written=(omamobile-device-cheetah omamobile-keyring) +for f in packages/*/PKGBUILD; do + p=$(basename "$(dirname "$f")") + grep -c -F '/.pkgver"' "$f" >/dev/null && continue + grep -c -E '^pkgver=.*/version"' "$f" >/dev/null || continue + [[ " ${written[*]} " == *" $p "* ]] || + fail "$p reads a written version: read .pkgver as the other packages do, or name it in tests/pkg-version" +done +ok "only ${written[*]} keep a written version" + # This repository's own history, replayed from its first commit. if [[ $(git rev-parse --is-shallow-repository) == true ]]; then ok "# skip: a shallow clone has no history to replay" diff --git a/tools/pkg-version b/tools/pkg-version index 79338363e..047f72607 100755 --- a/tools/pkg-version +++ b/tools/pkg-version @@ -177,7 +177,11 @@ committed() { # The history skips a version file that doesn't parse, so without this its # commit would build under the number before it parse "$(file_at "$rev")" >/dev/null || die "$path/version doesn't hold a version (0.2 or 0.2.5) at $rev" - if git merge-base --is-ancestor "$rev" "$main"; then + # On main's own line (its first parents), not merely reachable from it: a + # commit a merge brought in is a branch build of the commit it left main at + local id later + id=$(git rev-parse "$rev^{commit}") + if git rev-list --first-parent "$main" | grep -c -x -F "$id" >/dev/null; then v=$(walk "$rev" | tail -1 | cut -d' ' -f2) [[ -n $v ]] || die "$path/version doesn't hold a version (0.2 or 0.2.5) at $rev" echo "$v" @@ -185,6 +189,10 @@ committed() { fi base=$(git merge-base "$rev" "$main") || die "$rev shares no history with $main" + if [[ $base == "$id" ]]; then + later=$(git rev-list --first-parent "$main" "^$id" | tail -1) + base=$(git rev-parse "$later^1") + fi n=$(git rev-list --count --first-parent "$base..$rev" -- "$path") v=$(walk "$base" | tail -1 | cut -d' ' -f2) if ((n == 0)) && [[ -n $v ]]; then echo "$v"; return 0; fi From b338a33b1f52b8a28d4918461935872aded74c06 Mon Sep 17 00:00:00 2001 From: saiththerobo Date: Sat, 14 Nov 2026 13:38:40 +0000 Subject: [PATCH 17/19] build-packages: a counted version comes from tools/pkg-version pkg_version() sourced the PKGBUILD in place, which reads a .pkgver in the directory before asking the tool, while pkg_tar ships the fresh number. A .pkgver left there (the tool's own message suggests passing a version that way) would have kept a package "up to date" on the publish machine for good. For a PKGBUILD that reads .pkgver it now asks tools/pkg-version, as pkg_tar does; tests/build-packages-host-tools leaves a stale .pkgver and an old build in the repository and expects "to build". Co-Authored-By: Claude Opus 5.5 --- tests/build-packages-host-tools | 14 ++++++++++++++ tools/build-packages | 5 +++++ 2 files changed, 19 insertions(+) diff --git a/tests/build-packages-host-tools b/tests/build-packages-host-tools index 309854f27..a140df5a7 100755 --- a/tests/build-packages-host-tools +++ b/tests/build-packages-host-tools @@ -98,3 +98,17 @@ for tool in $(grep -v '^#' packages/omamobile-settings/test/host-tools); do done grep -c '^qmake6$' packages/omamobile-settings/test/host-tools >/dev/null || fail "omamobile-settings names qmake6" pass "omamobile-settings names qmake6 and the other commands its test calls" + +# A counted package's version is tools/pkg-version's, as pkg_tar ships it: a +# .pkgver left in its directory doesn't make an old build "up to date" +mkdir -p "$R/packages/counted" +echo 0.1 > "$R/packages/counted/version" && echo .pkgver > "$R/packages/.gitignore" # as this repository has it +printf 'pkgname=counted\npkgver=$(cat "${startdir:-.}/.pkgver" 2>/dev/null || "${startdir:-.}/../../tools/pkg-version" "${startdir:-.}")\npkgrel=1\narch=(any)\n' > "$R/packages/counted/PKGBUILD" +(cd "$R" && git add -A && git -c user.name=t -c user.email=t@invalid -c commit.gpgsign=false commit -q -m fixture) +echo 0.0.9 > "$R/packages/counted/.pkgver" +mkdir -p "$R/out/testdev/repo/aarch64" && : > "$R/out/testdev/repo/aarch64/counted-0.0.9-1-any.pkg.tar.zst" +# (the slow packages --list also reports aren't in this copy, so it ends non-zero) +list=$(cd "$R" && PATH=$t/bin:$PATH ALARM_TEST_CACHE=$t/cache tools/build-packages --local testdev --list packages/counted 2>&1 || true) +grep -c -x 'to build packages/counted 0.1.0-1' <<<"$list" >/dev/null \ + || { echo "$list"; fail "a stale .pkgver doesn't make a counted package up to date"; } +pass "a counted package's version comes from tools/pkg-version, not a .pkgver left in its directory" diff --git a/tools/build-packages b/tools/build-packages index 84401b9a2..334137f51 100755 --- a/tools/build-packages +++ b/tools/build-packages @@ -147,6 +147,11 @@ pkg_version() { startdir=$PWD # shellcheck disable=SC1091 source ./PKGBUILD >/dev/null 2>&1 + # A counted version comes from tools/pkg-version, as pkg_tar ships it: a + # .pkgver left in the directory would keep a package "up to date" for good + if grep -c -F '/.pkgver"' PKGBUILD >/dev/null; then + pkgver=$("$ROOT/tools/pkg-version" "$PWD" 2>/dev/null) || pkgver= + fi echo "${epoch:+$epoch:}$pkgver-$pkgrel" ) } From d02f307e3473c63fa41dbadfaa0425bced3365e2 Mon Sep 17 00:00:00 2001 From: saiththerobo Date: Sat, 14 Nov 2026 13:38:41 +0000 Subject: [PATCH 18/19] =?UTF-8?q?RELEASES:=20no=20example=20numbers=20in?= =?UTF-8?q?=20=C2=A77.1,=20and=20a=20respin=20from=20a=20branch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The shell's 0.2.126 to 0.2.127 was already off by one as main moved, so §7.1 says only that the 29 packages move one up. A respin built from a branch is a branch build that repo-publish refuses unless the build names that branch as its main line: the bundle row says so. Co-Authored-By: Claude Opus 5.5 --- docs/RELEASES.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/RELEASES.md b/docs/RELEASES.md index 6179d2c83..254e2c7e4 100644 --- a/docs/RELEASES.md +++ b/docs/RELEASES.md @@ -416,7 +416,7 @@ automatic boot-update policy. | Kernel | `uname -r`: `7.3.0-rc6-omamobile-g`; pkgver `7.3.0rc6.r.g` (§4) | annotated tag `kernel-` (`.1`, `.2` for a respin) on `omamobile` in linux-omarchy-mobile; the scheme is a proposal for the maintainer to confirm | | Packages | the series in each package's `version` file, then the count of commits on `main` that touched the package (`tools/pkg-version`, CONTRIBUTING §6.3) | `main`'s history: `tools/pkg-version --commit ` | | Descriptor | none of its own; a change to it is a device-package change and gives that package a new version | `omamobile-device-` | -| Bundle | calendar version ``, with `.1`, `.2` for a respin the same day | tag `release-` in this repository, covering every device released that day; `MANIFEST` pins the kernel tag, every package version and both commits | +| Bundle | calendar version ``, with `.1`, `.2` for a respin the same day; a respin's packages built from a branch rather than `main` are branch builds (`.g`, §7.1) that `tools/repo-publish` refuses, unless the build names that branch as its main line (`OMAMOBILE_MAIN_REF`) | tag `release-` in this repository, covering every device released that day; `MANIFEST` pins the kernel tag, every package version and both commits | A release never contains a kernel or package that isn't in `[omamobile]` at the same moment, so a bundle install and `omarchy update` meet at the same versions. The first release is `2026.MM.DD`, labelled "developer preview", for the Pixel 7 Pro only (§12.12). @@ -425,7 +425,7 @@ A release never contains a kernel or package that isn't in `[omamobile]` at the Until the pull request that added `tools/pkg-version` (issue #689), each pull request wrote its package's next version into `version` by hand. Two open pull requests could write the same number and both merge, and a stacked or rebased one had to be renumbered at every merge. The count replaces that for every package whose PKGBUILD reads it; the others keep hand-written versions (CONTRIBUTING §6.3), `omamobile-device-cheetah` among them: its boot files reach release phones' slot B, and the maintainer gives them a version only after an image built from them has booted on the 7 Pro. 1. **Before the merge,** each `version` file holds the last number written by hand, which is the version `[omamobile]` publishes. -2. **The merge commit starts the count.** A commit counts when the package's PKGBUILD, as that commit has it, reads `.pkgver` (the version `tools/pkg-version` hands a build); before that, the `version` file is the version. The merge commit makes 29 PKGBUILDs read it, so each of those packages moves one number up from the version `main` held just before, and the first development publish after it rebuilds the 29 once (`shell` 0.2.126 to 0.2.127). Nothing is written by hand, and no version that was published comes back. The start is the package's own opt-in, not the tool's: moving or renaming `tools/pkg-version` touches the PKGBUILDs, which is one more number, never a restart (`tests/pkg-version` moves it). +2. **The merge commit starts the count.** A commit counts when the package's PKGBUILD, as that commit has it, reads `.pkgver` (the version `tools/pkg-version` hands a build); before that, the `version` file is the version. The merge commit makes 29 PKGBUILDs read it, so each of those packages moves one number up from the version `main` held just before, and the first development publish after it rebuilds the 29 once. Nothing is written by hand, and no version that was published comes back. The start is the package's own opt-in, not the tool's: moving or renaming `tools/pkg-version` touches the PKGBUILDs, which is one more number, never a restart (`tests/pkg-version` moves it). 3. **From then on,** a merge needs no version change. Squash merges, merge commits and direct pushes count once each, in the order they land; a commit that changes only tests or docs under a package counts too. `tools/pkg-version --commit ` finds the commit a published version was built from, and `--history ` lists them all. 4. **Pull requests opened before the change** merge as they are. A `version` hunk at or below the count changes nothing; a number above it is taken as a floor, so the package jumps to it: drop such a hunk at review unless the jump is wanted. A conflict on `version` resolves to `main`'s file. A versioned dependency on another open pull request's number (`depends=('omamobile-shell>=0.2.130')`) may name a number the count gives to something else: check it against `tools/pkg-version` at merge, or depend on a shipped version. 5. **The `version` files keep their old third numbers** for now, so contributors who still bump do no harm while they adjust. They go stale; once the pull requests from before the change have drained, one commit can cut every file to its series (`0.2`). That commit touches every package, so each moves one number up again and is republished once; it is the maintainer's call when. From a4d2674b6539bc51148fa21ec84f1088e7b5ddc9 Mon Sep 17 00:00:00 2001 From: saiththerobo Date: Sun, 15 Nov 2026 10:40:29 +0000 Subject: [PATCH 19/19] omamobile-install-link: count its version like the other packages Main gained the package (#743) after the branch's conversion, and tests/pkg-version refuses a PKGBUILD that reads its written version without being on the list. pkgver now comes from .pkgver or tools/pkg-version, and install writes it over the shipped version file. Co-Authored-By: Claude Opus 5.5 --- packages/omamobile-install-link/PKGBUILD | 4 ++-- packages/omamobile-install-link/install | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/omamobile-install-link/PKGBUILD b/packages/omamobile-install-link/PKGBUILD index 0312d078e..ccb8524d2 100644 --- a/packages/omamobile-install-link/PKGBUILD +++ b/packages/omamobile-install-link/PKGBUILD @@ -13,7 +13,7 @@ # the installer has them. cargo fetches the crates (Cargo.lock pinned) in # prepare() and builds offline. Everything else is this directory's. pkgname=omamobile-install-link -pkgver=$(cat "${startdir:-.}/version") +pkgver=$(cat "${startdir:-.}/.pkgver" 2>/dev/null || "${startdir:-.}/../../tools/pkg-version" "${startdir:-.}") pkgrel=1 pkgdesc="Omarchy Mobile install link: the phone finishes its setup with the installer, over USB" arch=(aarch64) @@ -82,5 +82,5 @@ PY package() { cd "omamobile-installer-$_commit" - "$startdir/install" "$pkgdir" "$PWD" "$PWD/target/release" + OMAMOBILE_PKGVER=$pkgver "$startdir/install" "$pkgdir" "$PWD" "$PWD/target/release" } diff --git a/packages/omamobile-install-link/install b/packages/omamobile-install-link/install index a7d3287e6..d7675ed3e 100755 --- a/packages/omamobile-install-link/install +++ b/packages/omamobile-install-link/install @@ -59,6 +59,9 @@ ln -sfn ../omamobile-install-link-agent.service "$user/graphical-session.target. install -Dm644 tmpfiles.d/omamobile-install-link.conf "$d/usr/lib/tmpfiles.d/omamobile-install-link.conf" install -Dm644 version "$d/usr/share/omamobile/install-link/version" +# The package's own version (tools/pkg-version), which the file's +# series doesn't give +[[ -z ${OMAMOBILE_PKGVER:-} ]] || echo "$OMAMOBILE_PKGVER" > "$d/usr/share/omamobile/install-link/version" { echo "# The install link's daemon and gadget script: derekross/omamobile-installer" echo "protocol: $protocol"