summary refs log tree commit diff
diff options
context:
space:
mode:
authorThomas Danckaert <post@thomasdanckaert.be>2017-08-24 15:13:02 +0200
committerThomas Danckaert <thomas.danckaert@gmail.com>2017-09-01 08:34:32 +0200
commit43d01672a11814ca4cdcc592544064d75d1653f0 (patch)
treeffdc0b96e7a8d8acb16f0e487c61243ee4151eaa
parente464b4550e42d913655bd5939d3e370982ee294b (diff)
downloadguix-43d01672a11814ca4cdcc592544064d75d1653f0.tar.gz
gnu: netcdf: Fix reproducibility issue; remove unneeded references.
* gnu/packages/maths.scm (netcdf) [arguments]: Add phase to fix the embedded
  'Configured On' date; truncate reference to compiler store item.
-rw-r--r--gnu/packages/maths.scm23
1 files changed, 23 insertions, 0 deletions
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index a8c81a79ca..bebed14b52 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -918,6 +918,29 @@ similar to MATLAB, GNU Octave or SciPy.")
        ("libjpeg" ,libjpeg)))
     (arguments
      `(#:configure-flags '("--enable-doxygen" "--enable-dot" "--enable-hdf4")
+
+       #:phases (modify-phases %standard-phases
+         (add-before 'configure 'fix-source-date
+           (lambda _
+             ;; As we ${SOURCE_DATE_EPOCH} evaluates to "1" in the build
+             ;; environment, `date -u -d ${SOURCE_DATE_EPOCH}` will evaluate
+             ;; to '1st hour of the current day', and therefore makes the
+             ;; package not reproducible.
+             (substitute* "./configure"
+               (("date -u -d \"\\$\\{SOURCE_DATE_EPOCH\\}\"")
+                "date --date='@0'"))
+             #t))
+         (add-after 'configure 'patch-settings
+           (lambda _
+             ;; libnetcdf.settings contains the full filename of the compilers
+             ;; used to build the library.  We truncate the hashes of those
+             ;; filenames to avoid unnecessary references to the corresponding
+             ;; store items.
+             (substitute* "libnetcdf.settings"
+               (("(/gnu/store/)([a-Z0-9]*)" all prefix hash)
+                (string-append prefix (string-take hash 10) "...")))
+             #t)))
+
        #:parallel-tests? #f))           ;various race conditions
     (home-page "http://www.unidata.ucar.edu/software/netcdf/")
     (synopsis "Library for scientific data")