Update builds

This commit is contained in:
Ryan Hughes
2025-10-27 23:22:17 -04:00
parent c2feda64ee
commit 34297628a3
9 changed files with 115 additions and 54 deletions
+23 -11
View File
@@ -26,15 +26,20 @@ while [[ $# -gt 0 ]]; do
shift 2
;;
--package)
SINGLE_PACKAGE="$2"
shift 2
shift
PACKAGES=""
while [[ $# -gt 0 && ! "$1" =~ ^-- ]]; do
PACKAGES="$PACKAGES $1"
shift
done
PACKAGES="${PACKAGES# }"
;;
-h | --help)
echo "Usage: $0 [OPTIONS]"
echo ""
echo "Options:"
echo " --arch <arch> Target architecture (x86_64 or aarch64, default: x86_64)"
echo " --package <name> Build only the specified package (with optional options)"
echo " --package <names> Build only the specified package(s) (space-separated)"
echo " -h, --help Show this help message"
echo ""
echo "This script builds AUR packages from:"
@@ -47,8 +52,7 @@ while [[ $# -gt 0 ]]; do
echo "Examples:"
echo " $0 --arch aarch64"
echo " $0 --package yay"
echo " $0 --package \"elephant install\""
echo " $0 --package \"owner/repo skip-pgp\""
echo " $0 --package yay elephant cursor-bin"
echo ""
exit 0
;;
@@ -69,18 +73,18 @@ print_info "Cleaning build workspace..."
rm -rf "$BUILD_OUTPUT_DIR"/*
mkdir -p "$BUILD_OUTPUT_DIR"
# Check if AUR package list exists (only required if not building single package)
if [[ -z "$SINGLE_PACKAGE" ]]; then
# Check if AUR package list exists (only required if not building specific packages)
if [[ -z "$PACKAGES" ]]; then
if [[ ! -f "$BUILD_DIR/packages/omarchy-aur.packages" ]]; then
print_error "omarchy-aur.packages not found at $BUILD_DIR/packages/"
exit 1
fi
else
print_info "Building single package: $SINGLE_PACKAGE"
print_info "Building packages: $PACKAGES"
fi
# Build/update the Docker image
build_docker_image "$BUILD_DIR"
build_docker_image "$BUILD_DIR" "$ARCH"
print_info "Running AUR package build..."
@@ -92,7 +96,7 @@ make_dir_writable "$REPO_DIR"
DOCKER_ARGS=(
--rm
-e ARCH="$ARCH"
-e SINGLE_PACKAGE="$SINGLE_PACKAGE"
-e PACKAGES="$PACKAGES"
-v "$BUILD_ROOT/build-output:/build-output"
-v "$BUILD_ROOT/pkgs.omarchy.org:/pkgs.omarchy.org"
-v "$BUILD_DIR:/build:ro"
@@ -105,7 +109,15 @@ if [ -d "/var/cache/pacman/pkg" ]; then
fi
# Run the builder with assembled args
docker run "${DOCKER_ARGS[@]}" omarchy-aur-builder:latest /build/build.sh
IMAGE_TAG="omarchy-pkg-builder:latest-$ARCH"
PLATFORM_ARG=""
if [[ "$ARCH" == "aarch64" ]]; then
PLATFORM_ARG="--platform linux/arm64"
elif [[ "$ARCH" == "x86_64" ]]; then
PLATFORM_ARG="--platform linux/amd64"
fi
docker run $PLATFORM_ARG "${DOCKER_ARGS[@]}" "$IMAGE_TAG" /build/build.sh
BUILD_RESULT=$?
+6 -5
View File
@@ -72,20 +72,21 @@ else
echo ""
mkdir -p "$REPO_DIR"
# Copy all package files (excluding build database)
COPIED=0
# Move all package files (excluding build database)
# Using mv instead of cp avoids filesystem sync issues and is atomic
MOVED=0
for pkg_file in *.pkg.tar.*; do
# Skip build database files
[[ "$pkg_file" == omarchy-build.db* ]] && continue
if [[ -f "$pkg_file" ]]; then
cp -v "$pkg_file" "$REPO_DIR/"
COPIED=$((COPIED + 1))
mv -v "$pkg_file" "$REPO_DIR/"
MOVED=$((MOVED + 1))
fi
done
echo ""
print_success "Promoted $COPIED file(s) to pkgs.omarchy.org"
print_success "Promoted $MOVED file(s) to pkgs.omarchy.org"
# Cleanup build directory after successful promotion
print_info "Cleaning up build directory..."
+5 -5
View File
@@ -52,20 +52,20 @@ if [[ ! $REPLY =~ ^[Yy]$ ]]; then
exit 0
fi
# Build/update the Docker image
build_docker_image "$BUILD_DIR"
# Build/update the Docker image (always use x86_64 for removal - it's architecture independent)
build_docker_image "$BUILD_DIR" "x86_64"
print_info "Removing package..."
# Ensure directory is writable by container user
make_dir_writable "$REPO_DIR"
# Run the removal script in Docker
docker run --rm \
# Run the removal script in Docker (always use x86_64 image)
docker run --rm --platform linux/amd64 \
-e ARCH="$ARCH" \
-v "$BUILD_ROOT/pkgs.omarchy.org:/pkgs.omarchy.org" \
-v "$BUILD_DIR:/build:ro" \
omarchy-aur-builder:latest /build/remove-package.sh "$PACKAGE_NAME"
omarchy-pkg-builder:latest-x86_64 /build/remove-package.sh "$PACKAGE_NAME"
RESULT=$?
+5 -5
View File
@@ -59,22 +59,22 @@ if [[ -z "$GPG_PASSPHRASE" ]]; then
exit 1
fi
# Build/update the Docker image (reuse same image as build)
build_docker_image "$BUILD_DIR"
# Build/update the Docker image (always use x86_64 for signing - it's architecture independent)
build_docker_image "$BUILD_DIR" "x86_64"
print_info "Running package signing..."
# Ensure output directory is writable by container user
make_dir_writable "$BUILD_OUTPUT_DIR"
# Run the signing script in Docker
docker run --rm \
# Run the signing script in Docker (always use x86_64 image)
docker run --rm --platform linux/amd64 \
-e ARCH="$ARCH" \
-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-aur-builder:latest /build/sign.sh
omarchy-pkg-builder:latest-x86_64 /build/sign.sh
SIGN_RESULT=$?