From b32e41427934df462407ce0d0b6c41fb9d6993fe Mon Sep 17 00:00:00 2001 From: Ryan Hughes Date: Sun, 7 Sep 2025 23:07:12 +0200 Subject: [PATCH] Fix some build options --- build/build.sh | 69 +++++++++++++++++++++++++++-- build/packages/omarchy-aur.packages | 10 +++-- 2 files changed, 72 insertions(+), 7 deletions(-) diff --git a/build/build.sh b/build/build.sh index 6b2c929..4d3d0a1 100755 --- a/build/build.sh +++ b/build/build.sh @@ -20,7 +20,8 @@ get_local_version() { local pkg="$1" if [[ -f /output/omarchy.db.tar.zst ]]; then # Find the exact desc file for this package - local desc_file=$(tar -tf /output/omarchy.db.tar.zst | grep "^${pkg}-[0-9].*/desc$" | head -1) + # 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) if [[ -n "$desc_file" ]]; then # Extract that specific file and get the version @@ -52,9 +53,56 @@ build_github_package() { local pkg="$repo" echo " GitHub repository: https://github.com/$github_repo" - echo " Note: Skipping version check for GitHub packages" - # Always fresh clone for GitHub packages + # Check for always-build option + if [[ "$opts" == *"always-build"* ]]; then + echo " Note: Package flagged as always-build, will use timestamp version" + # Skip version checking for always-build packages + elif [[ "$pkg" == *-git ]]; then + # For -git packages, check if we need to rebuild based on commit + # Check if a source repo is specified (for packages where PKGBUILD repo != source repo) + local source_repo="" + if [[ "$opts" =~ source:([^ ]+) ]]; then + source_repo="${BASH_REMATCH[1]}" + echo " Checking source repository: $source_repo" + fi + + # Use source repo if specified, otherwise use the PKGBUILD repo + local check_repo="${source_repo:-$github_repo}" + local latest_commit=$(git ls-remote "https://github.com/${check_repo}.git" HEAD 2>/dev/null | cut -f1 | head -c 7) + + if [[ -n "$latest_commit" ]]; then + local local_version=$(get_local_version "$pkg") + + if [[ -n "$local_version" ]]; then + # Extract commit hash from version (format: r.-) + local local_commit=$(echo "$local_version" | grep -oE '\.[a-f0-9]{7}' | cut -d'.' -f2) + + if [[ "$local_commit" == "$latest_commit" ]]; then + echo " ✓ Up to date: commit $latest_commit - Skipping" + SKIPPED_PACKAGES="$SKIPPED_PACKAGES $github_repo" + + # If install option is set, install the existing package for dependencies + if [[ "$opts" == *"install"* ]]; then + echo " Installing existing package for dependencies..." + local latest_pkg=$(ls -t /output/${pkg}-*.pkg.tar.* 2>/dev/null | grep -v '\.sig$' | head -1) + if [[ -f "$latest_pkg" ]]; then + sudo pacman -U --noconfirm --needed "$latest_pkg" 2>/dev/null || true + fi + fi + return 0 + else + echo " Update available: $local_commit -> $latest_commit" + fi + else + echo " New package (commit: $latest_commit)" + fi + fi + else + echo " Note: Non-git GitHub package, will check PKGBUILD version" + fi + + # Fresh clone for building cd /src rm -rf "$pkg" @@ -74,6 +122,21 @@ build_github_package() { return 1 fi + # For always-build packages, inject timestamp into pkgver to ensure unique filename + if [[ "$opts" == *"always-build"* ]]; then + # Get current date/time as version suffix + local timestamp=$(date +%Y%m%d.%H%M%S) + echo " Injecting timestamp: $timestamp" + + # Modify PKGBUILD to append timestamp to pkgver + if grep -q '^pkgver=' PKGBUILD; then + # Get current pkgver and append timestamp + local current_pkgver=$(grep '^pkgver=' PKGBUILD | cut -d'=' -f2 | tr -d "'\"") + sed -i "s/^pkgver=.*/pkgver=${current_pkgver}.${timestamp}/" PKGBUILD + echo " Modified pkgver to: ${current_pkgver}.${timestamp}" + fi + fi + # Build package with signing MAKEPKG_FLAGS="-sc --noconfirm" diff --git a/build/packages/omarchy-aur.packages b/build/packages/omarchy-aur.packages index 9389e95..e004f49 100644 --- a/build/packages/omarchy-aur.packages +++ b/build/packages/omarchy-aur.packages @@ -6,7 +6,8 @@ # Options: # - skip-pgp: Skip PGP signature verification # - install: Install package in container (for dependencies) -# Note: GitHub packages skip version checking and are built every time +# - always-build: Always build package with timestamp version (unique filename) +# - source:owner/repo: For -git packages, specify the actual source repo to check #Core Install 1password-beta @@ -14,8 +15,8 @@ limine-mkinitcpio-hook limine-snapper-sync localsend-bin -omacom-io/asdcontrol-git -omacom-io/omarchy-lazyvim +omacom-io/asdcontrol-git source:nikosdion/asdcontrol +omacom-io/omarchy-lazyvim always-build omarchy-chromium-bin pinta python-terminaltexteffects @@ -24,7 +25,7 @@ ttf-ia-writer typora tzupdate ufw-docker -walker-bin +# walker-bin # Not maintained any longer wl-screenrec yaru-icon-theme yay @@ -41,3 +42,4 @@ symfony-cli dropbox install dropbox-cli nautilus-dropbox +openai-codex-bin