Skip to content

Commit 00ccc9d

Browse files
authored
Merge pull request #8136 from bmwiedemann/date
configury: make build reproducible
2 parents 593a918 + 7b4e8ba commit 00ccc9d

File tree

8 files changed

+27
-21
lines changed

8 files changed

+27
-21
lines changed

README

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,16 @@ General notes
197197

198198
- Open MPI has taken some steps towards Reproducible Builds
199199
(https://reproducible-builds.org/). Specifically, Open MPI's
200-
"configure" and "make" process, by default, records some
201-
system-specific information such as the hostname where Open MPI was
202-
built and the username who built it. If you desire a Reproducible
203-
Build, set the $USER and $HOSTNAME environment variables before
204-
invoking "configure" and "make", and Open MPI will use those values
205-
instead of invoking "whoami" and/or "hostname", respectively.
200+
"configure" and "make" process, by default, records the build date
201+
and some system-specific information such as the hostname where Open
202+
MPI was built and the username who built it. If you desire a
203+
Reproducible Build, set the $SOURCE_DATE_EPOCH, $USER and $HOSTNAME
204+
environment variables before invoking "configure" and "make", and
205+
Open MPI will use those values instead of invoking "whoami" and/or
206+
"hostname", respectively. See
207+
https://reproducible-builds.org/docs/source-date-epoch/ for
208+
information on the expected format and content of the
209+
$SOURCE_DATE_EPOCH variable.
206210

207211
Platform Notes
208212
--------------

autogen.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1209,7 +1209,7 @@ sub in_tarball {
12091209
dnl This file is automatically created by autogen.pl; it should not
12101210
dnl be edited by hand!!
12111211
dnl
1212-
dnl Generated by $username at " . localtime(time) . "
1212+
dnl Generated by $username at " . localtime($ENV{SOURCE_DATE_EPOCH} || time) . "
12131213
dnl on $full_hostname.
12141214
$dnl_line\n\n";
12151215

config/getdate.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh
2+
#
3+
# Copyright (c) 2017 Research Organization for Information Science
4+
# and Technology (RIST). All rights reserved.
5+
# Copyright (c) 2020 Cisco Systems, Inc. All rights reserved.
6+
7+
# Provide a way to override build date for reproducible build results
8+
# See https://reproducible-builds.org/ for why this is good.
9+
10+
date --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" "$@"

config/opal_functions.m4

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ EOF
9696

9797
OPAL_CONFIGURE_USER="${USER:-`whoami`}"
9898
OPAL_CONFIGURE_HOST="${HOSTNAME:-`(hostname || uname -n) 2> /dev/null | sed 1q`}"
99-
OPAL_CONFIGURE_DATE="`date`"
99+
OPAL_CONFIGURE_DATE="`$srcdir/config/getdate.sh`"
100100

101101
OPAL_LIBNL_SANITY_INIT
102102

@@ -112,14 +112,6 @@ dnl #######################################################################
112112
dnl #######################################################################
113113

114114
AC_DEFUN([OPAL_BASIC_SETUP],[
115-
#
116-
# Save some stats about this build
117-
#
118-
119-
OPAL_CONFIGURE_USER="${USER:-`whoami`}"
120-
OPAL_CONFIGURE_HOST="${HOSTNAME:-`(hostname || uname -n) 2> /dev/null | sed 1q`}"
121-
OPAL_CONFIGURE_DATE="`date`"
122-
123115
#
124116
# Make automake clean emacs ~ files for "make clean"
125117
#

config/opal_get_version.m4

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
1010
dnl University of Stuttgart. All rights reserved.
1111
dnl Copyright (c) 2004-2005 The Regents of the University of California.
1212
dnl All rights reserved.
13-
dnl Copyright (c) 2008-2014 Cisco Systems, Inc. All rights reserved.
13+
dnl Copyright (c) 2008-2020 Cisco Systems, Inc. All rights reserved.
1414
dnl Copyright (c) 2014 Intel, Inc. All rights reserved.
1515
dnl Copyright (c) 2014 Research Organization for Information Science
1616
dnl and Technology (RIST). All rights reserved.
@@ -91,7 +91,7 @@ m4_define([OPAL_GET_VERSION],[
9191
$2_REPO_REV=`git describe --tags --always`
9292
fi
9393
else
94-
$2_REPO_REV="date`date '+%Y-%m-%d'`"
94+
$2_REPO_REV=date`$srcdir/getdate.sh '+%Y-%m-%d'`
9595
fi
9696
fi
9797

ompi/tools/mpisync/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ AM_CFLAGS = \
3434
-DOPAL_CONFIGURE_DATE="\"@OPAL_CONFIGURE_DATE@\"" \
3535
-DOMPI_BUILD_USER="\"$$USER\"" \
3636
-DOMPI_BUILD_HOST="\"`(hostname || uname -n) | sed 1q`\"" \
37-
-DOMPI_BUILD_DATE="\"`date`\"" \
37+
-DOMPI_BUILD_DATE="\"`$(top_srcdir)/config/getdate.sh`\"" \
3838
-DOMPI_BUILD_CFLAGS="\"@CFLAGS@\"" \
3939
-DOMPI_BUILD_CPPFLAGS="\"@CPPFLAGS@\"" \
4040
-DOMPI_BUILD_CXXFLAGS="\"@CXXFLAGS@\"" \

ompi/tools/ompi_info/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ AM_CFLAGS = \
3030
-DOPAL_CONFIGURE_DATE="\"@OPAL_CONFIGURE_DATE@\"" \
3131
-DOMPI_BUILD_USER="\"$$USER\"" \
3232
-DOMPI_BUILD_HOST="\"$${HOSTNAME:-`(hostname || uname -n) 2> /dev/null | sed 1q`}\"" \
33-
-DOMPI_BUILD_DATE="\"`date`\"" \
33+
-DOMPI_BUILD_DATE="\"`$(top_srcdir)/config/getdate.sh`\"" \
3434
-DOMPI_BUILD_CFLAGS="\"@CFLAGS@\"" \
3535
-DOMPI_BUILD_CPPFLAGS="\"@CPPFLAGS@\"" \
3636
-DOMPI_BUILD_CXXFLAGS="\"@CXXFLAGS@\"" \

oshmem/tools/oshmem_info/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ AM_CPPFLAGS = \
1919
-DOPAL_CONFIGURE_DATE="\"@OPAL_CONFIGURE_DATE@\"" \
2020
-DOMPI_BUILD_USER="\"$$USER\"" \
2121
-DOMPI_BUILD_HOST="\"$${HOSTNAME:-`(hostname || uname -n) 2> /dev/null | sed 1q`}\"" \
22-
-DOMPI_BUILD_DATE="\"`date`\"" \
22+
-DOMPI_BUILD_DATE="\"`$(top_srcdir)/config/getdate.sh`\"" \
2323
-DOMPI_BUILD_CFLAGS="\"@CFLAGS@\"" \
2424
-DOMPI_BUILD_CPPFLAGS="\"@CPPFLAGS@\"" \
2525
-DOMPI_BUILD_CXXFLAGS="\"@CXXFLAGS@\"" \

0 commit comments

Comments
 (0)