guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/02: build-system/gnu: Add 'set-SOURCE-DATE-EPOCH' phase.


From: Ludovic Courtès
Subject: 02/02: build-system/gnu: Add 'set-SOURCE-DATE-EPOCH' phase.
Date: Tue, 05 Jan 2016 14:53:30 +0000

civodul pushed a commit to branch core-updates
in repository guix.

commit 0beb65b45063ccd47b85ed79cc4782f3a3ffa299
Author: Ludovic Courtès <address@hidden>
Date:   Tue Jan 5 15:49:48 2016 +0100

    build-system/gnu: Add 'set-SOURCE-DATE-EPOCH' phase.
    
    This phase is inherited by other build systems, which ensures
    'SOURCE_DATE_EPOCH' is always set in practice.
    
    * guix/build/python-build-system.scm (set-SOURCE-DATE-EPOCH): Remove.
    (%standard-phases): Don't add it.
    * guix/build/gnu-build-system.scm (set-SOURCE-DATE-EPOCH): New
    procedure.
    (%standard-phases): Add it.
    (gnu-build): Remove 'setenv' call for "SOURCE_DATE_EPOCH".
---
 guix/build/gnu-build-system.scm    |   12 ++++++++----
 guix/build/python-build-system.scm |    9 +--------
 2 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm
index e168b6c..2abaa6e 100644
--- a/guix/build/gnu-build-system.scm
+++ b/guix/build/gnu-build-system.scm
@@ -39,6 +39,13 @@
 ;;
 ;; Code:
 
+(define* (set-SOURCE-DATE-EPOCH #:rest _)
+  "Set the 'SOURCE_DATE_EPOCH' environment variable.  This is used by tools
+that incorporate timestamps as a way to tell them to use a fixed timestamp.
+See https://reproducible-builds.org/specs/source-date-epoch/.";
+  (setenv "SOURCE_DATE_EPOCH" "1")
+  #t)
+
 (define (first-subdirectory dir)
   "Return the path of the first sub-directory of DIR."
   (file-system-fold (lambda (path stat result)
@@ -549,7 +556,7 @@ DOCUMENTATION-COMPRESSOR-FLAGS."
   ;; Standard build phases, as a list of symbol/procedure pairs.
   (let-syntax ((phases (syntax-rules ()
                          ((_ p ...) `((p . ,p) ...)))))
-    (phases set-paths install-locale unpack
+    (phases set-SOURCE-DATE-EPOCH set-paths install-locale unpack
             patch-usr-bin-file
             patch-source-shebangs configure patch-generated-file-shebangs
             build check install
@@ -577,9 +584,6 @@ in order.  Return #t if all the PHASES succeeded, #f 
otherwise."
   ;; Encoding/decoding errors shouldn't be silent.
   (fluid-set! %default-port-conversion-strategy 'error)
 
-  ;; Avoid non-determinism related to generated timestamps.
-  (setenv "SOURCE_DATE_EPOCH" "1")
-
   ;; The trick is to #:allow-other-keys everywhere, so that each procedure in
   ;; PHASES can pick the keyword arguments it's interested in.
   (every (match-lambda
diff --git a/guix/build/python-build-system.scm 
b/guix/build/python-build-system.scm
index 8025b7f..9109fb4 100644
--- a/guix/build/python-build-system.scm
+++ b/guix/build/python-build-system.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013, 2015 Ludovic Courtès <address@hidden>
+;;; Copyright © 2013, 2015, 2016 Ludovic Courtès <address@hidden>
 ;;; Copyright © 2013 Andreas Enge <address@hidden>
 ;;; Copyright © 2013 Nikita Karetnikov <address@hidden>
 ;;; Copyright © 2015 Mark H Weaver <address@hidden>
@@ -136,18 +136,11 @@ installed with setuptools."
                #t))
     #t))
 
-(define* (set-SOURCE-DATE-EPOCH #:rest _)
-  "Set the 'SOURCE_DATE_EPOCH' environment variable."
-  ;; Use zero as the timestamp in .pyc files so that builds are deterministic.
-  ;; TODO: Remove it when this variable is set in GNU:%STANDARD-PHASES.
-  (setenv "SOURCE_DATE_EPOCH" "1"))
-
 (define %standard-phases
   ;; 'configure' and 'build' phases are not needed.  Everything is done during
   ;; 'install'.
   (modify-phases gnu:%standard-phases
     (add-after 'unpack 'ensure-no-mtimes-pre-1980 ensure-no-mtimes-pre-1980)
-    (add-after 'unpack 'set-SOURCE-DATE-EPOCH set-SOURCE-DATE-EPOCH)
     (delete 'configure)
     (replace 'install install)
     (replace 'check check)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]