diff --git a/bin/repo b/bin/repo index 3edcfef..6686fc3 100755 --- a/bin/repo +++ b/bin/repo @@ -12,6 +12,16 @@ BUILD_ROOT=$(realpath "$SCRIPT_DIR/..") source "$BUILD_ROOT/helpers/message-helpers.sh" source "$BUILD_ROOT/helpers/paths.sh" +# Extract mirror from arguments for log naming (before args are shifted) +LOG_MIRROR="" +for ((i=1; i<=$#; i++)); do + if [[ "${!i}" == "--mirror" ]]; then + next=$((i+1)) + LOG_MIRROR="${!next}" + break + fi +done + # Setup logging with timestamps mkdir -p "$LOG_DIR" @@ -25,7 +35,11 @@ if [[ -d "$LOG_DIR" ]]; then fi TIMESTAMP=$(date +%Y%m%d_%H%M%S) -LOG_FILE="$LOG_DIR/repo_${TIMESTAMP}.log" +if [[ -n "$LOG_MIRROR" ]]; then + LOG_FILE="$LOG_DIR/repo_${LOG_MIRROR}_${TIMESTAMP}.log" +else + LOG_FILE="$LOG_DIR/repo_${TIMESTAMP}.log" +fi # Show usage show_usage() { diff --git a/build/Dockerfile b/build/Dockerfile index 0458275..ef73618 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -135,6 +135,12 @@ RUN useradd -m -G wheel -s /bin/bash builder && \ RUN sed -i 's/^#MAKEFLAGS=.*/MAKEFLAGS="-j$(nproc)"/' /etc/makepkg.conf && \ sed -i 's/^COMPRESSZST=.*/COMPRESSZST=(zstd -c -z -q --threads=0 -)/' /etc/makepkg.conf +# Pacman wrapper that auto-resolves package conflicts (e.g. rustup vs rust). +# makepkg only passes --noconfirm to pacman, which defaults to 'N' on conflict +# prompts. --ask 4 tells pacman to answer 'yes' to replacement prompts instead. +RUN printf '#!/bin/bash\nexec /usr/bin/pacman --ask 4 "$@"\n' > /usr/local/bin/pacman-for-makepkg && \ + chmod +x /usr/local/bin/pacman-for-makepkg + RUN rm -rf /etc/pacman.d/gnupg/{openpgp-revocs.d/,private-keys-v1.d/,pubring.gpg~,gnupg.S.}* USER builder diff --git a/build/build.sh b/build/build.sh index efeee37..c073b38 100755 --- a/build/build.sh +++ b/build/build.sh @@ -166,9 +166,11 @@ build_package() { fi # Build package without signing (signing is done separately) + # PACMAN override uses a wrapper that adds --ask 4 to auto-resolve conflicts + # (e.g. rustup replacing rust) since --noconfirm defaults to 'N' on those prompts MAKEPKG_FLAGS="-scf --noconfirm" - if makepkg $MAKEPKG_FLAGS; then + if PACMAN=/usr/local/bin/pacman-for-makepkg makepkg $MAKEPKG_FLAGS; then # Ensure output directory exists mkdir -p "$BUILD_OUTPUT_DIR"