#!/bin/bash # Normalization scripts for Debian reproducible builds set -euo pipefail DIR="${1:-.}" log() { echo "[normalize] $*" >&2 } normalize_archives() { log "Normalizing ar archives..." find "$DIR" -name "*.a" -type f | while read -r archive; do if ar --version 2>&1 | grep -q "GNU ar"; then ar -rcsD "$archive.tmp" "$archive" 2>/dev/null && mv "$archive.tmp" "$archive" || true fi done } strip_debug_timestamps() { log "Stripping debug timestamps..." # Handled by SOURCE_DATE_EPOCH and DEB_BUILD_OPTIONS } normalize_archives strip_debug_timestamps log "Normalization complete"