Better logs and resolution

This commit is contained in:
Ryan Hughes
2026-02-17 11:12:52 -05:00
parent d5cff62dda
commit fdcce9465c
3 changed files with 24 additions and 2 deletions
+15 -1
View File
@@ -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() {
+6
View File
@@ -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
+3 -1
View File
@@ -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"