From 926d6892ea0b4e056d40c0286e4bc2510854e10d Mon Sep 17 00:00:00 2001 From: Ryan Hughes Date: Sun, 7 Sep 2025 23:23:37 +0200 Subject: [PATCH] Update to support more outputs --- bin/build | 20 +++++++++++++++++--- bin/update-repo | 2 +- build/build.sh | 23 ++++++++++++++++------- 3 files changed, 34 insertions(+), 11 deletions(-) diff --git a/bin/build b/bin/build index f4ea266..9fa3ede 100755 --- a/bin/build +++ b/bin/build @@ -7,8 +7,11 @@ set -e BUILD_ROOT=$(realpath "${BASH_SOURCE[0]%/*}/..") source "$BUILD_ROOT/lib/message-helpers.sh" +# Set default architecture +ARCH=${ARCH:-x86_64} + # Prepare build directories -ARCH_DIR="$BUILD_ROOT/x86_64" +ARCH_DIR="$BUILD_ROOT/output/$ARCH" SRC_DIR="$BUILD_ROOT/src" BUILD_DIR="$BUILD_ROOT/build" @@ -33,6 +36,10 @@ print_header "Omarchy AUR Package Builder" # Parse command line arguments while [[ $# -gt 0 ]]; do case $1 in + --arch) + ARCH="$2" + shift 2 + ;; --skip-signing) SKIP_SIGNING=true shift @@ -41,14 +48,16 @@ while [[ $# -gt 0 ]]; do echo "Usage: $0 [OPTIONS]" echo "" echo "Options:" + echo " --arch Target architecture (x86_64 or aarch64, default: x86_64)" echo " --skip-signing Build packages without GPG signing" echo " -h, --help Show this help message" echo "" echo "This script builds AUR packages from:" echo " build/packages/omarchy-aur.packages" echo "" - echo "Example:" + echo "Examples:" echo " $0 --skip-signing" + echo " $0 --arch aarch64" echo "" exit 0 ;; @@ -59,6 +68,10 @@ while [[ $# -gt 0 ]]; do esac done +# Show target architecture after parsing args +print_info "Target architecture: $ARCH" +print_info "Output directory: $ARCH_DIR" + # Check if AUR package list exists if [[ ! -f "$BUILD_DIR/packages/omarchy-aur.packages" ]]; then print_error "omarchy-aur.packages not found at $BUILD_DIR/packages/" @@ -104,10 +117,11 @@ print_info "Running AUR package build..." # Build Docker arguments DOCKER_ARGS=( --rm + -e ARCH="$ARCH" -e SKIP_SIGNING -e GPG_PRIVATE_KEY -e GPG_PASSPHRASE - -v "$ARCH_DIR:/output" + -v "$BUILD_ROOT/output:/output" -v "$SRC_DIR:/src" -v "$BUILD_DIR:/build:ro" ) diff --git a/bin/update-repo b/bin/update-repo index a1932ec..5f164c2 100755 --- a/bin/update-repo +++ b/bin/update-repo @@ -9,7 +9,7 @@ BUILD_ROOT=$(realpath "${BASH_SOURCE[0]%/*}/..") source "$BUILD_ROOT/lib/message-helpers.sh" # Repository configuration -ARCH_DIR="$BUILD_ROOT/x86_64" +ARCH_DIR="$BUILD_ROOT/output/x86_64" REPO_NAME="omarchy" DB_FILE="$ARCH_DIR/${REPO_NAME}.db.tar.zst" FILES_FILE="$ARCH_DIR/${REPO_NAME}.files.tar.zst" diff --git a/build/build.sh b/build/build.sh index 4d3d0a1..2aed551 100755 --- a/build/build.sh +++ b/build/build.sh @@ -7,9 +7,18 @@ # Sync pacman database sudo pacman -Sy +# Get architecture (default to x86_64 if not set) +ARCH=${ARCH:-x86_64} +OUTPUT_DIR="/output/$ARCH" + echo "==> Package Builder (AUR & GitHub)" +echo "==> Target architecture: $ARCH" +echo "==> Output directory: $OUTPUT_DIR" echo "==> Processing omarchy-aur.packages" +# Create output directory if it doesn't exist +mkdir -p "$OUTPUT_DIR" + # Track failures FAILED_PACKAGES="" SUCCESSFUL_PACKAGES="" @@ -18,14 +27,14 @@ SKIPPED_PACKAGES="" # Get version from local repo database get_local_version() { local pkg="$1" - if [[ -f /output/omarchy.db.tar.zst ]]; then + if [[ -f "$OUTPUT_DIR/omarchy.db.tar.zst" ]]; then # Find the exact desc file for this package # For VCS packages, version might start with 'r' instead of a digit - local desc_file=$(tar -tf /output/omarchy.db.tar.zst | grep "^${pkg}-[0-9r].*/desc$" | head -1) + local desc_file=$(tar -tf "$OUTPUT_DIR/omarchy.db.tar.zst" | grep "^${pkg}-[0-9r].*/desc$" | head -1) if [[ -n "$desc_file" ]]; then # Extract that specific file and get the version - tar -xOf /output/omarchy.db.tar.zst "$desc_file" 2>/dev/null | + tar -xOf "$OUTPUT_DIR/omarchy.db.tar.zst" "$desc_file" 2>/dev/null | awk '/%VERSION%/{getline; print; exit}' fi fi @@ -85,7 +94,7 @@ build_github_package() { # If install option is set, install the existing package for dependencies if [[ "$opts" == *"install"* ]]; then echo " Installing existing package for dependencies..." - local latest_pkg=$(ls -t /output/${pkg}-*.pkg.tar.* 2>/dev/null | grep -v '\.sig$' | head -1) + local latest_pkg=$(ls -t $OUTPUT_DIR/${pkg}-*.pkg.tar.* 2>/dev/null | grep -v '\.sig$' | head -1) if [[ -f "$latest_pkg" ]]; then sudo pacman -U --noconfirm --needed "$latest_pkg" 2>/dev/null || true fi @@ -159,7 +168,7 @@ build_github_package() { # Copy to output (including signature files) for pkg_file in *.pkg.tar.*; do if [[ -f "$pkg_file" ]]; then - cp "$pkg_file" /output/ + cp "$pkg_file" $OUTPUT_DIR/ # Check for install option to make package available for dependencies if [[ "$opts" == *"install"* ]] && [[ "$pkg_file" =~ ^${pkg}-[0-9].*\.pkg\.tar\..* ]] && [[ "$pkg_file" != *.sig ]]; then echo " Installing locally for dependencies..." @@ -216,7 +225,7 @@ build_aur_package() { if [[ "$opts" == *"install"* ]]; then echo " Installing existing package for dependencies..." # Find the main package file in output directory (match package-version pattern, not debug) - local latest_pkg=$(ls -t /output/${pkg}-[0-9]*.pkg.tar.* 2>/dev/null | grep -v '\.sig$' | head -1) + local latest_pkg=$(ls -t $OUTPUT_DIR/${pkg}-[0-9]*.pkg.tar.* 2>/dev/null | grep -v '\.sig$' | head -1) if [[ -f "$latest_pkg" ]]; then sudo pacman -U --noconfirm --needed "$latest_pkg" 2>/dev/null || true else @@ -266,7 +275,7 @@ build_aur_package() { # Copy to output (including signature files) for pkg_file in *.pkg.tar.*; do if [[ -f "$pkg_file" ]]; then - cp "$pkg_file" /output/ + cp "$pkg_file" $OUTPUT_DIR/ # Check for install option to make package available for dependencies if [[ "$opts" == *"install"* ]] && [[ "$pkg_file" =~ ^${pkg}-[0-9].*\.pkg\.tar\..* ]] && [[ "$pkg_file" != *.sig ]]; then echo " Installing locally for dependencies..."