From f1071867b2401a148b9c33aabb8f4a7c8200408a Mon Sep 17 00:00:00 2001 From: sandwich Date: Fri, 4 Sep 2026 15:23:44 +0200 Subject: [PATCH] Offer an explicit rolling AUR channel without weakening stable packages Add loopwire-git as a third package base that follows the protected default branch and derives a monotonic version from Git history. Keep its moving-source build in a keyless verification lane; the AUR-key publisher only pushes reviewed metadata after that independent proof. Constraint: VCS packages must use a -git suffix and cannot execute moving source with publication credentials present Rejected: Fold rolling behavior into loopwire | would make the stable package non-reproducible and mislabel its update contract Confidence: high Scope-risk: moderate Reversibility: clean Directive: Keep loopwire, loopwire-bin, and loopwire-git as isolated package bases with one canonical default branch Tested: Full makepkg build at 0.1.0.r8.g007e47e, namcap, worktree publication preflight, AUR metadata smoke, requirements, docs, scripts, workflows, typecheck, tests, build Not-tested: Installation into a fresh Arch VM; workflow publication without a configured automation key Related: #29 --- .github/workflows/ci.yml | 14 ++- .github/workflows/publish-aur.yml | 4 + .../docs/developer/github-actions-setup.md | 3 +- apps/docs/docs/developer/release.md | 7 +- apps/docs/docs/guide/install.md | 6 +- apps/docs/docs/guide/support-matrix.md | 1 + apps/docs/docs/release-notes/unreleased.md | 2 + package.json | 1 + packaging/README.md | 22 ++-- packaging/aur/loopwire-git/PKGBUILD.in | 77 ++++++++++++ scripts/deploy-aur-package.sh | 115 +++++++++++------- scripts/render-aur-pkgbuild.sh | 38 +++++- scripts/verify-aur-git-package.sh | 115 ++++++++++++++++++ scripts/verify-aur-package.sh | 25 +++- scripts/verify-docs.sh | 3 + scripts/verify-github-workflows.sh | 2 + scripts/verify-packaging.sh | 7 +- scripts/verify-requirements.sh | 3 + scripts/verify-scripts.sh | 7 +- 19 files changed, 389 insertions(+), 63 deletions(-) create mode 100644 packaging/aur/loopwire-git/PKGBUILD.in create mode 100755 scripts/verify-aur-git-package.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6f4a172..67deeba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,7 +61,7 @@ jobs: run: pnpm check validate-aur-source: - name: Build source AUR package on Arch Linux + name: Build source AUR packages on Arch Linux runs-on: ubuntu-latest timeout-minutes: 90 steps: @@ -71,12 +71,20 @@ jobs: fetch-depth: 0 - name: Build and inspect source package + env: + LOOPWIRE_DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} run: | set -euo pipefail release_tag="$(git describe --tags --abbrev=0 --match 'v[0-9]*')" export LOOPWIRE_AUR_VERSION="${release_tag#v}" + export LOOPWIRE_AUR_GIT_VERSION="$( + git describe --long --tags --abbrev=7 "origin/$LOOPWIRE_DEFAULT_BRANCH" | + sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g' + )" docker run --rm \ --env LOOPWIRE_AUR_VERSION \ + --env LOOPWIRE_AUR_GIT_VERSION \ + --env LOOPWIRE_DEFAULT_BRANCH \ --volume "$GITHUB_WORKSPACE:/workspace:ro" \ archlinux@sha256:84cd9ef000b3cff245ec028e87965b84724f4bf1cc63fc2741ba927b88515ed6 \ bash -ceu ' @@ -86,4 +94,8 @@ jobs: runuser -u aur-builder -- env HOME=/home/aur-builder \ bash /workspace/scripts/verify-aur-source-package.sh \ --version "$LOOPWIRE_AUR_VERSION" + runuser -u aur-builder -- env HOME=/home/aur-builder \ + bash /workspace/scripts/verify-aur-git-package.sh \ + --version "$LOOPWIRE_AUR_GIT_VERSION" \ + --default-branch "$LOOPWIRE_DEFAULT_BRANCH" ' diff --git a/.github/workflows/publish-aur.yml b/.github/workflows/publish-aur.yml index d5a7a41..5486369 100644 --- a/.github/workflows/publish-aur.yml +++ b/.github/workflows/publish-aur.yml @@ -17,6 +17,7 @@ on: - all - loopwire - loopwire-bin + - loopwire-git permissions: contents: read @@ -81,6 +82,7 @@ jobs: env: LOOPWIRE_AUR_PACKAGE: ${{ inputs.package }} LOOPWIRE_AUR_TAG: ${{ inputs.tag }} + LOOPWIRE_DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} run: | set -euo pipefail checkout_root="$RUNNER_TEMP/aur-checkouts" @@ -88,6 +90,7 @@ jobs: docker run --rm \ --env LOOPWIRE_AUR_PACKAGE \ --env LOOPWIRE_AUR_TAG \ + --env LOOPWIRE_DEFAULT_BRANCH \ --volume "$GITHUB_WORKSPACE:/workspace:ro" \ --volume "$RUNNER_TEMP/aur-key:/run/secrets/aur-key:ro" \ --volume "$checkout_root:/aur" \ @@ -107,6 +110,7 @@ jobs: bash /workspace/scripts/deploy-aur-package.sh \ --package "$LOOPWIRE_AUR_PACKAGE" \ --tag "$LOOPWIRE_AUR_TAG" \ + --default-branch "$LOOPWIRE_DEFAULT_BRANCH" \ --checkout-root /aur \ --key /home/aur-builder/.ssh/aur ' diff --git a/apps/docs/docs/developer/github-actions-setup.md b/apps/docs/docs/developer/github-actions-setup.md index df7858f..dfade9c 100644 --- a/apps/docs/docs/developer/github-actions-setup.md +++ b/apps/docs/docs/developer/github-actions-setup.md @@ -69,7 +69,8 @@ gh secret set AUR_SSH_PRIVATE_KEY --repo OWNER/REPO --env aur < ~/.ssh/loopwire- ``` The environment gate is the authority boundary: pull requests and ordinary pushes only build the recipes, while an -approved manual dispatch can publish `loopwire`, `loopwire-bin`, or both from an already-public stable release tag. +approved manual dispatch can publish `loopwire`, `loopwire-bin`, `loopwire-git`, or all three. Stable variants remain +bound to an already-public release tag; the VCS variant resolves the current protected default branch. ## Input integrity and secrecy diff --git a/apps/docs/docs/developer/release.md b/apps/docs/docs/developer/release.md index f1b73a0..d7dd00b 100644 --- a/apps/docs/docs/developer/release.md +++ b/apps/docs/docs/developer/release.md @@ -780,18 +780,23 @@ configured and readiness passes. ```bash pnpm verify:aur pnpm verify:aur:source -- --version 0.1.0 +pnpm verify:aur:git ``` The lightweight AUR smoke renders both `packaging/aur/loopwire-bin/PKGBUILD.in` and `packaging/aur/loopwire/PKGBUILD.in`, builds the binary recipe, and validates the source recipe metadata. `verify:aur:source` performs the full tagged-source compilation and package-content inspection on Arch. Neither command -installs or submits anything. +installs or submits anything. `verify:aur:git` separately builds the current default branch and checks its VCS-derived +package version plus complete installed payload. +Run that VCS build proof before publication and without an AUR key in its environment. The publisher handles +`loopwire-git` as metadata-only so moving default-branch code never executes while the signing key is reachable. After the GitHub release is public, publish one or both package bases from a clean Arch checkout: ```bash pnpm deploy:aur -- --package loopwire --tag v0.1.0 --key ~/.ssh/aur pnpm deploy:aur -- --package loopwire-bin --tag v0.1.0 --key ~/.ssh/aur +pnpm deploy:aur -- --package loopwire-git --tag v0.1.0 --key ~/.ssh/aur ``` The manual `Publish AUR` workflow uses the same helper inside an Arch container. It is isolated behind the `aur` diff --git a/apps/docs/docs/guide/install.md b/apps/docs/docs/guide/install.md index 9a2d32a..8783bc0 100644 --- a/apps/docs/docs/guide/install.md +++ b/apps/docs/docs/guide/install.md @@ -13,9 +13,8 @@ cd loopwire makepkg -si ``` -For the faster prebuilt release-artifact package, use the separate `loopwire-bin` package base instead. The variants -conflict because they install the same commands; do not install both at once. A future live-VCS package, if added, -will use the `loopwire-git` name. +For the faster prebuilt release-artifact package, use `loopwire-bin`. To follow the current default branch, use the +rolling `loopwire-git` package. The three variants conflict because they install the same commands; install only one. ## Source Install @@ -90,6 +89,7 @@ Package metadata templates now exist under `packaging/`: - `packaging/aur/loopwire/PKGBUILD.in` for stable tagged source builds. - `packaging/aur/loopwire-bin/PKGBUILD.in` for signed prebuilt release artifacts. +- `packaging/aur/loopwire-git/PKGBUILD.in` for the rolling default-branch source build. - `flake.nix` exposes `packages..loopwire-bin` from `packaging/nix/loopwire-bin.nix`, currently with fake hashes until the first public release provides real artifact hashes. - Repository-owned deb recipes for Ubuntu 24.04 and Debian 13, plus RPM recipes for Fedora 44 and openSUSE diff --git a/apps/docs/docs/guide/support-matrix.md b/apps/docs/docs/guide/support-matrix.md index 5263743..9fc8686 100644 --- a/apps/docs/docs/guide/support-matrix.md +++ b/apps/docs/docs/guide/support-matrix.md @@ -74,6 +74,7 @@ the Tauri shell command bridge. | Fedora 44 / openSUSE Tumbleweed RPM | Verified in matching KVM guests at commit `70eee4e`; review snapshot in `vm/native-package-proof/` | Published as direct downloads; no COPR/OBS repository. | | AUR `loopwire` | Tagged source build through `pnpm verify:aur:source` | Published for 0.1.0. | | AUR `loopwire-bin` | Signed release-artifact build through `pnpm verify:aur` | Published for 0.1.0. | +| AUR `loopwire-git` | Rolling default-branch build through `pnpm verify:aur:git` | Published; development snapshots are not stable releases. | | Nix flake package template | `pnpm verify:packaging` | Blocked on real release hashes and Nix build proof. | The flake package output is `packages..loopwire-bin`; it uses fake hashes until published artifacts exist. diff --git a/apps/docs/docs/release-notes/unreleased.md b/apps/docs/docs/release-notes/unreleased.md index f09ecce..f84e805 100644 --- a/apps/docs/docs/release-notes/unreleased.md +++ b/apps/docs/docs/release-notes/unreleased.md @@ -12,6 +12,8 @@ These notes describe source-tree progress. They are not a public release announc - The AUR now keeps two honest stable recipes: `loopwire` compiles the immutable tagged source archive, while `loopwire-bin` continues to consume signed prebuilt release artifacts. Both are built and inspected before a manual, environment-protected AUR publication workflow may push their separate package repositories. +- A third `loopwire-git` AUR recipe follows the protected default branch, derives a monotonic VCS package version, and + remains explicitly separate from the stable source and binary package bases. ## Desktop UI Rebuild diff --git a/package.json b/package.json index 31f46e8..9fa334a 100644 --- a/package.json +++ b/package.json @@ -56,6 +56,7 @@ "nix:render-release": "bash scripts/render-nix-release-package.sh", "verify:nix-release": "bash scripts/verify-nix-release-package.sh", "verify:aur": "bash scripts/verify-aur-package.sh", + "verify:aur:git": "bash scripts/verify-aur-git-package.sh", "verify:aur:source": "bash scripts/verify-aur-source-package.sh", "verify:docs": "bash scripts/verify-docs.sh", "verify:site": "node scripts/verify-static-site.mjs", diff --git a/packaging/README.md b/packaging/README.md index 1ce7f1b..5bf2793 100644 --- a/packaging/README.md +++ b/packaging/README.md @@ -32,17 +32,19 @@ verify the key pair without placing the private key under the repository. ## AUR -The two stable AUR recipes are deliberately separate: +The stable and rolling AUR recipes are deliberately separate: - `packaging/aur/loopwire/PKGBUILD.in` builds the immutable tagged source archive and owns the exact `loopwire` package base. - `packaging/aur/loopwire-bin/PKGBUILD.in` consumes the signed architecture-specific release tarballs and owns `loopwire-bin`. +- `packaging/aur/loopwire-git/PKGBUILD.in` builds the current default branch, derives `pkgver` from Git history, and + owns `loopwire-git`. The source template replaces `@VERSION@`, `@PKGREL@`, and `@SHA256_SOURCE@`. The binary template replaces `@VERSION@`, `@PKGREL@`, `@SHA256_X86_64@`, and `@SHA256_AARCH64@`. The recipes declare conflicts/provides so only -one variant can own the installed `loopwire` files; a future live-VCS recipe must use the separate `loopwire-git` -package base. +one variant can own the installed `loopwire` files. The VCS recipe uses `SKIP` only for its moving Git source; the +packager-supplied MIT license remains checksum-bound. Every generated `PKGBUILD` must be tested with `makepkg` against its published tag or release artifacts before AUR submission. @@ -52,21 +54,25 @@ For local release-shaped smoke, render the template against generated artifacts ```bash pnpm verify:aur pnpm verify:aur:source -- --version 0.1.0 +pnpm verify:aur:git ``` -`verify:aur` builds the binary recipe and checks the source recipe metadata. `verify:aur:source` performs the heavier -tagged source compilation and package-content inspection. Neither command installs or submits a package. +`verify:aur` builds the binary recipe and checks stable plus VCS source metadata. `verify:aur:source` and +`verify:aur:git` perform the heavier stable-tag and rolling-branch compilations. None installs or submits a package. +The VCS build intentionally runs without any AUR key. Its key-bearing publication path revalidates and pushes only +the reviewed `PKGBUILD`, `.SRCINFO`, and license metadata; it never executes the moving branch source. Publish from a clean Arch checkout with the AUR key loaded or available for an interactive passphrase prompt: ```bash pnpm deploy:aur -- --package loopwire --tag v0.1.0 --key ~/.ssh/aur pnpm deploy:aur -- --package loopwire-bin --tag v0.1.0 --key ~/.ssh/aur +pnpm deploy:aur -- --package loopwire-git --tag v0.1.0 --key ~/.ssh/aur ``` -The helper downloads checksum-bound inputs, builds and inspects the package, generates `.SRCINFO`, increments `pkgrel` -when same-version metadata changes, commits `PKGBUILD`, `.SRCINFO`, and `LICENSE-MIT`, pushes the package-aligned AUR -Git repo, and verifies the remote commit. `.github/workflows/publish-aur.yml` exposes the same path as an +The helper downloads checksum-bound stable inputs, builds and inspects stable packages, generates `.SRCINFO`, and +increments `pkgrel` when same-version metadata changes. It commits `PKGBUILD`, `.SRCINFO`, and `LICENSE-MIT`, then +pushes the package-aligned AUR Git repo and verifies the remote commit. `.github/workflows/publish-aur.yml` exposes the same path as an environment-protected manual dispatch after its dedicated `AUR_SSH_PRIVATE_KEY` secret is configured. The workflow pins the AUR Ed25519 host key in `packaging/aur/known_hosts`; verify any future key rotation against the official AUR homepage before updating it. diff --git a/packaging/aur/loopwire-git/PKGBUILD.in b/packaging/aur/loopwire-git/PKGBUILD.in new file mode 100644 index 0000000..3386ef6 --- /dev/null +++ b/packaging/aur/loopwire-git/PKGBUILD.in @@ -0,0 +1,77 @@ +# Maintainer: Loopwire contributors +pkgname=loopwire-git +pkgver=@VERSION@ +pkgrel=@PKGREL@ +pkgdesc="Linux virtual audio routing application (development version)" +arch=("x86_64" "aarch64") +url="https://github.com/sandwichfarm/loopwire" +license=("MIT" "Apache-2.0") +provides=("loopwire=${pkgver}") +conflicts=("loopwire") +depends=("webkit2gtk-4.1" "nodejs>=22.12.0" "pipewire" "wireplumber") +makedepends=("git" "pnpm" "rust") +optdepends=( + "pipewire-pulse: PulseAudio compatibility" + "jack2: JACK bridge diagnostics" + "alsa-utils: ALSA diagnostics" +) +source=( + "loopwire::git+${url}.git#branch=@DEFAULT_BRANCH@" + "LICENSE-MIT" +) +sha256sums=( + "SKIP" + "@SHA256_LICENSE@" +) + +pkgver() { + cd loopwire + git describe --long --tags --abbrev=7 | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g' +} + +prepare() { + cd loopwire + pnpm install --frozen-lockfile +} + +build() { + cd loopwire + pnpm --filter @loopwire/core build + pnpm --filter @loopwire/audio-host build + + local app_version source_epoch + app_version="${pkgver/.r/-dev.}" + source_epoch="$(git log -1 --format=%ct)" + pnpm --filter @loopwire/desktop exec tauri build --no-bundle \ + --config "$(printf '{"version":"%s"}' "${app_version}")" + + SOURCE_DATE_EPOCH="${source_epoch}" bash scripts/package-release.sh \ + --binary apps/desktop/src-tauri/target/release/loopwire \ + --version "${pkgver}" \ + --arch "${CARCH}" \ + --output-dir "${srcdir}/release" +} + +package() { + local release_root="${srcdir}/release-root" + mkdir -p "${release_root}" + tar -xzf "${srcdir}/release/loopwire-linux-${CARCH}.tar.gz" -C "${release_root}" + + install -Dm755 "${release_root}/loopwire" "${pkgdir}/usr/bin/loopwire" + install -Dm755 "${release_root}/loopwire-dsp-provider" "${pkgdir}/usr/bin/loopwire-dsp-provider" + install -Dm755 "${release_root}/loopwire-jack-ports" "${pkgdir}/usr/bin/loopwire-jack-ports" + install -Dm755 "${release_root}/loopwire-detect-audio" "${pkgdir}/usr/bin/loopwire-detect-audio" + install -dm755 "${pkgdir}/usr/lib/loopwire" + cp -R "${release_root}/libexec/loopwire/." "${pkgdir}/usr/lib/loopwire/" + find "${pkgdir}/usr/lib/loopwire" -type d -exec chmod 0755 {} + + find "${pkgdir}/usr/lib/loopwire" -type f -exec chmod 0644 {} + + chmod 0755 "${pkgdir}/usr/lib/loopwire/loopwire-gui" + + cd "${srcdir}/loopwire" + install -Dm644 packaging/common/loopwire.desktop \ + "${pkgdir}/usr/share/applications/loopwire.desktop" + install -Dm644 apps/desktop/src-tauri/icons/icon.svg \ + "${pkgdir}/usr/share/icons/hicolor/scalable/apps/loopwire.svg" + install -Dm644 "${srcdir}/LICENSE-MIT" \ + "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE-MIT" +} diff --git a/scripts/deploy-aur-package.sh b/scripts/deploy-aur-package.sh index c6149b2..b5b1ad2 100755 --- a/scripts/deploy-aur-package.sh +++ b/scripts/deploy-aur-package.sh @@ -7,6 +7,7 @@ package_selection="loopwire" checkout_root="$workspace_root/aur" key_path="${AUR_SSH_KEY:-$HOME/.ssh/aur}" tag="" +default_branch="${LOOPWIRE_DEFAULT_BRANCH:-}" die() { printf 'error: %s\n' "$*" >&2 @@ -18,8 +19,9 @@ usage() { Build, validate, and publish Loopwire AUR recipes. Usage: - deploy-aur-package.sh [--package loopwire|loopwire-bin|all] [--tag vX.Y.Z] + deploy-aur-package.sh [--package loopwire|loopwire-bin|loopwire-git|all] [--tag vX.Y.Z] [--checkout-root DIR] [--key PATH] + [--default-branch BRANCH] Defaults: --package loopwire @@ -27,9 +29,9 @@ Defaults: --checkout-root ../aur relative to the repository root --key ~/.ssh/aur -The stable `loopwire` recipe builds the tagged source archive. `loopwire-bin` -consumes the signed architecture-specific release artifacts. Each recipe is -fully built with makepkg and inspected with namcap before its AUR Git push. +The stable `loopwire` recipe builds the tagged source archive, `loopwire-bin` +consumes signed release artifacts, and `loopwire-git` tracks the default branch. +Each recipe is fully built and inspected before its package-scoped AUR Git push. USAGE } @@ -40,6 +42,7 @@ while [ "$#" -gt 0 ]; do --tag) tag="${2:?missing value for --tag}"; shift 2 ;; --checkout-root) checkout_root="${2:?missing value for --checkout-root}"; shift 2 ;; --key) key_path="${2:?missing value for --key}"; shift 2 ;; + --default-branch) default_branch="${2:?missing value for --default-branch}"; shift 2 ;; -h | --help) usage; exit 0 ;; *) die "unknown argument: $1" ;; esac @@ -48,14 +51,15 @@ done case "$package_selection" in loopwire) packages=(loopwire) ;; loopwire-bin) packages=(loopwire-bin) ;; - all) packages=(loopwire loopwire-bin) ;; - *) die "--package must be loopwire, loopwire-bin, or all" ;; + loopwire-git) packages=(loopwire-git) ;; + all) packages=(loopwire loopwire-bin loopwire-git) ;; + *) die "--package must be loopwire, loopwire-bin, loopwire-git, or all" ;; esac for command_name in awk curl git makepkg namcap openssl sed sha256sum ssh ssh-add ssh-agent ssh-keygen tar; do command -v "$command_name" >/dev/null 2>&1 || die "required command is missing: $command_name" done -[[ -d "$repo_root/.git" ]] || die "Loopwire checkout not found: $repo_root" +[[ -e "$repo_root/.git" ]] || die "Loopwire checkout not found: $repo_root" [[ -f "$repo_root/packaging/release-signing-public.pem" ]] || die "release public key not found" [[ -f "$repo_root/scripts/verify-release-signature.sh" ]] || die "release signature verifier not found" known_hosts_path="$repo_root/packaging/aur/known_hosts" @@ -75,6 +79,26 @@ if [ -z "$tag" ]; then fi [[ "$tag" =~ ^v([0-9]+([.][0-9]+)*)$ ]] || die "release tag must look like v1.2.3; got $tag" version="${tag#v}" +git_version="" +if [[ " ${packages[*]} " == *" loopwire-git "* ]]; then + if [ -z "$default_branch" ]; then + remote_head="$(git -C "$repo_root" symbolic-ref --short refs/remotes/origin/HEAD 2>/dev/null || true)" + default_branch="${remote_head#origin/}" + fi + if [ -z "$default_branch" ]; then + default_branch="$(git -C "$repo_root" remote show origin | awk '/HEAD branch:/ { print $NF; exit }')" + fi + git check-ref-format --branch "$default_branch" >/dev/null 2>&1 || \ + die "could not resolve a valid repository default branch" + git -C "$repo_root" fetch --quiet origin \ + "refs/heads/$default_branch:refs/remotes/origin/$default_branch" + git_version="$( + git -C "$repo_root" describe --long --tags --abbrev=7 "origin/$default_branch" | + sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g' + )" + [[ "$git_version" =~ ^[0-9]+([.][0-9]+)*[.]r[0-9]+[.]g[0-9a-f]+$ ]] || \ + die "could not derive a valid loopwire-git version from the default branch" +fi tmp_dir="$(mktemp -d -t loopwire-aur-deploy.XXXXXXXX)" started_agent=0 @@ -139,20 +163,21 @@ fi render_pkgbuild() { local package_name="$1" - local package_rel="$2" - local output="$3" - local source_mode="$4" + local package_version="$2" + local package_rel="$3" + local output="$4" + local source_mode="$5" local args=( --package "$package_name" - --version "$version" + --version "$package_version" --pkgrel "$package_rel" --output "$output" ) - if [ "$package_name" = "loopwire" ]; then - args+=(--source-archive "$source_archive") - else - args+=(--release-dir "$release_dir") - fi + case "$package_name" in + loopwire) args+=(--source-archive "$source_archive") ;; + loopwire-bin) args+=(--release-dir "$release_dir") ;; + loopwire-git) args+=(--default-branch "$default_branch") ;; + esac if [ "$source_mode" = "published" ]; then args+=(--published) fi @@ -206,7 +231,9 @@ prepare_checkout() { publish_package() { local package_name="$1" + local package_version="$version" local checkout package_dir candidate_pkgbuild candidate_srcinfo current_version current_rel package_rel + [ "$package_name" = "loopwire-git" ] && package_version="$git_version" checkout="$(prepare_checkout "$package_name")" package_dir="$tmp_dir/$package_name" mkdir -p "$package_dir" @@ -219,44 +246,49 @@ publish_package() { current_rel="$(awk '$1 == "pkgrel" && $2 == "=" { print $3; exit }' "$checkout/.SRCINFO")" fi package_rel="1" - if [ "$current_version" = "$version" ] && [[ "$current_rel" =~ ^[0-9]+$ ]]; then + if [ "$current_version" = "$package_version" ] && [[ "$current_rel" =~ ^[0-9]+$ ]]; then package_rel="$current_rel" fi - render_pkgbuild "$package_name" "$package_rel" "$candidate_pkgbuild" published + render_pkgbuild "$package_name" "$package_version" "$package_rel" "$candidate_pkgbuild" published generate_srcinfo "$candidate_pkgbuild" "$candidate_srcinfo" if [ -f "$checkout/PKGBUILD" ] && [ -f "$checkout/.SRCINFO" ] && \ [ -f "$checkout/LICENSE-MIT" ] && \ cmp -s "$candidate_pkgbuild" "$checkout/PKGBUILD" && \ cmp -s "$candidate_srcinfo" "$checkout/.SRCINFO" && \ cmp -s "$repo_root/packaging/aur/LICENSE-MIT" "$checkout/LICENSE-MIT"; then - printf '%s is already current at %s-%s.\n' "$package_name" "$version" "$package_rel" + printf '%s is already current at %s-%s.\n' "$package_name" "$package_version" "$package_rel" return fi - if [ "$current_version" = "$version" ] && [[ "$current_rel" =~ ^[0-9]+$ ]]; then + if [ "$current_version" = "$package_version" ] && [[ "$current_rel" =~ ^[0-9]+$ ]]; then package_rel="$((current_rel + 1))" - render_pkgbuild "$package_name" "$package_rel" "$candidate_pkgbuild" published + render_pkgbuild "$package_name" "$package_version" "$package_rel" "$candidate_pkgbuild" published generate_srcinfo "$candidate_pkgbuild" "$candidate_srcinfo" fi build_dir="$package_dir/build" - mkdir -p "$build_dir" - render_pkgbuild "$package_name" "$package_rel" "$build_dir/PKGBUILD" local - cp "$repo_root/packaging/aur/LICENSE-MIT" "$build_dir/LICENSE-MIT" - if [ "$package_name" = "loopwire" ]; then - cp "$source_archive" "$build_dir/loopwire-${version}.tar.gz" + namcap_log="$package_dir/namcap.log" + if [ "$package_name" = "loopwire-git" ]; then + printf '%s\n' "Using the independent keyless loopwire-git build proof; validating publish metadata only." + namcap "$candidate_pkgbuild" | tee "$namcap_log" else - cp "$release_dir/loopwire-linux-x86_64.tar.gz" "$build_dir/" - cp "$release_dir/loopwire-linux-aarch64.tar.gz" "$build_dir/" + mkdir -p "$build_dir" + render_pkgbuild "$package_name" "$package_version" "$package_rel" "$build_dir/PKGBUILD" local + cp "$repo_root/packaging/aur/LICENSE-MIT" "$build_dir/LICENSE-MIT" + if [ "$package_name" = "loopwire" ]; then + cp "$source_archive" "$build_dir/loopwire-${version}.tar.gz" + else + cp "$release_dir/loopwire-linux-x86_64.tar.gz" "$build_dir/" + cp "$release_dir/loopwire-linux-aarch64.tar.gz" "$build_dir/" + fi + printf 'Building %s %s-%s...\n' "$package_name" "$package_version" "$package_rel" + ( + cd "$build_dir" + makepkg --force --nodeps --noconfirm --cleanbuild --clean + ) + package_file="$(find "$build_dir" -maxdepth 1 -type f -name "${package_name}-*.pkg.tar.*" ! -name "${package_name}-debug-*" -print -quit)" + [ -n "$package_file" ] || die "makepkg did not produce the $package_name package" + namcap "$candidate_pkgbuild" "$package_file" | tee "$namcap_log" fi - printf 'Building %s %s-%s...\n' "$package_name" "$version" "$package_rel" - ( - cd "$build_dir" - makepkg --force --nodeps --noconfirm --cleanbuild --clean - ) - package_file="$(find "$build_dir" -maxdepth 1 -type f -name "${package_name}-*.pkg.tar.*" ! -name "${package_name}-debug-*" -print -quit)" - [ -n "$package_file" ] || die "makepkg did not produce the $package_name package" - namcap_log="$package_dir/namcap.log" - namcap "$candidate_pkgbuild" "$package_file" | tee "$namcap_log" grep -Fq " E: " "$namcap_log" && die "namcap reported an error for $package_name" install -m 0644 "$candidate_pkgbuild" "$checkout/PKGBUILD" @@ -271,9 +303,10 @@ publish_package() { git -C "$checkout" config user.email "${author_email:-aur@loopwire.app}" recipe_kind="source-built" [ "$package_name" = "loopwire-bin" ] && recipe_kind="release-binary" + [ "$package_name" = "loopwire-git" ] && recipe_kind="rolling-VCS" commit_message="$package_dir/commit-message" cat >"$commit_message" <&2 exit 2 fi -if [[ ! "$version" =~ ^[0-9]+([.][0-9]+)*$ ]]; then - echo "Version must contain dot-separated integers: $version" >&2 - exit 2 -fi +case "$package_name" in + loopwire-git) + [[ "$version" =~ ^[0-9]+([.][0-9]+)*[.]r[0-9]+[.]g[0-9a-f]+$ ]] || { + echo "loopwire-git version must look like 1.2.3.r4.gabcdef0: $version" >&2 + exit 2 + } + ;; + *) + [[ "$version" =~ ^[0-9]+([.][0-9]+)*$ ]] || { + echo "Version must contain dot-separated integers: $version" >&2 + exit 2 + } + ;; +esac if [[ ! "$pkgrel" =~ ^[1-9][0-9]*$ ]]; then echo "pkgrel must be a positive integer: $pkgrel" >&2 exit 2 @@ -114,6 +127,23 @@ case "$package_name" in -e "s/@SHA256_LICENSE@/${license_hash}/g" \ "$template_path" >"$tmp_output" ;; + loopwire-git) + [ -n "$default_branch" ] || { + echo "loopwire-git requires --default-branch BRANCH" >&2 + exit 2 + } + git check-ref-format --branch "$default_branch" >/dev/null 2>&1 || { + echo "Invalid default branch: $default_branch" >&2 + exit 2 + } + template_path="$root/packaging/aur/loopwire-git/PKGBUILD.in" + sed \ + -e "s/@VERSION@/${version}/g" \ + -e "s/@PKGREL@/${pkgrel}/g" \ + -e "s/@SHA256_LICENSE@/${license_hash}/g" \ + -e "s/@DEFAULT_BRANCH@/${default_branch}/g" \ + "$template_path" >"$tmp_output" + ;; *) echo "Unsupported AUR package: $package_name" >&2; exit 2 ;; esac diff --git a/scripts/verify-aur-git-package.sh b/scripts/verify-aur-git-package.sh new file mode 100755 index 0000000..a65e47e --- /dev/null +++ b/scripts/verify-aur-git-package.sh @@ -0,0 +1,115 @@ +#!/usr/bin/env bash +set -euo pipefail + +root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +version="" +default_branch="" + +usage() { + cat <<'USAGE' +Build and inspect the rolling loopwire-git AUR package. + +Usage: + verify-aur-git-package.sh [--version VERSION] [--default-branch BRANCH] + +VERSION seeds PKGBUILD before makepkg refreshes it through pkgver(). By default +it is derived from the newest tagged commit reachable from the default branch. +USAGE +} + +while [ "$#" -gt 0 ]; do + case "$1" in + --) shift ;; + --version) version="${2:?missing value for --version}"; shift 2 ;; + --default-branch) default_branch="${2:?missing value for --default-branch}"; shift 2 ;; + -h | --help) usage; exit 0 ;; + *) echo "Unknown argument: $1" >&2; usage >&2; exit 2 ;; + esac +done + +command -v makepkg >/dev/null 2>&1 || { + echo "makepkg not found; loopwire-git verification requires Arch Linux." >&2 + exit 1 +} +command -v namcap >/dev/null 2>&1 || { + echo "namcap not found; loopwire-git verification requires namcap." >&2 + exit 1 +} + +if [ -z "$default_branch" ]; then + default_branch="$(git -C "$root" symbolic-ref --short refs/remotes/origin/HEAD 2>/dev/null)" + default_branch="${default_branch#origin/}" +fi +git check-ref-format --branch "$default_branch" >/dev/null 2>&1 || { + echo "Could not resolve a valid default branch; pass --default-branch." >&2 + exit 2 +} +if [ -z "$version" ]; then + version="$( + git -C "$root" describe --long --tags --abbrev=7 "origin/$default_branch" 2>/dev/null | + sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g' + )" +fi +if [[ ! "$version" =~ ^[0-9]+([.][0-9]+)*[.]r[0-9]+[.]g[0-9a-f]+$ ]]; then + echo "loopwire-git version must look like 1.2.3.r4.gabcdef0: $version" >&2 + exit 2 +fi + +tmp_dir="$(mktemp -d -t loopwire-aur-git.XXXXXXXX)" +cleanup() { + rm -rf "$tmp_dir" +} +trap cleanup EXIT + +build_dir="$tmp_dir/build" +mkdir -p "$build_dir" +bash "$root/scripts/render-aur-pkgbuild.sh" \ + --package loopwire-git \ + --version "$version" \ + --default-branch "$default_branch" \ + --pkgrel 1 \ + --output "$build_dir/PKGBUILD" >/dev/null +cp "$root/packaging/aur/LICENSE-MIT" "$build_dir/LICENSE-MIT" + +( + cd "$build_dir" + makepkg --force --nodeps --noconfirm --cleanbuild --clean +) + +actual_version="$(awk -F= '$1 == "pkgver" { print $2; exit }' "$build_dir/PKGBUILD")" +if [[ ! "$actual_version" =~ ^[0-9]+([.][0-9]+)*[.]r[0-9]+[.]g[0-9a-f]+$ ]]; then + echo "makepkg did not write a valid VCS pkgver: $actual_version" >&2 + exit 1 +fi +package_file="$(find "$build_dir" -maxdepth 1 -type f -name 'loopwire-git-*.pkg.tar.*' ! -name 'loopwire-git-debug-*' -print -quit)" +if [ -z "$package_file" ]; then + echo "makepkg did not produce a loopwire-git package archive." >&2 + exit 1 +fi + +namcap_log="$tmp_dir/namcap.log" +namcap "$build_dir/PKGBUILD" "$package_file" | tee "$namcap_log" +if grep -Fq " E: " "$namcap_log"; then + echo "namcap reported an error for loopwire-git." >&2 + exit 1 +fi + +package_members="$tmp_dir/package-members.txt" +tar -tf "$package_file" >"$package_members" +for member in \ + usr/bin/loopwire \ + usr/bin/loopwire-dsp-provider \ + usr/bin/loopwire-jack-ports \ + usr/bin/loopwire-detect-audio \ + usr/lib/loopwire/loopwire-gui \ + usr/lib/loopwire/scripts/restore-background.mjs \ + usr/share/applications/loopwire.desktop \ + usr/share/icons/hicolor/scalable/apps/loopwire.svg \ + usr/share/licenses/loopwire-git/LICENSE-MIT; do + grep -Fxq "$member" "$package_members" || { + echo "loopwire-git package does not contain $member." >&2 + exit 1 + } +done + +echo "AUR loopwire-git package build passed for ${actual_version}." diff --git a/scripts/verify-aur-package.sh b/scripts/verify-aur-package.sh index 7cc03c4..f800071 100644 --- a/scripts/verify-aur-package.sh +++ b/scripts/verify-aur-package.sh @@ -15,6 +15,7 @@ trap cleanup EXIT release_dir="$tmp_dir/release" work_dir="$tmp_dir/aur-bin" source_work_dir="$tmp_dir/aur-source" +git_work_dir="$tmp_dir/aur-git" binary="$tmp_dir/loopwire" pnpm --filter @loopwire/core build >/dev/null @@ -38,9 +39,10 @@ bash scripts/package-release.sh \ --arch aarch64 \ --output-dir "$release_dir" >/dev/null -mkdir -p "$work_dir" "$source_work_dir" +mkdir -p "$work_dir" "$source_work_dir" "$git_work_dir" cp packaging/aur/LICENSE-MIT "$work_dir/LICENSE-MIT" cp packaging/aur/LICENSE-MIT "$source_work_dir/LICENSE-MIT" +cp packaging/aur/LICENSE-MIT "$git_work_dir/LICENSE-MIT" bash scripts/render-aur-pkgbuild.sh \ --package loopwire-bin \ --version "0.0.0" \ @@ -118,4 +120,23 @@ if grep -Fq " E: " "$tmp_dir/namcap-source-metadata.log"; then exit 1 fi -echo "AUR binary build and source metadata smokes passed." +bash scripts/render-aur-pkgbuild.sh \ + --package loopwire-git \ + --version "0.1.0.r1.gabcdef0" \ + --default-branch master \ + --pkgrel 1 \ + --output "$git_work_dir/PKGBUILD" >/dev/null +( + cd "$git_work_dir" + makepkg --printsrcinfo >.SRCINFO +) +grep -Fqx "pkgbase = loopwire-git" "$git_work_dir/.SRCINFO" +grep -Fqx $'\tprovides = loopwire=0.1.0.r1.gabcdef0' "$git_work_dir/.SRCINFO" +grep -Fqx $'\tconflicts = loopwire' "$git_work_dir/.SRCINFO" +grep -Fqx $'\tmakedepends = git' "$git_work_dir/.SRCINFO" +if grep -Fq $'\treplaces = ' "$git_work_dir/.SRCINFO"; then + echo "loopwire-git must not declare replaces." >&2 + exit 1 +fi + +echo "AUR binary build plus stable/VCS source metadata smokes passed." diff --git a/scripts/verify-docs.sh b/scripts/verify-docs.sh index d4e9052..22362d2 100644 --- a/scripts/verify-docs.sh +++ b/scripts/verify-docs.sh @@ -289,9 +289,12 @@ assert_contains "apps/docs/docs/guide/install.md" "AUR and Nix package" assert_contains "apps/docs/docs/guide/install.md" "paths declare or wrap that dependency" assert_contains "apps/docs/docs/guide/install.md" "https://aur.archlinux.org/loopwire.git" assert_contains "apps/docs/docs/guide/install.md" "packaging/aur/loopwire-bin/PKGBUILD.in" +assert_contains "apps/docs/docs/guide/install.md" "packaging/aur/loopwire-git/PKGBUILD.in" assert_contains "apps/docs/docs/guide/support-matrix.md" 'AUR `loopwire`' assert_contains "apps/docs/docs/guide/support-matrix.md" 'AUR `loopwire-bin`' +assert_contains "apps/docs/docs/guide/support-matrix.md" 'AUR `loopwire-git`' assert_contains "apps/docs/docs/developer/release.md" "pnpm verify:aur:source" +assert_contains "apps/docs/docs/developer/release.md" "pnpm verify:aur:git" assert_contains "apps/docs/docs/developer/github-actions-setup.md" "AUR_SSH_PRIVATE_KEY" assert_contains "apps/docs/docs/guide/install.md" "fake" assert_contains "apps/docs/docs/guide/install.md" "VitePress public asset" diff --git a/scripts/verify-github-workflows.sh b/scripts/verify-github-workflows.sh index e5b4e02..a658490 100755 --- a/scripts/verify-github-workflows.sh +++ b/scripts/verify-github-workflows.sh @@ -121,6 +121,7 @@ assert_contains ".github/workflows/ci.yml" "xauth" assert_contains ".github/workflows/ci.yml" "xvfb" assert_contains ".github/workflows/ci.yml" "validate-aur-source:" assert_contains ".github/workflows/ci.yml" "scripts/verify-aur-source-package.sh" +assert_contains ".github/workflows/ci.yml" "scripts/verify-aur-git-package.sh" assert_contains "package.json" '"verify:tauri": "bash scripts/verify-tauri.sh"' assert_contains "package.json" "pnpm verify:tauri" @@ -171,6 +172,7 @@ assert_contains ".github/workflows/publish-aur.yml" "AUR_SSH_PRIVATE_KEY" assert_contains ".github/workflows/publish-aur.yml" "scripts/deploy-aur-package.sh" assert_contains ".github/workflows/publish-aur.yml" "archlinux@sha256:" assert_contains ".github/workflows/publish-aur.yml" "loopwire-bin" +assert_contains ".github/workflows/publish-aur.yml" "loopwire-git" assert_not_contains ".github/workflows/publish-aur.yml" "pull_request:" assert_contains ".github/workflows/final-release-proof.yml" "workflow_dispatch:" diff --git a/scripts/verify-packaging.sh b/scripts/verify-packaging.sh index 715e542..207ca45 100755 --- a/scripts/verify-packaging.sh +++ b/scripts/verify-packaging.sh @@ -24,7 +24,12 @@ require_contains packaging/aur/loopwire/PKGBUILD.in "tauri build --no-bundle" require_contains packaging/aur/loopwire/PKGBUILD.in "scripts/package-release.sh" require_contains packaging/aur/loopwire/PKGBUILD.in "usr/share/applications/loopwire.desktop" require_contains packaging/aur/loopwire/PKGBUILD.in "usr/share/icons/hicolor/scalable/apps/loopwire.svg" -require_contains scripts/deploy-aur-package.sh "--package loopwire|loopwire-bin|all" +require_contains packaging/aur/loopwire-git/PKGBUILD.in "pkgname=loopwire-git" +require_contains packaging/aur/loopwire-git/PKGBUILD.in 'provides=("loopwire=${pkgver}")' +require_contains packaging/aur/loopwire-git/PKGBUILD.in 'conflicts=("loopwire")' +require_contains packaging/aur/loopwire-git/PKGBUILD.in '"loopwire::git+${url}.git#branch=@DEFAULT_BRANCH@"' +require_contains packaging/aur/loopwire-git/PKGBUILD.in "git describe --long --tags" +require_contains scripts/deploy-aur-package.sh "--package loopwire|loopwire-bin|loopwire-git|all" require_contains packaging/aur/known_hosts "aur.archlinux.org ssh-ed25519" require_contains packaging/nix/loopwire-bin.nix "loopwire-linux-x86_64.tar.gz" require_contains packaging/nix/loopwire-bin.nix "loopwire-linux-aarch64.tar.gz" diff --git a/scripts/verify-requirements.sh b/scripts/verify-requirements.sh index 468356f..86b5ed8 100644 --- a/scripts/verify-requirements.sh +++ b/scripts/verify-requirements.sh @@ -84,7 +84,9 @@ assert_contains "scripts/install.sh" "detect_arch" assert_contains "scripts/install.sh" "loopwire-linux-aarch64.tar.gz" assert_file "packaging/aur/loopwire/PKGBUILD.in" assert_file "packaging/aur/loopwire-bin/PKGBUILD.in" +assert_file "packaging/aur/loopwire-git/PKGBUILD.in" assert_file "scripts/deploy-aur-package.sh" +assert_file "scripts/verify-aur-git-package.sh" assert_file "scripts/verify-aur-source-package.sh" assert_file "packaging/nix/loopwire-bin.nix" assert_file "flake.nix" @@ -97,6 +99,7 @@ assert_script "package.json" "nix:render-release" "bash scripts/render-nix-relea assert_script "package.json" "verify:nix-release" "bash scripts/verify-nix-release-package.sh" assert_script "package.json" "release:agent-ready" "bash scripts/verify-agent-release-ready.sh" assert_script "package.json" "deploy:aur" "bash scripts/deploy-aur-package.sh" +assert_script "package.json" "verify:aur:git" "bash scripts/verify-aur-git-package.sh" for requirement in DOCS-01 DOCS-02 DOCS-03 DOCS-04; do assert_requirement_checked "$requirement" diff --git a/scripts/verify-scripts.sh b/scripts/verify-scripts.sh index a62a77b..67cafb7 100755 --- a/scripts/verify-scripts.sh +++ b/scripts/verify-scripts.sh @@ -47,6 +47,7 @@ bash -n \ scripts/collect-vm-evidence-ssh.sh \ scripts/collect-vm-matrix-evidence.sh \ scripts/verify-aur-package.sh \ + scripts/verify-aur-git-package.sh \ scripts/verify-aur-source-package.sh \ scripts/verify-packaging.sh \ scripts/verify-native-packaging.sh \ @@ -102,7 +103,7 @@ bash scripts/build-portable-linux-binary.sh -- --help | grep -Fq -- "--output FI echo "verify-scripts: portable builder does not accept the package-script separator" >&2 exit 1 } -bash scripts/deploy-aur-package.sh --help | grep -Fq -- "--package loopwire|loopwire-bin|all" || { +bash scripts/deploy-aur-package.sh --help | grep -Fq -- "--package loopwire|loopwire-bin|loopwire-git|all" || { echo "verify-scripts: AUR deploy helper does not advertise package selection" >&2 exit 1 } @@ -110,6 +111,10 @@ bash scripts/verify-aur-source-package.sh --help | grep -Fq -- "--source-archive echo "verify-scripts: AUR source verifier does not advertise local archive input" >&2 exit 1 } +bash scripts/verify-aur-git-package.sh --help | grep -Fq -- "--version VERSION" || { + echo "verify-scripts: AUR git verifier does not advertise deterministic version input" >&2 + exit 1 +} bash scripts/build-deb-package.sh -- --help | grep -Fq -- "--target ubuntu-24.04|debian-13" || { echo "verify-scripts: deb builder does not accept the package-script separator" >&2 exit 1