[Rpm-maint] [PATCH 2/2] set mtime of all .py files to date of last Changelog

bmorbach at redhat.com bmorbach at redhat.com
Wed Aug 13 12:12:17 UTC 2014


From: Benedikt Morbach <bmorbach at redhat.com>

This ensures that rebuilds of an srpm result in the same .py{c,o} files,
even if the source files were modified during the build.
This should make the builds of most python packages reproducible.

The downside here is that we don't preserve the mtime of the sources
anymore. However, as of right now a user can't tell by looking at a file
on disk if it has the original source mtime or was modified during build,
which makes having the mtime near useless anyway, in my opinion.
---
 scripts/brp-python-bytecompile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/brp-python-bytecompile b/scripts/brp-python-bytecompile
index 39fca60..6d93441 100644
--- a/scripts/brp-python-bytecompile
+++ b/scripts/brp-python-bytecompile
@@ -14,7 +14,7 @@ fi
 
 # Figure out how deep we need to descend.  We could pick an insanely high
 # number and hope it's enough, but somewhere, somebody's sure to run into it.
-depth=`(find "$RPM_BUILD_ROOT" -type f -name "*.py" -print0 ; echo /) | \
+depth=`(find "$RPM_BUILD_ROOT" -type f -name "*.py" -exec touch "$RPM_CHANGELOG_DATE" {} \+ -print0 ; echo /) | \
        xargs -0 -n 1 dirname | sed 's,[^/],,g' | sort -u | tail -n 1 | wc -c`
 if [ -z "$depth" -o "$depth" -le "1" ]; then
 	exit 0
-- 
2.0.4



More information about the Rpm-maint mailing list