diff --git a/README b/README index dbdf34ab42f..4855f63b822 100644 --- a/README +++ b/README @@ -197,12 +197,16 @@ General notes - Open MPI has taken some steps towards Reproducible Builds (https://reproducible-builds.org/). Specifically, Open MPI's - "configure" and "make" process, by default, records some - system-specific information such as the hostname where Open MPI was - built and the username who built it. If you desire a Reproducible - Build, set the $USER and $HOSTNAME environment variables before - invoking "configure" and "make", and Open MPI will use those values - instead of invoking "whoami" and/or "hostname", respectively. + "configure" and "make" process, by default, records the build date + and some system-specific information such as the hostname where Open + MPI was built and the username who built it. If you desire a + Reproducible Build, set the $SOURCE_DATE_EPOCH, $USER and $HOSTNAME + environment variables before invoking "configure" and "make", and + Open MPI will use those values instead of invoking "whoami" and/or + "hostname", respectively. See + https://reproducible-builds.org/docs/source-date-epoch/ for + information on the expected format and content of the + $SOURCE_DATE_EPOCH variable. Platform Notes -------------- diff --git a/autogen.pl b/autogen.pl index b1330f75271..f53072db45a 100755 --- a/autogen.pl +++ b/autogen.pl @@ -1209,7 +1209,7 @@ sub in_tarball { dnl This file is automatically created by autogen.pl; it should not dnl be edited by hand!! dnl -dnl Generated by $username at " . localtime(time) . " +dnl Generated by $username at " . localtime($ENV{SOURCE_DATE_EPOCH} || time) . " dnl on $full_hostname. $dnl_line\n\n"; diff --git a/config/getdate.sh b/config/getdate.sh new file mode 100755 index 00000000000..94824d97e43 --- /dev/null +++ b/config/getdate.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# +# Copyright (c) 2017 Research Organization for Information Science +# and Technology (RIST). All rights reserved. +# Copyright (c) 2020 Cisco Systems, Inc. All rights reserved. + +# Provide a way to override build date for reproducible build results +# See https://reproducible-builds.org/ for why this is good. + +date --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" "$@" diff --git a/config/opal_functions.m4 b/config/opal_functions.m4 index c358b628c35..2a552ad74c6 100644 --- a/config/opal_functions.m4 +++ b/config/opal_functions.m4 @@ -96,7 +96,7 @@ EOF OPAL_CONFIGURE_USER="${USER:-`whoami`}" OPAL_CONFIGURE_HOST="${HOSTNAME:-`(hostname || uname -n) 2> /dev/null | sed 1q`}" -OPAL_CONFIGURE_DATE="`date`" +OPAL_CONFIGURE_DATE="`$srcdir/config/getdate.sh`" OPAL_LIBNL_SANITY_INIT @@ -112,14 +112,6 @@ dnl ####################################################################### dnl ####################################################################### AC_DEFUN([OPAL_BASIC_SETUP],[ -# -# Save some stats about this build -# - -OPAL_CONFIGURE_USER="${USER:-`whoami`}" -OPAL_CONFIGURE_HOST="${HOSTNAME:-`(hostname || uname -n) 2> /dev/null | sed 1q`}" -OPAL_CONFIGURE_DATE="`date`" - # # Make automake clean emacs ~ files for "make clean" # diff --git a/config/opal_get_version.m4 b/config/opal_get_version.m4 index 7df2b5563b5..69537994b7c 100644 --- a/config/opal_get_version.m4 +++ b/config/opal_get_version.m4 @@ -10,7 +10,7 @@ dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, dnl University of Stuttgart. All rights reserved. dnl Copyright (c) 2004-2005 The Regents of the University of California. dnl All rights reserved. -dnl Copyright (c) 2008-2014 Cisco Systems, Inc. All rights reserved. +dnl Copyright (c) 2008-2020 Cisco Systems, Inc. All rights reserved. dnl Copyright (c) 2014 Intel, Inc. All rights reserved. dnl Copyright (c) 2014 Research Organization for Information Science dnl and Technology (RIST). All rights reserved. @@ -91,7 +91,7 @@ m4_define([OPAL_GET_VERSION],[ $2_REPO_REV=`git describe --tags --always` fi else - $2_REPO_REV="date`date '+%Y-%m-%d'`" + $2_REPO_REV=date`$srcdir/getdate.sh '+%Y-%m-%d'` fi fi diff --git a/ompi/tools/mpisync/Makefile.am b/ompi/tools/mpisync/Makefile.am index bdafbadda38..81ae5418d59 100644 --- a/ompi/tools/mpisync/Makefile.am +++ b/ompi/tools/mpisync/Makefile.am @@ -34,7 +34,7 @@ AM_CFLAGS = \ -DOPAL_CONFIGURE_DATE="\"@OPAL_CONFIGURE_DATE@\"" \ -DOMPI_BUILD_USER="\"$$USER\"" \ -DOMPI_BUILD_HOST="\"`(hostname || uname -n) | sed 1q`\"" \ - -DOMPI_BUILD_DATE="\"`date`\"" \ + -DOMPI_BUILD_DATE="\"`$(top_srcdir)/config/getdate.sh`\"" \ -DOMPI_BUILD_CFLAGS="\"@CFLAGS@\"" \ -DOMPI_BUILD_CPPFLAGS="\"@CPPFLAGS@\"" \ -DOMPI_BUILD_CXXFLAGS="\"@CXXFLAGS@\"" \ diff --git a/ompi/tools/ompi_info/Makefile.am b/ompi/tools/ompi_info/Makefile.am index 7a0115f2449..c5a9c47670f 100644 --- a/ompi/tools/ompi_info/Makefile.am +++ b/ompi/tools/ompi_info/Makefile.am @@ -30,7 +30,7 @@ AM_CFLAGS = \ -DOPAL_CONFIGURE_DATE="\"@OPAL_CONFIGURE_DATE@\"" \ -DOMPI_BUILD_USER="\"$$USER\"" \ -DOMPI_BUILD_HOST="\"$${HOSTNAME:-`(hostname || uname -n) 2> /dev/null | sed 1q`}\"" \ - -DOMPI_BUILD_DATE="\"`date`\"" \ + -DOMPI_BUILD_DATE="\"`$(top_srcdir)/config/getdate.sh`\"" \ -DOMPI_BUILD_CFLAGS="\"@CFLAGS@\"" \ -DOMPI_BUILD_CPPFLAGS="\"@CPPFLAGS@\"" \ -DOMPI_BUILD_CXXFLAGS="\"@CXXFLAGS@\"" \ diff --git a/oshmem/tools/oshmem_info/Makefile.am b/oshmem/tools/oshmem_info/Makefile.am index 04ed4b1696c..8cec5652679 100644 --- a/oshmem/tools/oshmem_info/Makefile.am +++ b/oshmem/tools/oshmem_info/Makefile.am @@ -19,7 +19,7 @@ AM_CPPFLAGS = \ -DOPAL_CONFIGURE_DATE="\"@OPAL_CONFIGURE_DATE@\"" \ -DOMPI_BUILD_USER="\"$$USER\"" \ -DOMPI_BUILD_HOST="\"$${HOSTNAME:-`(hostname || uname -n) 2> /dev/null | sed 1q`}\"" \ - -DOMPI_BUILD_DATE="\"`date`\"" \ + -DOMPI_BUILD_DATE="\"`$(top_srcdir)/config/getdate.sh`\"" \ -DOMPI_BUILD_CFLAGS="\"@CFLAGS@\"" \ -DOMPI_BUILD_CPPFLAGS="\"@CPPFLAGS@\"" \ -DOMPI_BUILD_CXXFLAGS="\"@CXXFLAGS@\"" \