Update to support more outputs

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