From 873c6cba3e7f7e87b615b25c50d9c8dcede661ec Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ra=C3=BAl=20Mar=C3=ADn=20Rodr=C3=ADguez?= Date: Tue, 14 Aug 2018 08:08:10 +0000 Subject: [PATCH] Enable deterministic builds Honor SOURCE_DATE_EPOCH variable if present to enable reproducible builds Patch by Christoph Berg Closes #4147 Closes #4148 git-svn-id: http://svn.osgeo.org/postgis/trunk@16693 b70326c6-7e19-0410-871a-916f4a2858ee --- NEWS | 1 + configure.ac | 4 ++-- utils/create_undef.pl | 2 +- utils/create_unpackaged.pl | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 4b0b51f44..84f1714bb 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,7 @@ PostGIS 2.5.0rc1 2018/XX/XX New since PostGIS 2.5.0beta2 - #4146, Fix compilation error against Postgres 12 (Raúl Marín). + - #4147, #4148, Honor SOURCE_DATE_EPOCH when present (Christoph Berg). PostGIS 2.5.0beta2 2018/08/11 diff --git a/configure.ac b/configure.ac index 48e2cf25e..8975cd954 100644 --- a/configure.ac +++ b/configure.ac @@ -1075,7 +1075,7 @@ if test "$HAVE_LIBXML2" = "1"; then fi POSTGIS_LIB_VERSION="$POSTGIS_MAJOR_VERSION.$POSTGIS_MINOR_VERSION.$POSTGIS_MICRO_VERSION" -POSTGIS_BUILD_DATE=`date -u "+%Y-%m-%d %H:%M:%S"` +POSTGIS_BUILD_DATE=`date ${SOURCE_DATE_EPOCH:+-d @$SOURCE_DATE_EPOCH} -u "+%Y-%m-%d %H:%M:%S"` POSTGIS_SCRIPTS_VERSION="$POSTGIS_LIB_VERSION" AC_DEFINE_UNQUOTED([POSTGIS_VERSION], ["$POSTGIS_VERSION"], [PostGIS version]) @@ -1253,7 +1253,7 @@ if test "x$with_raster" != "xno"; then dnl ============================== POSTGIS_RASTER_VERSION="$POSTGIS_RASTER_MAJOR_VERSION.$POSTGIS_RASTER_MINOR_VERSION" POSTGIS_RASTER_LIB_VERSION="$POSTGIS_RASTER_MAJOR_VERSION.$POSTGIS_RASTER_MINOR_VERSION.$POSTGIS_RASTER_MICRO_VERSION" - POSTGIS_RASTER_BUILD_DATE=`date -u "+%Y-%m-%d %H:%M:%S"` + POSTGIS_RASTER_BUILD_DATE=`date ${SOURCE_DATE_EPOCH:+-d @$SOURCE_DATE_EPOCH} -u "+%Y-%m-%d %H:%M:%S"` POSTGIS_RASTER_SCRIPTS_VERSION="$POSTGIS_RASTER_LIB_VERSION" AC_DEFINE_UNQUOTED([POSTGIS_RASTER_VERSION], ["$POSTGIS_RASTER_VERSION"], [PostGIS Raster version]) diff --git a/utils/create_undef.pl b/utils/create_undef.pl index 708f95cfb..f445a0543 100755 --- a/utils/create_undef.pl +++ b/utils/create_undef.pl @@ -55,7 +55,7 @@ sub strip_default { return $line; } -my $time = POSIX::strftime("%c", localtime); +my $time = POSIX::strftime("%F %T", gmtime(defined($ENV{SOURCE_DATE_EPOCH}) ? $ENV{SOURCE_DATE_EPOCH} : time)); print "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --\n"; print "--\n"; print "-- PostGIS - Spatial Types for PostgreSQL\n"; diff --git a/utils/create_unpackaged.pl b/utils/create_unpackaged.pl index e4a40f0c9..84f7aeeb9 100755 --- a/utils/create_unpackaged.pl +++ b/utils/create_unpackaged.pl @@ -145,7 +145,7 @@ END; EOF } -my $time = POSIX::strftime("%c", localtime); +my $time = POSIX::strftime("%F %T", gmtime(defined($ENV{SOURCE_DATE_EPOCH}) ? $ENV{SOURCE_DATE_EPOCH} : time)); print "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --\n"; print "--\n"; print "-- PostGIS - Spatial Types for PostgreSQL\n"; -- 2.40.0