From 08b70043e42527570632c8b97c93f4b96156e383 Mon Sep 17 00:00:00 2001 From: "Aaron D. Lee" Date: Sun, 11 Jan 2026 20:31:00 -0500 Subject: [PATCH] Update PKGBUILD versions and add AUR test scripts - Update pkgver fallback to 4.2.1 in all PKGBUILDs - Add test-aur-build.sh for Docker-based testing - Add test-aur-nspawn.sh for systemd-nspawn testing Co-Authored-By: Claude Opus 4.5 --- aur-api/PKGBUILD | 2 +- aur-cli/PKGBUILD | 2 +- aur/PKGBUILD | 2 +- test-aur-build.sh | 107 +++++++++++++++++++++++++++++++++++++ test-aur-nspawn.sh | 130 +++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 240 insertions(+), 3 deletions(-) create mode 100644 test-aur-build.sh create mode 100644 test-aur-nspawn.sh diff --git a/aur-api/PKGBUILD b/aur-api/PKGBUILD index a4f23d6..5e91c2e 100644 --- a/aur-api/PKGBUILD +++ b/aur-api/PKGBUILD @@ -1,6 +1,6 @@ # Maintainer: Aaron D. Lee pkgname=stegasoo-api-git -pkgver=4.2.0.r6.g34ede38 +pkgver=4.2.1 pkgrel=1 pkgdesc="Stegasoo REST API with TLS and API key authentication" arch=('x86_64') diff --git a/aur-cli/PKGBUILD b/aur-cli/PKGBUILD index 55224a4..4d455e5 100644 --- a/aur-cli/PKGBUILD +++ b/aur-cli/PKGBUILD @@ -1,6 +1,6 @@ # Maintainer: Aaron D. Lee pkgname=stegasoo-cli-git -pkgver=4.2.0.r4.g525bcec +pkgver=4.2.1 pkgrel=1 pkgdesc="Secure steganography CLI with hybrid photo + passphrase + PIN authentication" arch=('x86_64') diff --git a/aur/PKGBUILD b/aur/PKGBUILD index 1152a79..b377eea 100644 --- a/aur/PKGBUILD +++ b/aur/PKGBUILD @@ -1,6 +1,6 @@ # Maintainer: Aaron D. Lee pkgname=stegasoo-git -pkgver=4.2.0.r0.g2ebc42f +pkgver=4.2.1 pkgrel=1 pkgdesc="Secure steganography with hybrid photo + passphrase + PIN authentication" arch=('x86_64') diff --git a/test-aur-build.sh b/test-aur-build.sh new file mode 100644 index 0000000..c239905 --- /dev/null +++ b/test-aur-build.sh @@ -0,0 +1,107 @@ +#!/bin/bash +# Test AUR package builds in a clean Arch container +# +# Usage: sudo ./test-aur-build.sh [package] +# package: all (default), full, cli, api + +set -e + +PACKAGE="${1:-all}" +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" + +echo "=== Stegasoo AUR Build Test ===" +echo "Package: $PACKAGE" +echo "" + +# Create a test script to run inside container +cat > /tmp/aur-build-test.sh << 'INNERSCRIPT' +#!/bin/bash +set -e + +# Update system +pacman -Syu --noconfirm + +# Install build dependencies +pacman -S --noconfirm --needed \ + base-devel git python python-build python-hatchling \ + zbar + +# Create build user (makepkg won't run as root) +useradd -m builder +echo "builder ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers + +# Copy source to build location +cp -r /src /home/builder/stegasoo +chown -R builder:builder /home/builder/stegasoo + +build_package() { + local pkg_dir="$1" + local pkg_name="$2" + + echo "" + echo "==========================================" + echo "Building: $pkg_name" + echo "==========================================" + + cd "/home/builder/stegasoo/$pkg_dir" + + # Build as non-root user + sudo -u builder makepkg -sf --noconfirm + + # Show result + ls -lh *.pkg.tar.zst + + # Test install + echo "Installing $pkg_name..." + pacman -U --noconfirm *.pkg.tar.zst + + # Quick test + echo "Testing $pkg_name..." + stegasoo --version + stegasoo --help | head -20 + + # Uninstall for next test + pacman -R --noconfirm "${pkg_name%-git}" 2>/dev/null || pacman -R --noconfirm "$pkg_name" 2>/dev/null || true + + echo "$pkg_name: SUCCESS" +} + +case "$1" in + full) + build_package "aur" "stegasoo-git" + ;; + cli) + build_package "aur-cli" "stegasoo-cli-git" + ;; + api) + build_package "aur-api" "stegasoo-api-git" + ;; + all) + build_package "aur" "stegasoo-git" + build_package "aur-cli" "stegasoo-cli-git" + build_package "aur-api" "stegasoo-api-git" + ;; + *) + echo "Unknown package: $1" + exit 1 + ;; +esac + +echo "" +echo "==========================================" +echo "All builds completed successfully!" +echo "==========================================" +INNERSCRIPT + +chmod +x /tmp/aur-build-test.sh + +# Run in Arch container +echo "Starting Arch container..." +docker run --rm -it \ + -v "$SCRIPT_DIR:/src:ro" \ + -v "/tmp/aur-build-test.sh:/build.sh:ro" \ + archlinux:latest \ + /bin/bash -c "chmod +x /build.sh && /build.sh $PACKAGE" + +echo "" +echo "=== Build test complete ===" diff --git a/test-aur-nspawn.sh b/test-aur-nspawn.sh new file mode 100644 index 0000000..373c781 --- /dev/null +++ b/test-aur-nspawn.sh @@ -0,0 +1,130 @@ +#!/bin/bash +# Test AUR package builds using systemd-nspawn +# +# Usage: sudo ./test-aur-nspawn.sh [package] +# package: all (default), full, cli, api +# +# First run creates Arch root at /tmp/arch-build-root + +set -e + +PACKAGE="${1:-all}" +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +ARCH_ROOT="/tmp/arch-build-root" + +echo "=== Stegasoo AUR Build Test (nspawn) ===" +echo "Package: $PACKAGE" +echo "Arch root: $ARCH_ROOT" +echo "" + +# Check for root +if [ "$EUID" -ne 0 ]; then + echo "Please run as root (sudo)" + exit 1 +fi + +# Create Arch root if it doesn't exist +if [ ! -d "$ARCH_ROOT/usr" ]; then + echo "Creating Arch root (first time setup)..." + mkdir -p "$ARCH_ROOT" + pacstrap -c "$ARCH_ROOT" base base-devel git python python-build python-hatchling zbar + echo "Arch root created." +else + echo "Using existing Arch root." + # Update packages + arch-chroot "$ARCH_ROOT" pacman -Syu --noconfirm +fi + +# Create build user if needed +if ! arch-chroot "$ARCH_ROOT" id builder &>/dev/null; then + arch-chroot "$ARCH_ROOT" useradd -m builder + echo "builder ALL=(ALL) NOPASSWD: ALL" >> "$ARCH_ROOT/etc/sudoers" +fi + +# Copy source +rm -rf "$ARCH_ROOT/home/builder/stegasoo" +cp -r "$SCRIPT_DIR" "$ARCH_ROOT/home/builder/stegasoo" +arch-chroot "$ARCH_ROOT" chown -R builder:builder /home/builder/stegasoo + +# Create build script +cat > "$ARCH_ROOT/tmp/build.sh" << 'BUILDSCRIPT' +#!/bin/bash +set -e + +build_package() { + local pkg_dir="$1" + local pkg_name="$2" + + echo "" + echo "==========================================" + echo "Building: $pkg_name" + echo "==========================================" + + cd "/home/builder/stegasoo/$pkg_dir" + + # Clean previous builds + rm -rf src pkg *.pkg.tar.zst "${pkg_name}" 2>/dev/null || true + + # Build as non-root user + sudo -u builder makepkg -sf --noconfirm + + # Show result + ls -lh *.pkg.tar.zst + + # Test install + echo "Installing $pkg_name..." + pacman -U --noconfirm *.pkg.tar.zst + + # Quick test + echo "Testing $pkg_name..." + /usr/bin/stegasoo --version + + # More tests for API package + if [[ "$pkg_name" == *"api"* ]]; then + /usr/bin/stegasoo api --help + /usr/bin/stegasoo api keys list + fi + + # Uninstall for next test + pacman -Rns --noconfirm $(pacman -Qq | grep stegasoo) 2>/dev/null || true + + echo "$pkg_name: SUCCESS" +} + +case "$1" in + full) + build_package "aur" "stegasoo-git" + ;; + cli) + build_package "aur-cli" "stegasoo-cli-git" + ;; + api) + build_package "aur-api" "stegasoo-api-git" + ;; + all) + build_package "aur-cli" "stegasoo-cli-git" + build_package "aur-api" "stegasoo-api-git" + build_package "aur" "stegasoo-git" + ;; + *) + echo "Unknown package: $1" + exit 1 + ;; +esac + +echo "" +echo "==========================================" +echo "All builds completed successfully!" +echo "==========================================" +BUILDSCRIPT + +chmod +x "$ARCH_ROOT/tmp/build.sh" + +# Run build in nspawn container +echo "Starting nspawn container..." +systemd-nspawn -D "$ARCH_ROOT" --bind-ro="$SCRIPT_DIR:/home/builder/stegasoo" /tmp/build.sh "$PACKAGE" + +echo "" +echo "=== Build test complete ===" +echo "Arch root preserved at: $ARCH_ROOT" +echo "To clean up: sudo rm -rf $ARCH_ROOT"