unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Set FORCE_SOURCE_DATE=1 by default
@ 2022-06-10 23:53 Vagrant Cascadian
  2022-06-15  8:58 ` Ludovic Courtès
                   ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: Vagrant Cascadian @ 2022-06-10 23:53 UTC (permalink / raw)
  To: Guix Devel


[-- Attachment #1.1: Type: text/plain, Size: 1897 bytes --]

So, guix sets SOURCE_DATE_EPOCH=1 by default in
guix/build/gnu-build-system.scm, which is great!

This allows guix packages in many cases to build packages reproducibly,
with a curious side-effect that takes us all back to the early 70s in
some corner-cases (or even late 60s, dependent on timezone).

That said, some projects (such as texlive) might be worried about
messing with time too much (I get it, lots of cautionary sci-fi
stories!), and so you *also* need FORCE_SOURCE_DATE=1 to be set in order
to respect SOURCE_DATE_EPOCH.

I am quite biased on the subject and always felt that setting
SOURCE_DATE_EPOCH wouldn't happen by accident and it alone should be
sufficient to say "please use this for your timestamps, really."

I am not aware of use-cases where SOURCE_DATE_EPOCH is intentially set
but FORCE_SOURCE_DATE is intentionally not set... in order to embed the
current time. But that is kind of neither here nor there.


Setting this on a package-by-package basis can be a bit tedious, wastes
precious lines that could be spent on more useful code, and needs to be
done for every existing and new package that might need it, such as:

  964cdd57fa037fec4917ac76725b0a65d47483bc gnu: discrover: Use reproducible timestamps.
  a04a987450908a84fa5fde0caa25a6a50027c73c gnu: itpp: Avoid embedding build dates.

I haven't done a full inventory, but many texlive packages should become
considerably more reproducible with FORCE_SOURE_DATE=1 set, as well as
other packages that use texlive to generate documentation in various
formats.


FORCE_SOURCE_DATE is mentioned in the documentation about
SOURCE_DATE_EPOCH:

  https://reproducible-builds.org/docs/source-date-epoch/


I am making the modest proposal of Guix setting this variable by
default! Patch attached for your perusal.

I'm guessing this would be world-rebuild endeavor, hello core-updates!

Thoughts?


live well,
  vagrant

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-guix-gnu-build-system-Set-FORCE_SOURCE_DATE-in-set-S.patch --]
[-- Type: text/x-diff, Size: 1506 bytes --]

From 7a39330b56934accef14b5e2ac003e211c7c6c5b Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagrant@reproducible-builds.org>
Date: Fri, 10 Jun 2022 16:12:59 -0700
Subject: [PATCH] guix: gnu-build-system: Set FORCE_SOURCE_DATE in
 set-SOURCE-DATE-EPOCH phase.

* guix/build/gnu-build-system.scm (set-SOURCE-DATE-EPOCH): Set
  FORCE_SOURCE_DATE=1. Update URL.
---
 guix/build/gnu-build-system.scm | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm
index d84411c090..42a6041798 100644
--- a/guix/build/gnu-build-system.scm
+++ b/guix/build/gnu-build-system.scm
@@ -56,10 +56,11 @@ (define time-monotonic time-tai))
   (else #t))
 
 (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"))
+  "Set the 'SOURCE_DATE_EPOCH' and 'FORCE_SOURCE_DATE' environment variables.
+This is used by tools that incorporate timestamps as a way to tell them to use
+a fixed timestamp.  See https://reproducible-builds.org/docs/source-date-epoch/."
+  (setenv "SOURCE_DATE_EPOCH" "1")
+  (setenv "FORCE_SOURCE_DATE" "1"))
 
 (define (first-subdirectory directory)
   "Return the file name of the first sub-directory of DIRECTORY or false, when
-- 
2.35.1


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2022-08-12 15:34 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-10 23:53 Set FORCE_SOURCE_DATE=1 by default Vagrant Cascadian
2022-06-15  8:58 ` Ludovic Courtès
2022-06-15 16:24   ` Vagrant Cascadian
2022-06-21 20:48   ` Vagrant Cascadian
2022-06-21 21:06     ` Vagrant Cascadian
2022-06-22  3:57 ` Maxim Cournoyer
2022-06-22  6:08   ` Vagrant Cascadian
2022-06-22 13:53     ` Ludovic Courtès
2022-06-22 15:11       ` Vagrant Cascadian
2022-06-22 17:41         ` Maxim Cournoyer
2022-06-22 13:59     ` Maxim Cournoyer
2022-06-23  1:03       ` Vagrant Cascadian
2022-06-23 16:44         ` Maxim Cournoyer
2022-07-03  1:58           ` Vagrant Cascadian
2022-07-04 13:14             ` Ludovic Courtès
2022-08-12 15:32               ` Vagrant Cascadian
2022-06-22 15:16 ` Time namespace for build sandbox (was Re: Set FORCE_SOURCE_DATE=1 by default) Zhu Zihao
2022-06-22 15:35   ` Vagrant Cascadian
2022-06-22 16:41   ` Maxime Devos

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).