From 4b5342ba66276bd3f8871f4d2d99a082bb53be32 Mon Sep 17 00:00:00 2001 From: Ryan Hughes Date: Mon, 10 Nov 2025 11:03:37 -0500 Subject: [PATCH] Add stable / edge --- bin/build | 18 +++++++++++++++--- bin/clean-repo | 27 +++++++++++++++++++++----- bin/list-packages | 35 +++++++++++++++++++++++++++++++++- bin/promote-build | 13 ++++++++++--- bin/release | 13 +++++++++---- bin/remove-package | 47 ++++++++++++++++++++++++++++++++++++++++------ bin/sign | 16 ++++++++++++---- bin/sync-repo | 7 ++++--- bin/update-repo | 16 ++++++++++++---- 9 files changed, 159 insertions(+), 33 deletions(-) diff --git a/bin/build b/bin/build index f2b5455..6c00572 100755 --- a/bin/build +++ b/bin/build @@ -25,6 +25,14 @@ while [[ $# -gt 0 ]]; do update_arch_paths shift 2 ;; + --mirror) + MIRROR="$2" + if [[ "$MIRROR" != "edge" && "$MIRROR" != "stable" ]]; then + print_error "Invalid mirror: $MIRROR (must be 'edge' or 'stable')" + exit 1 + fi + shift 2 + ;; --package) shift PACKAGES="" @@ -39,6 +47,7 @@ while [[ $# -gt 0 ]]; do echo "" echo "Options:" echo " --arch Target architecture (x86_64 or aarch64, default: x86_64)" + echo " --mirror Mirror to use (edge or stable, default: edge)" echo " --package Build only the specified package(s) (space-separated)" echo " -h, --help Show this help message" echo "" @@ -51,6 +60,7 @@ while [[ $# -gt 0 ]]; do echo "" echo "Examples:" echo " $0 --arch aarch64" + echo " $0 --mirror stable" echo " $0 --package yay" echo " $0 --package yay elephant cursor-bin" echo "" @@ -63,8 +73,9 @@ while [[ $# -gt 0 ]]; do esac done -# Show target architecture after parsing args +# Show target architecture and mirror after parsing args print_info "Target architecture: $ARCH" +print_info "Mirror: $MIRROR" print_info "Build workspace: $BUILD_OUTPUT_DIR" print_info "Final output: $REPO_DIR" @@ -93,7 +104,7 @@ else fi # Build/update the Docker image -build_docker_image "$BUILD_DIR" "$ARCH" +build_docker_image "$BUILD_DIR" "$ARCH" "$MIRROR" print_info "Running AUR package build..." @@ -105,6 +116,7 @@ make_dir_writable "$REPO_DIR" DOCKER_ARGS=( --rm -e ARCH="$ARCH" + -e MIRROR="$MIRROR" -e PACKAGES="$PACKAGES" -v "$BUILD_ROOT/build-output:/build-output" -v "$BUILD_ROOT/pkgs.omarchy.org:/pkgs.omarchy.org" @@ -113,7 +125,7 @@ DOCKER_ARGS=( ) # Run the builder with assembled args -IMAGE_TAG="omarchy-pkg-builder:latest-$ARCH" +IMAGE_TAG="omarchy-pkg-builder:latest-$ARCH-$MIRROR" PLATFORM_ARG=$(get_platform_arg "$ARCH") docker run $PLATFORM_ARG "${DOCKER_ARGS[@]}" "$IMAGE_TAG" /build/build.sh diff --git a/bin/clean-repo b/bin/clean-repo index 2d5e93f..dc49d41 100755 --- a/bin/clean-repo +++ b/bin/clean-repo @@ -146,6 +146,11 @@ show_disk_usage() { # Main execution main() { print_header "Omarchy Repository Cleaner" + + print_info "Mirror: $MIRROR" + print_info "Architecture: $ARCH" + print_info "Repository: $REPO_DIR" + echo "" # Parse command line arguments DRY_RUN=false @@ -154,6 +159,16 @@ main() { while [[ $# -gt 0 ]]; do case $1 in + --arch) + ARCH="$2" + update_arch_paths + shift 2 + ;; + --mirror) + MIRROR="$2" + update_arch_paths + shift 2 + ;; --keep) KEEP_VERSIONS="$2" shift 2 @@ -174,11 +189,13 @@ main() { echo "Usage: $0 [OPTIONS]" echo "" echo "Options:" - echo " --keep N Keep N versions of each package (default: 2)" - echo " --dry-run Preview what would be removed without removing" - echo " --all Remove ALL packages (dangerous!)" - echo " --usage Show disk usage statistics" - echo " -h, --help Show this help message" + echo " --arch Target architecture (x86_64 or aarch64, default: x86_64)" + echo " --mirror Mirror to use (edge or stable, default: edge)" + echo " --keep N Keep N versions of each package (default: 2)" + echo " --dry-run Preview what would be removed without removing" + echo " --all Remove ALL packages (dangerous!)" + echo " --usage Show disk usage statistics" + echo " -h, --help Show this help message" echo "" echo "Examples:" echo " $0 # Keep 2 versions (default)" diff --git a/bin/list-packages b/bin/list-packages index d5fe61b..0fec794 100755 --- a/bin/list-packages +++ b/bin/list-packages @@ -4,15 +4,48 @@ SCRIPT_DIR=$(realpath "${BASH_SOURCE[0]%/*}") BUILD_ROOT=$(realpath "$SCRIPT_DIR/..") +source "$BUILD_ROOT/helpers/message-helpers.sh" source "$BUILD_ROOT/helpers/paths.sh" +# Parse arguments +while [[ $# -gt 0 ]]; do + case $1 in + --arch) + ARCH="$2" + update_arch_paths + shift 2 + ;; + --mirror) + MIRROR="$2" + update_arch_paths + shift 2 + ;; + -h | --help) + echo "Usage: $0 [OPTIONS]" + echo "" + echo "Options:" + echo " --arch Target architecture (x86_64 or aarch64, default: x86_64)" + echo " --mirror Mirror to use (edge or stable, default: edge)" + echo " -h, --help Show this help message" + exit 0 + ;; + *) + print_error "Unknown option: $1" + exit 1 + ;; + esac +done + DB_FILE="$REPO_DIR/omarchy.db.tar.zst" if [[ ! -f "$DB_FILE" ]]; then - echo "Repository database not found" + echo "Repository database not found: $DB_FILE" exit 1 fi +echo "Packages in $MIRROR mirror ($ARCH):" +echo "" + # Extract package names and versions from database tar -xOf "$DB_FILE" --wildcards "*/desc" 2>/dev/null | awk '/%NAME%/{getline; name=$0} diff --git a/bin/promote-build b/bin/promote-build index 2724f8d..57c9a46 100755 --- a/bin/promote-build +++ b/bin/promote-build @@ -18,6 +18,11 @@ while [[ $# -gt 0 ]]; do update_arch_paths shift 2 ;; + --mirror) + MIRROR="$2" + update_arch_paths + shift 2 + ;; --dry-run) DRY_RUN=true shift @@ -26,9 +31,10 @@ while [[ $# -gt 0 ]]; do echo "Usage: $0 [OPTIONS]" echo "" echo "Options:" - echo " --arch Target architecture (x86_64 or aarch64, default: x86_64)" - echo " --dry-run Show what would be copied without copying" - echo " -h, --help Show this help message" + echo " --arch Target architecture (x86_64 or aarch64, default: x86_64)" + echo " --mirror Mirror to use (edge or stable, default: edge)" + echo " --dry-run Show what would be copied without copying" + echo " -h, --help Show this help message" echo "" echo "This script promotes packages from build-output/ to pkgs.omarchy.org/" exit 0 @@ -40,6 +46,7 @@ while [[ $# -gt 0 ]]; do esac done +print_info "Mirror: $MIRROR" print_info "Build output: $BUILD_OUTPUT_DIR" print_info "Final output: $REPO_DIR" diff --git a/bin/release b/bin/release index 41e0d2b..759055d 100755 --- a/bin/release +++ b/bin/release @@ -30,6 +30,10 @@ while [[ $# -gt 0 ]]; do BUILD_ARGS+=("--arch" "$2") shift 2 ;; + --mirror) + BUILD_ARGS+=("--mirror" "$2") + shift 2 + ;; --package) BUILD_ARGS+=("--package" "$2") shift 2 @@ -47,6 +51,7 @@ while [[ $# -gt 0 ]]; do echo "" echo "Options:" echo " --arch Target architecture (x86_64 or aarch64, default: x86_64)" + echo " --mirror Mirror to use (edge or stable, default: edge)" echo " --package Build only the specified package" echo " --sync-remote Rclone remote for sync (default: pkgs.omarchy.org:omarchy-pkgs)" echo " --skip-prod-check Skip production environment check during sync" @@ -74,7 +79,7 @@ print_info "Step 1/5: Building packages..." # Step 2: Sign echo "" print_info "Step 2/5: Signing packages..." -"$BUILD_ROOT/bin/sign" --arch "$ARCH" || { +"$BUILD_ROOT/bin/sign" --arch "$ARCH" --mirror "$MIRROR" || { print_error "Signing failed" exit 1 } @@ -82,7 +87,7 @@ print_info "Step 2/5: Signing packages..." # Step 3: Promote echo "" print_info "Step 3/5: Promoting to production..." -"$BUILD_ROOT/bin/promote-build" --arch "$ARCH" || { +"$BUILD_ROOT/bin/promote-build" --arch "$ARCH" --mirror "$MIRROR" || { print_error "Promotion failed" exit 1 } @@ -90,7 +95,7 @@ print_info "Step 3/5: Promoting to production..." # Step 4: Clean (which also updates the repo) echo "" print_info "Step 4/5: Cleaning old versions..." -"$BUILD_ROOT/bin/clean-repo" || { +"$BUILD_ROOT/bin/clean-repo" --arch "$ARCH" --mirror "$MIRROR" || { print_error "Cleaning failed" exit 1 } @@ -98,7 +103,7 @@ print_info "Step 4/5: Cleaning old versions..." # Step 5: Sync echo "" print_info "Step 5/5: Syncing to remote..." -SYNC_ARGS=("pkgs.omarchy.org/$ARCH") +SYNC_ARGS=("pkgs.omarchy.org/$MIRROR/$ARCH") if [[ -n "$SYNC_REMOTE" ]]; then SYNC_ARGS+=("--remote" "$SYNC_REMOTE") fi diff --git a/bin/remove-package b/bin/remove-package index 8c1f952..4fcc329 100755 --- a/bin/remove-package +++ b/bin/remove-package @@ -8,16 +8,50 @@ source "$BUILD_ROOT/helpers/paths.sh" print_header "Remove Package" -if [[ -z "$1" ]]; then +# Parse arguments +PACKAGE_NAME="" +while [[ $# -gt 0 ]]; do + case $1 in + --arch) + ARCH="$2" + update_arch_paths + shift 2 + ;; + --mirror) + MIRROR="$2" + update_arch_paths + shift 2 + ;; + -h | --help) + echo "Usage: $0 [OPTIONS]" + echo "" + echo "Options:" + echo " --arch Target architecture (x86_64 or aarch64, default: x86_64)" + echo " --mirror Mirror to use (edge or stable, default: edge)" + echo " -h, --help Show this help message" + exit 0 + ;; + *) + if [[ -z "$PACKAGE_NAME" ]]; then + PACKAGE_NAME="$1" + else + print_error "Unknown option: $1" + exit 1 + fi + shift + ;; + esac +done + +if [[ -z "$PACKAGE_NAME" ]]; then print_error "Package name required" echo "" - echo "Usage: $0 " + echo "Usage: $0 [OPTIONS]" exit 1 fi -PACKAGE_NAME="$1" - print_info "Target architecture: $ARCH" +print_info "Mirror: $MIRROR" print_info "Repository: $REPO_DIR" # Check if repository exists @@ -53,7 +87,7 @@ if [[ ! $REPLY =~ ^[Yy]$ ]]; then fi # Build/update the Docker image (always use x86_64 for removal - it's architecture independent) -build_docker_image "$BUILD_DIR" "x86_64" +build_docker_image "$BUILD_DIR" "x86_64" "$MIRROR" print_info "Removing package..." @@ -63,9 +97,10 @@ make_dir_writable "$REPO_DIR" # Run the removal script in Docker (always use x86_64 image) docker run --rm --platform linux/amd64 \ -e ARCH="$ARCH" \ + -e MIRROR="$MIRROR" \ -v "$BUILD_ROOT/pkgs.omarchy.org:/pkgs.omarchy.org" \ -v "$BUILD_DIR:/build:ro" \ - omarchy-pkg-builder:latest-x86_64 /build/remove-package.sh "$PACKAGE_NAME" + omarchy-pkg-builder:latest-x86_64-$MIRROR /build/remove-package.sh "$PACKAGE_NAME" RESULT=$? diff --git a/bin/sign b/bin/sign index db6d2e5..26db2b8 100755 --- a/bin/sign +++ b/bin/sign @@ -18,12 +18,18 @@ while [[ $# -gt 0 ]]; do update_arch_paths shift 2 ;; + --mirror) + MIRROR="$2" + update_arch_paths + shift 2 + ;; -h | --help) echo "Usage: $0 [OPTIONS]" echo "" echo "Options:" - echo " --arch Target architecture (x86_64 or aarch64, default: x86_64)" - echo " -h, --help Show this help message" + echo " --arch Target architecture (x86_64 or aarch64, default: x86_64)" + echo " --mirror Mirror to use (edge or stable, default: edge)" + echo " -h, --help Show this help message" echo "" echo "This script signs all packages in build-output/" exit 0 @@ -36,6 +42,7 @@ while [[ $# -gt 0 ]]; do done print_info "Target architecture: $ARCH" +print_info "Mirror: $MIRROR" print_info "Build output: $BUILD_OUTPUT_DIR" # Check if build output exists @@ -60,7 +67,7 @@ if [[ -z "$GPG_PASSPHRASE" ]]; then fi # Build/update the Docker image (always use x86_64 for signing - it's architecture independent) -build_docker_image "$BUILD_DIR" "x86_64" +build_docker_image "$BUILD_DIR" "x86_64" "$MIRROR" print_info "Running package signing..." @@ -70,11 +77,12 @@ make_dir_writable "$BUILD_OUTPUT_DIR" # Run the signing script in Docker (always use x86_64 image) docker run --rm --platform linux/amd64 \ -e ARCH="$ARCH" \ + -e MIRROR="$MIRROR" \ -e GPG_PRIVATE_KEY="$GPG_PRIVATE_KEY" \ -e GPG_PASSPHRASE="$GPG_PASSPHRASE" \ -v "$BUILD_ROOT/build-output:/build-output" \ -v "$BUILD_DIR:/build:ro" \ - omarchy-pkg-builder:latest-x86_64 /build/sign.sh + omarchy-pkg-builder:latest-x86_64-$MIRROR /build/sign.sh SIGN_RESULT=$? diff --git a/bin/sync-repo b/bin/sync-repo index 0d6c96c..1276034 100755 --- a/bin/sync-repo +++ b/bin/sync-repo @@ -18,9 +18,10 @@ if [ $# -eq 0 ] || [[ "$1" == "-h" ]] || [[ "$1" == "--help" ]]; then echo " --skip-prod-check Skip production sync confirmation" echo "" echo "Examples:" - echo " $0 pkgs.omarchy.org/x86_64 # Sync to production (with confirmation)" - echo " $0 pkgs.omarchy.org/x86_64 --remote dev-pkgs:/ # Sync to dev remote" - echo " $0 pkgs.omarchy.org/x86_64 --skip-prod-check # Sync without confirmation" + echo " $0 pkgs.omarchy.org/edge/x86_64 # Sync edge mirror to production (with confirmation)" + echo " $0 pkgs.omarchy.org/stable/x86_64 # Sync stable mirror to production" + echo " $0 pkgs.omarchy.org/edge/x86_64 --remote dev-pkgs:/ # Sync to dev remote" + echo " $0 pkgs.omarchy.org/edge/x86_64 --skip-prod-check # Sync without confirmation" exit 0 fi diff --git a/bin/update-repo b/bin/update-repo index 9d7aa52..08c3f9d 100755 --- a/bin/update-repo +++ b/bin/update-repo @@ -28,14 +28,15 @@ update_database() { make_dir_writable "$REPO_DIR" # Build Docker image (always use x86_64 for repo update - it's architecture independent) - build_docker_image "$BUILD_DIR" "x86_64" + build_docker_image "$BUILD_DIR" "x86_64" "$MIRROR" # Run repo-add in Docker container (always use x86_64 image) docker run --rm --platform linux/amd64 \ -e ARCH="$ARCH" \ + -e MIRROR="$MIRROR" \ -v "$BUILD_ROOT/pkgs.omarchy.org:/output" \ -v "$BUILD_DIR:/build:ro" \ - omarchy-pkg-builder:latest-x86_64 /build/update-repo.sh + omarchy-pkg-builder:latest-x86_64-$MIRROR /build/update-repo.sh } # Main execution @@ -50,12 +51,18 @@ main() { update_arch_paths shift 2 ;; + --mirror) + MIRROR="$2" + update_arch_paths + shift 2 + ;; -h | --help) echo "Usage: $0 [OPTIONS]" echo "" echo "Options:" - echo " --arch Target architecture (x86_64 or aarch64, default: x86_64)" - echo " -h, --help Show this help message" + echo " --arch Target architecture (x86_64 or aarch64, default: x86_64)" + echo " --mirror Mirror to use (edge or stable, default: edge)" + echo " -h, --help Show this help message" exit 0 ;; *) @@ -66,6 +73,7 @@ main() { done print_info "Target architecture: $ARCH" + print_info "Mirror: $MIRROR" print_info "Output directory: $REPO_DIR" update_database