openldap: Reproducibility: Remove user, hostname, pwd from version string

This updated patch also sets the date and time strings to the SOURCE_DATE_EPOCH.
The WHOWHERE string will now be set to simply "openldap"
in the case that a SOURCE_DATE_EPOCH is set.

Upstream-Status: Submitted [https://www.openldap.org/its/index.cgi/Incoming?id=8928]
Signed-off-by: Douglas Royds <douglas.royds@taitradio.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
douglas.royds 2018-10-26 14:19:50 +13:00 committed by Khem Raj
parent 7bf3b548fc
commit 18efa5fa25

View File

@ -1,12 +1,29 @@
diff -ru openldap-2.4.46.original/build/mkversion openldap-2.4.46/build/mkversion
--- openldap-2.4.46.original/build/mkversion 2018-03-23 04:44:27.000000000 +1300
+++ openldap-2.4.46/build/mkversion 2018-10-09 14:34:51.152684040 +1300
@@ -50,7 +50,7 @@
diff -ru openldap-2.4.46.orig/build/mkversion openldap-2.4.46/build/mkversion
--- openldap-2.4.46.orig/build/mkversion 2018-10-25 18:46:10.383750480 +1300
+++ openldap-2.4.46/build/mkversion 2018-10-25 18:46:33.156232586 +1300
@@ -50,7 +50,15 @@
fi
APPLICATION=$1
-WHOWHERE="$USER@`uname -n`:`pwd`"
+WHOWHERE="${SOURCE_DATE_EPOCH:-$USER@`uname -n`:`pwd`}"
+if [ -n "${SOURCE_DATE_EPOCH}" ]; then
+ WHOWHERE="openldap"
+ DATE=$(date -d@$SOURCE_DATE_EPOCH +' %b %d %Y ')
+ TIME=$(date -d@$SOURCE_DATE_EPOCH +' %H:%M:%S ')
+else
+ WHOWHERE="$USER@$(uname -n):$(pwd)"
+ DATE='" __DATE__ "'
+ TIME='" __TIME__ "'
+fi
cat << __EOF__
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
@@ -72,7 +80,7 @@
"COPYING RESTRICTIONS APPLY\n";
$static $const char $SYMBOL[] =
-"@(#) \$$PACKAGE: $APPLICATION $VERSION (" __DATE__ " " __TIME__ ") \$\n"
+"@(#) \$$PACKAGE: $APPLICATION $VERSION ($DATE $TIME) \$\n"
"\t$WHOWHERE\n";
__EOF__