Consolidate more things

This commit is contained in:
Ryan Hughes
2025-10-27 00:38:25 -04:00
parent 51a3318b10
commit b853ddc51a
13 changed files with 50 additions and 46 deletions
+5 -10
View File
@@ -7,16 +7,10 @@ set -e
BUILD_ROOT=$(realpath "${BASH_SOURCE[0]%/*}/..") BUILD_ROOT=$(realpath "${BASH_SOURCE[0]%/*}/..")
source "$BUILD_ROOT/helpers/message-helpers.sh" source "$BUILD_ROOT/helpers/message-helpers.sh"
source "$BUILD_ROOT/helpers/docker-helpers.sh" source "$BUILD_ROOT/helpers/docker-helpers.sh"
source "$BUILD_ROOT/helpers/paths.sh"
ARCH=${ARCH:-x86_64}
BUILD_OUTPUT_DIR="$BUILD_ROOT/build-output/$ARCH"
FINAL_OUTPUT_DIR="$BUILD_ROOT/pkgs.omarchy.org/$ARCH"
SRC_DIR="$BUILD_ROOT/src"
BUILD_DIR="$BUILD_ROOT/build"
# Create directories if they don't exist # Create directories if they don't exist
mkdir -p "$BUILD_OUTPUT_DIR" "$FINAL_OUTPUT_DIR" "$SRC_DIR" mkdir -p "$BUILD_OUTPUT_DIR" "$REPO_DIR" "$SRC_DIR"
print_header "Omarchy AUR Package Builder" print_header "Omarchy AUR Package Builder"
@@ -28,6 +22,7 @@ while [[ $# -gt 0 ]]; do
case $1 in case $1 in
--arch) --arch)
ARCH="$2" ARCH="$2"
update_arch_paths
shift 2 shift 2
;; ;;
--package) --package)
@@ -67,7 +62,7 @@ done
# Show target architecture after parsing args # Show target architecture after parsing args
print_info "Target architecture: $ARCH" print_info "Target architecture: $ARCH"
print_info "Build workspace: $BUILD_OUTPUT_DIR" print_info "Build workspace: $BUILD_OUTPUT_DIR"
print_info "Final output: $FINAL_OUTPUT_DIR" print_info "Final output: $REPO_DIR"
# Clean build-output directory to start fresh # Clean build-output directory to start fresh
print_info "Cleaning build workspace..." print_info "Cleaning build workspace..."
@@ -91,7 +86,7 @@ print_info "Running AUR package build..."
# Ensure output directories are writable by container user # Ensure output directories are writable by container user
make_dir_writable "$BUILD_OUTPUT_DIR" make_dir_writable "$BUILD_OUTPUT_DIR"
make_dir_writable "$FINAL_OUTPUT_DIR" make_dir_writable "$REPO_DIR"
# Build Docker arguments # Build Docker arguments
DOCKER_ARGS=( DOCKER_ARGS=(
+4 -5
View File
@@ -7,10 +7,9 @@ set -e
# Source common functions # Source common functions
BUILD_ROOT=$(realpath "${BASH_SOURCE[0]%/*}/..") BUILD_ROOT=$(realpath "${BASH_SOURCE[0]%/*}/..")
source "$BUILD_ROOT/helpers/message-helpers.sh" source "$BUILD_ROOT/helpers/message-helpers.sh"
source "$BUILD_ROOT/helpers/paths.sh"
# Repository configuration # Repository configuration
ARCH=${ARCH:-x86_64}
ARCH_DIR="$BUILD_ROOT/pkgs.omarchy.org/$ARCH"
KEEP_VERSIONS=2 KEEP_VERSIONS=2
# Function to clean old packages # Function to clean old packages
@@ -20,7 +19,7 @@ clean_packages() {
print_info "Cleaning old packages (keeping $keep versions)..." print_info "Cleaning old packages (keeping $keep versions)..."
cd "$ARCH_DIR" cd "$REPO_DIR"
# Group packages by name # Group packages by name
declare -A packages declare -A packages
@@ -105,7 +104,7 @@ remove_all_packages() {
fi fi
fi fi
cd "$ARCH_DIR" cd "$REPO_DIR"
local count=$(ls -1 *.pkg.tar.* 2>/dev/null | wc -l) local count=$(ls -1 *.pkg.tar.* 2>/dev/null | wc -l)
@@ -130,7 +129,7 @@ remove_all_packages() {
show_disk_usage() { show_disk_usage() {
print_info "Repository Disk Usage:" print_info "Repository Disk Usage:"
cd "$ARCH_DIR" cd "$REPO_DIR"
local total_size=$(du -sh . 2>/dev/null | cut -f1) local total_size=$(du -sh . 2>/dev/null | cut -f1)
local package_count=$(ls -1 *.pkg.tar.* 2>/dev/null | grep -v '\.sig$' | wc -l) local package_count=$(ls -1 *.pkg.tar.* 2>/dev/null | grep -v '\.sig$' | wc -l)
+3 -3
View File
@@ -4,9 +4,9 @@
SCRIPT_DIR=$(realpath "${BASH_SOURCE[0]%/*}") SCRIPT_DIR=$(realpath "${BASH_SOURCE[0]%/*}")
BUILD_ROOT=$(realpath "$SCRIPT_DIR/..") BUILD_ROOT=$(realpath "$SCRIPT_DIR/..")
ARCH=${ARCH:-x86_64} source "$BUILD_ROOT/helpers/paths.sh"
ARCH_DIR="$BUILD_ROOT/pkgs.omarchy.org/$ARCH"
DB_FILE="$ARCH_DIR/omarchy.db.tar.zst" DB_FILE="$REPO_DIR/omarchy.db.tar.zst"
if [[ ! -f "$DB_FILE" ]]; then if [[ ! -f "$DB_FILE" ]]; then
echo "Repository database not found" echo "Repository database not found"
+5 -7
View File
@@ -5,10 +5,7 @@ set -e
BUILD_ROOT=$(realpath "${BASH_SOURCE[0]%/*}/..") BUILD_ROOT=$(realpath "${BASH_SOURCE[0]%/*}/..")
source "$BUILD_ROOT/helpers/message-helpers.sh" source "$BUILD_ROOT/helpers/message-helpers.sh"
source "$BUILD_ROOT/helpers/paths.sh"
ARCH=${ARCH:-x86_64}
BUILD_OUTPUT_DIR="$BUILD_ROOT/build-output/$ARCH"
FINAL_OUTPUT_DIR="$BUILD_ROOT/pkgs.omarchy.org/$ARCH"
print_header "Promote Build to Production" print_header "Promote Build to Production"
@@ -18,6 +15,7 @@ while [[ $# -gt 0 ]]; do
case $1 in case $1 in
--arch) --arch)
ARCH="$2" ARCH="$2"
update_arch_paths
shift 2 shift 2
;; ;;
--dry-run) --dry-run)
@@ -43,7 +41,7 @@ while [[ $# -gt 0 ]]; do
done done
print_info "Build output: $BUILD_OUTPUT_DIR" print_info "Build output: $BUILD_OUTPUT_DIR"
print_info "Final output: $FINAL_OUTPUT_DIR" print_info "Final output: $REPO_DIR"
# Check if build output exists # Check if build output exists
if [[ ! -d "$BUILD_OUTPUT_DIR" ]]; then if [[ ! -d "$BUILD_OUTPUT_DIR" ]]; then
@@ -72,7 +70,7 @@ if [[ "$DRY_RUN" == true ]]; then
done done
else else
echo "" echo ""
mkdir -p "$FINAL_OUTPUT_DIR" mkdir -p "$REPO_DIR"
# Copy all package files (excluding build database) # Copy all package files (excluding build database)
COPIED=0 COPIED=0
@@ -81,7 +79,7 @@ else
[[ "$pkg_file" == omarchy-build.db* ]] && continue [[ "$pkg_file" == omarchy-build.db* ]] && continue
if [[ -f "$pkg_file" ]]; then if [[ -f "$pkg_file" ]]; then
cp -v "$pkg_file" "$FINAL_OUTPUT_DIR/" cp -v "$pkg_file" "$REPO_DIR/"
COPIED=$((COPIED + 1)) COPIED=$((COPIED + 1))
fi fi
done done
+1 -1
View File
@@ -5,8 +5,8 @@ set -e
BUILD_ROOT=$(realpath "${BASH_SOURCE[0]%/*}/..") BUILD_ROOT=$(realpath "${BASH_SOURCE[0]%/*}/..")
source "$BUILD_ROOT/helpers/message-helpers.sh" source "$BUILD_ROOT/helpers/message-helpers.sh"
source "$BUILD_ROOT/helpers/paths.sh"
ARCH=${ARCH:-x86_64}
SYNC_REMOTE="" SYNC_REMOTE=""
SKIP_PROD_CHECK=false SKIP_PROD_CHECK=false
+1 -4
View File
@@ -4,10 +4,7 @@ set -e
BUILD_ROOT=$(realpath "${BASH_SOURCE[0]%/*}/..") BUILD_ROOT=$(realpath "${BASH_SOURCE[0]%/*}/..")
source "$BUILD_ROOT/helpers/message-helpers.sh" source "$BUILD_ROOT/helpers/message-helpers.sh"
source "$BUILD_ROOT/helpers/docker-helpers.sh" source "$BUILD_ROOT/helpers/docker-helpers.sh"
source "$BUILD_ROOT/helpers/paths.sh"
ARCH=${ARCH:-x86_64}
REPO_DIR="$BUILD_ROOT/pkgs.omarchy.org/$ARCH"
BUILD_DIR="$BUILD_ROOT/build"
print_header "Remove Package" print_header "Remove Package"
+1 -1
View File
@@ -10,9 +10,9 @@ BUILD_ROOT=$(realpath "$SCRIPT_DIR/..")
# Source common functions # Source common functions
source "$BUILD_ROOT/helpers/message-helpers.sh" source "$BUILD_ROOT/helpers/message-helpers.sh"
source "$BUILD_ROOT/helpers/paths.sh"
# Setup logging with timestamps # Setup logging with timestamps
LOG_DIR="$BUILD_ROOT/logs"
mkdir -p "$LOG_DIR" mkdir -p "$LOG_DIR"
# Rotate logs first - keep only the 10 most recent # Rotate logs first - keep only the 10 most recent
+2 -4
View File
@@ -6,10 +6,7 @@ set -e
BUILD_ROOT=$(realpath "${BASH_SOURCE[0]%/*}/..") BUILD_ROOT=$(realpath "${BASH_SOURCE[0]%/*}/..")
source "$BUILD_ROOT/helpers/message-helpers.sh" source "$BUILD_ROOT/helpers/message-helpers.sh"
source "$BUILD_ROOT/helpers/docker-helpers.sh" source "$BUILD_ROOT/helpers/docker-helpers.sh"
source "$BUILD_ROOT/helpers/paths.sh"
ARCH=${ARCH:-x86_64}
BUILD_OUTPUT_DIR="$BUILD_ROOT/build-output/$ARCH"
BUILD_DIR="$BUILD_ROOT/build"
print_header "Sign Packages" print_header "Sign Packages"
@@ -18,6 +15,7 @@ while [[ $# -gt 0 ]]; do
case $1 in case $1 in
--arch) --arch)
ARCH="$2" ARCH="$2"
update_arch_paths
shift 2 shift 2
;; ;;
-h | --help) -h | --help)
+1 -1
View File
@@ -2,8 +2,8 @@
BUILD_ROOT=$(realpath "${BASH_SOURCE[0]%/*}/..") BUILD_ROOT=$(realpath "${BASH_SOURCE[0]%/*}/..")
source "$BUILD_ROOT/helpers/message-helpers.sh" source "$BUILD_ROOT/helpers/message-helpers.sh"
source "$BUILD_ROOT/helpers/paths.sh"
PKGBUILDS_DIR="$BUILD_ROOT/pkgbuilds"
PACKAGES_FILE="$BUILD_ROOT/build/packages/omarchy-aur.packages" PACKAGES_FILE="$BUILD_ROOT/build/packages/omarchy-aur.packages"
TEMP_DIR=$(mktemp -d) TEMP_DIR=$(mktemp -d)
+6 -8
View File
@@ -8,10 +8,7 @@ set -e
BUILD_ROOT=$(realpath "${BASH_SOURCE[0]%/*}/..") BUILD_ROOT=$(realpath "${BASH_SOURCE[0]%/*}/..")
source "$BUILD_ROOT/helpers/message-helpers.sh" source "$BUILD_ROOT/helpers/message-helpers.sh"
source "$BUILD_ROOT/helpers/docker-helpers.sh" source "$BUILD_ROOT/helpers/docker-helpers.sh"
source "$BUILD_ROOT/helpers/paths.sh"
ARCH=${ARCH:-x86_64}
BUILD_DIR="$BUILD_ROOT/build"
ARCH_DIR="$BUILD_ROOT/pkgs.omarchy.org/$ARCH"
# Function to update repository database using Docker # Function to update repository database using Docker
update_database() { update_database() {
@@ -21,14 +18,14 @@ update_database() {
check_docker check_docker
# Ensure output directory exists # Ensure output directory exists
if [[ ! -d "$ARCH_DIR" ]]; then if [[ ! -d "$REPO_DIR" ]]; then
print_error "Output directory not found: $ARCH_DIR" print_error "Output directory not found: $REPO_DIR"
print_warning "Run bin/repo build first" print_warning "Run bin/repo build first"
exit 1 exit 1
fi fi
# Make output directory writable for container # Make output directory writable for container
make_dir_writable "$ARCH_DIR" make_dir_writable "$REPO_DIR"
# Build Docker image # Build Docker image
build_docker_image "$BUILD_DIR" build_docker_image "$BUILD_DIR"
@@ -50,6 +47,7 @@ main() {
case $1 in case $1 in
--arch) --arch)
ARCH="$2" ARCH="$2"
update_arch_paths
shift 2 shift 2
;; ;;
-h | --help) -h | --help)
@@ -68,7 +66,7 @@ main() {
done done
print_info "Target architecture: $ARCH" print_info "Target architecture: $ARCH"
print_info "Output directory: $ARCH_DIR" print_info "Output directory: $REPO_DIR"
update_database update_database
-1
View File
@@ -1,4 +1,3 @@
#!/bin/bash
# Docker helper functions for Omarchy package build system # Docker helper functions for Omarchy package build system
# Check Docker is available and running # Check Docker is available and running
-1
View File
@@ -1,4 +1,3 @@
#!/bin/bash
# Common printing functions for Omarchy scripts # Common printing functions for Omarchy scripts
# Colors # Colors
+21
View File
@@ -0,0 +1,21 @@
# Common path variables for Omarchy package build system
# This file should be sourced after setting BUILD_ROOT
# Default architecture
ARCH=${ARCH:-x86_64}
# Core directories (architecture-independent)
BUILD_DIR="$BUILD_ROOT/build"
SRC_DIR="$BUILD_ROOT/src"
LOG_DIR="$BUILD_ROOT/logs"
PKGBUILDS_DIR="$BUILD_ROOT/pkgbuilds"
# Function to update architecture-specific paths
# Call this after changing ARCH variable
update_arch_paths() {
BUILD_OUTPUT_DIR="$BUILD_ROOT/build-output/$ARCH" # Unsigned packages
REPO_DIR="$BUILD_ROOT/pkgs.omarchy.org/$ARCH" # Repository (signed packages)
}
# Initialize architecture-specific directories with default ARCH
update_arch_paths