Create shared / fast track for certain packages

This commit is contained in:
Ryan Hughes committed 2026-01-10 20:18:35 -05:00
1 parent 1dfa83863d
commit 45a356eb70
253 files changed
+566 -458

No files matched your search

+9 -12
View File
@@ -52,12 +52,12 @@ while [[ $# -gt 0 ]]; do
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:"
echo " build/packages/omarchy-aur.packages"
echo "This script builds packages from pkgbuilds/ directories based on mirror:"
echo " --mirror edge: builds from pkgbuilds/edge/ + pkgbuilds/shared/"
echo " --mirror stable: builds from pkgbuilds/stable/ + pkgbuilds/shared/"
echo ""
echo "Or build a single package with --package:"
echo " Package can be: AUR package, GitHub repo (owner/repo), or local PKGBUILD"
echo " Options can be appended after package name (skip-pgp, install, always-build, etc.)"
echo "Or build specific packages with --package:"
echo " Package names should match directories in the relevant pkgbuilds/ tier"
echo ""
echo "Examples:"
echo " $0 --arch aarch64"
@@ -94,14 +94,11 @@ 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 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
# Show package info
if [[ -n "$PACKAGES" ]]; then
print_info "Building packages: $PACKAGES"
else
print_info "Building all packages for $MIRROR mirror"
fi
# Build/update the Docker image
-16
View File
@@ -1,16 +0,0 @@
#!/bin/bash
# Check for upstream changes and create state files if updates were pulled
set -e
REPO_DIR=/root/omarchy-pkgs
STATE_DIR=/root/.state
mkdir -p "$STATE_DIR"
cd "$REPO_DIR"
git fetch origin master --quiet
if [[ $(git rev-parse HEAD) != $(git rev-parse origin/master) ]]; then
git pull --ff-only origin master
touch "$STATE_DIR/.sync-needed-edge"
fi
+139
View File
@@ -0,0 +1,139 @@
#!/bin/bash
# Check PKGBUILD versions against published repo versions
# Creates state files for edge and/or stable if any packages need building
set -e
BUILD_ROOT=$(realpath "${BASH_SOURCE[0]%/*}/..")
source "$BUILD_ROOT/helpers/message-helpers.sh"
source "$BUILD_ROOT/helpers/paths.sh"
STATE_DIR="${OMARCHY_STATE_DIR:-/root/.state}"
ARCH="${ARCH:-x86_64}"
# Ensure state directory exists
mkdir -p "$STATE_DIR"
print_header "Package Version Check"
# Get version from repo database
get_repo_version() {
local pkg="$1"
local mirror="$2"
local repo_db="$BUILD_ROOT/pkgs.omarchy.org/$mirror/$ARCH/omarchy.db.tar.zst"
if [[ -f "$repo_db" ]]; then
local desc_file=$(tar -tf "$repo_db" 2>/dev/null | grep "^${pkg}-[0-9r].*/desc$" | head -1)
if [[ -n "$desc_file" ]]; then
tar -xOf "$repo_db" "$desc_file" 2>/dev/null | awk '/%VERSION%/{getline; print; exit}'
fi
fi
}
# Get version from PKGBUILD
get_pkgbuild_version() {
local pkgdir="$1"
if [[ -f "$pkgdir/PKGBUILD" ]]; then
(cd "$pkgdir" && bash -c 'source PKGBUILD 2>/dev/null; if [[ -n "$epoch" ]]; then echo "${epoch}:${pkgver}-${pkgrel}"; else echo "${pkgver}-${pkgrel}"; fi')
fi
}
# Check if package needs building for a mirror
check_package() {
local pkg="$1"
local pkgdir="$2"
local mirror="$3"
local pkgbuild_version=$(get_pkgbuild_version "$pkgdir")
local repo_version=$(get_repo_version "$pkg" "$mirror")
if [[ -z "$pkgbuild_version" ]]; then
return 1 # Can't read version, skip
fi
if [[ "$pkgbuild_version" != "$repo_version" ]]; then
return 0 # Needs building
fi
return 1 # Up to date
}
edge_needs_build=false
stable_needs_build=false
edge_packages=()
stable_packages=()
print_info "Checking edge packages..."
# Check edge/ packages -> only affects edge
for pkgdir in "$BUILD_ROOT/pkgbuilds/edge"/*/; do
[[ ! -d "$pkgdir" ]] && continue
pkg=$(basename "$pkgdir")
[[ ! -f "$pkgdir/PKGBUILD" ]] && continue
if check_package "$pkg" "$pkgdir" "edge"; then
edge_needs_build=true
edge_packages+=("$pkg")
fi
done
print_info "Checking stable packages..."
# Check stable/ packages -> only affects stable
for pkgdir in "$BUILD_ROOT/pkgbuilds/stable"/*/; do
[[ ! -d "$pkgdir" ]] && continue
pkg=$(basename "$pkgdir")
[[ ! -f "$pkgdir/PKGBUILD" ]] && continue
if check_package "$pkg" "$pkgdir" "stable"; then
stable_needs_build=true
stable_packages+=("$pkg")
fi
done
print_info "Checking shared packages..."
# Check shared/ packages -> affects BOTH edge and stable
for pkgdir in "$BUILD_ROOT/pkgbuilds/shared"/*/; do
[[ ! -d "$pkgdir" ]] && continue
pkg=$(basename "$pkgdir")
[[ ! -f "$pkgdir/PKGBUILD" ]] && continue
# Check against edge
if check_package "$pkg" "$pkgdir" "edge"; then
edge_needs_build=true
edge_packages+=("$pkg")
fi
# Check against stable
if check_package "$pkg" "$pkgdir" "stable"; then
stable_needs_build=true
stable_packages+=("$pkg")
fi
done
echo ""
# Drop state files as needed
if [[ "$edge_needs_build" == true ]]; then
touch "$STATE_DIR/.sync-needed-edge"
print_success "Edge needs building (${#edge_packages[@]} packages)"
print_info "Packages: ${edge_packages[*]}"
print_info "State file created: $STATE_DIR/.sync-needed-edge"
else
print_info "Edge is up to date"
fi
echo ""
if [[ "$stable_needs_build" == true ]]; then
touch "$STATE_DIR/.sync-needed-stable"
print_success "Stable needs building (${#stable_packages[@]} packages)"
print_info "Packages: ${stable_packages[*]}"
print_info "State file created: $STATE_DIR/.sync-needed-stable"
else
print_info "Stable is up to date"
fi
echo ""
print_success "Version check complete!"
+46 -19
View File
@@ -4,38 +4,64 @@ BUILD_ROOT=$(realpath "${BASH_SOURCE[0]%/*}/..")
source "$BUILD_ROOT/helpers/message-helpers.sh"
source "$BUILD_ROOT/helpers/paths.sh"
PACKAGES_FILE="$BUILD_ROOT/build/packages/omarchy-aur.packages"
TEMP_DIR=$(mktemp -d)
trap "rm -rf $TEMP_DIR" EXIT
# Parse arguments
# Default tier
TIER=""
SPECIFIC_PACKAGES=()
for arg in "$@"; do
case "$arg" in
# Parse arguments
while [[ $# -gt 0 ]]; do
case "$1" in
--tier)
TIER="$2"
if [[ "$TIER" != "edge" && "$TIER" != "shared" ]]; then
print_error "Invalid tier: $TIER (must be 'edge' or 'shared')"
exit 1
fi
shift 2
;;
-h|--help)
echo "Usage: $0 [PACKAGE...]"
echo "Usage: $0 --tier <edge|shared> [PACKAGE...]"
echo ""
echo "Sync AUR packages to pkgbuilds/ directory"
echo "Sync AUR packages to pkgbuilds/<tier>/ directory"
echo ""
echo "Options:"
echo " --tier <tier> Target tier: edge or shared (required)"
echo ""
echo "Arguments:"
echo " PACKAGE One or more package names to sync (optional)"
echo ""
echo "Examples:"
echo " $0 # Sync all packages from omarchy-aur.packages"
echo " $0 yay # Sync only the yay package"
echo " $0 yay paru # Sync yay and paru packages"
echo " $0 --tier edge # Sync all packages from edge.packages"
echo " $0 --tier shared # Sync all packages from shared.packages"
echo " $0 --tier edge yay # Sync only the yay package to edge/"
echo " $0 --tier shared cursor-bin # Sync only cursor-bin to shared/"
exit 0
;;
*)
SPECIFIC_PACKAGES+=("$arg")
SPECIFIC_PACKAGES+=("$1")
shift
;;
esac
done
print_header "AUR Package Sync"
# Require tier
if [[ -z "$TIER" ]]; then
print_error "Missing required --tier argument"
echo "Usage: $0 --tier <edge|shared> [PACKAGE...]"
exit 1
fi
mkdir -p "$PKGBUILDS_DIR"
# Set paths based on tier
PACKAGES_FILE="$BUILD_ROOT/build/packages/${TIER}.packages"
TARGET_DIR="$PKGBUILDS_DIR/$TIER"
print_header "AUR Package Sync (tier: $TIER)"
mkdir -p "$TARGET_DIR"
if [[ ! -f "$PACKAGES_FILE" ]]; then
print_error "Package list not found: $PACKAGES_FILE"
@@ -57,14 +83,14 @@ sync_package() {
if git clone "https://aur.archlinux.org/${package}.git" 2>/dev/null; then
# Create target directory if it doesn't exist
mkdir -p "$PKGBUILDS_DIR/$package"
mkdir -p "$TARGET_DIR/$package"
# Copy files (not .git directory)
cp -r "$package"/* "$PKGBUILDS_DIR/$package/" 2>/dev/null || true
cp -r "$package"/.* "$PKGBUILDS_DIR/$package/" 2>/dev/null || true
cp -r "$package"/* "$TARGET_DIR/$package/" 2>/dev/null || true
cp -r "$package"/.* "$TARGET_DIR/$package/" 2>/dev/null || true
# Remove .git from destination
rm -rf "$PKGBUILDS_DIR/$package/.git"
rm -rf "$TARGET_DIR/$package/.git"
SYNCED_PACKAGES+=("$package")
((SYNCED++))
@@ -98,9 +124,9 @@ fi
# Apply patches only to packages that were actually synced
for package in "${SYNCED_PACKAGES[@]}"; do
if [[ -d "$PKGBUILDS_DIR/$package/patches" ]]; then
if [[ -d "$TARGET_DIR/$package/patches" ]]; then
print_info "Applying patches for $package..."
(cd "$PKGBUILDS_DIR/$package" && shopt -s nullglob && for patch in patches/*.patch; do
(cd "$TARGET_DIR/$package" && shopt -s nullglob && for patch in patches/*.patch; do
if ! patch -p1 --no-backup-if-mismatch < "$patch"; then
print_error "Failed to apply patch: $patch"
exit 1
@@ -110,6 +136,7 @@ for package in "${SYNCED_PACKAGES[@]}"; do
done
echo ""
print_success "Sync complete!"
print_success "Sync complete! (tier: $TIER)"
echo " Target: $TARGET_DIR"
echo " Synced: $SYNCED"
echo " Failed: $FAILED"