File brp-75-ar-initial-version.patch of Package brp-check-suse
From 8b8f53b80db142956a02ac7d984f00094ab5af94 Mon Sep 17 00:00:00 2001 From: "Bernhard M. Wiedemann" <bwiedemann@suse.de> Date: Tue, 23 Jan 2018 13:10:41 +0100 Subject: [PATCH] Add brp-75-ar for normalizing ar archives (.a files) mtime, UID/GID to facilitate bit-identical reproducible builds. See https://reproducible-builds.org/ for why this is good. Ignoring objdump return code, because there are packages like cross-avr-gcc7 that have .a files for different architectures that cannot be processed by the build system's objdump. diff --git a/brp-75-ar b/brp-75-ar new file mode 100755 index 0000000..3b852ac --- /dev/null +++ b/brp-75-ar @@ -0,0 +1,14 @@ +#!/bin/bash +# If using normal root, avoid changing anything. +if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then + echo "RPM_BUILD_ROOT is not set or set to / : skipping ar normalization" + exit 0 +fi +if [ -z "$SOURCE_DATE_EPOCH" ] ; then + echo "SOURCE_DATE_EPOCH is not set: skipping ar normalization" + exit 0 +fi + +while read f; do + ! file "$f" | grep -q "ar archive" || objcopy -D "$f" || true +done < <(find "$RPM_BUILD_ROOT" -type f -name "*.a" -print)