;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès ;;; Copyright © 2016 Chris Marusich ;;; ;;; This file is part of GNU Guix. ;;; ;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . (define-module (gnu build install) #:use-module (guix build syscalls) #:use-module (guix build utils) #:use-module (guix build store-copy) #:use-module (srfi srfi-26) #:use-module (ice-9
aboutsummaryrefslogtreecommitdiff
blob: 543092900c015f7c27a1aa0c54efc71102ce4dda (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
From <https://github.com/bmwiedemann/psm/commit/98acae1a6f2c9b2e6014eac4070a817c9d0fd8a2>.

From 98acae1a6f2c9b2e6014eac4070a817c9d0fd8a2 Mon Sep 17 00:00:00 2001
From: "Bernhard M. Wiedemann" <bwiedemann@suse.de>
Date: Sun, 23 Jul 2017 07:02:28 +0200
Subject: [PATCH] Allow to override build date

in order to make builds reproducible.
See https://reproducible-builds.org/ for why this is good
and https://reproducible-builds.org/specs/source-date-epoch/
for the definition of this variable.

Also uses UTC to be independent of timezone settings.
---
 Makefile       | 2 +-
 ipath/Makefile | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index d79c4bd..99406ef 100644
--- a/Makefile
+++ b/Makefile
@@ -270,7 +270,7 @@ ${TARGLIB}.so.${MAJOR}: ${TARGLIB}.so.${MAJOR}.${MINOR}
 # file around.  Generate it such that the ident command can find it
 # and strings -a | grep InfiniPath does a reasonable job as well.
 ${TARGLIB}.so.${MAJOR}.${MINOR}: ${${TARGLIB}-objs}
-	date +'char psmi_infinipath_revision[] ="$$""Date: %F %R ${rpm_extra_description}InfiniPath $$";' > ${lib_build_dir}/_revision.c
+	date -u -d@$${SOURCE_DATE_EPOCH:-$$(date +%s)} +'char psmi_infinipath_revision[] ="$$""Date: %F %R ${rpm_extra_description}InfiniPath $$";' > ${lib_build_dir}/_revision.c
 	$(CC) -c $(BASECFLAGS) $(INCLUDES) _revision.c -o _revision.o
 	$(CC) $(LDFLAGS) -o $@ -Wl,-soname=${TARGLIB}.so.${MAJOR} -shared -Wl,--unique='*fastpath*' \
 		${${TARGLIB}-objs} _revision.o -L$(build_dir)/ipath $(LDLIBS)
diff --git a/ipath/Makefile b/ipath/Makefile
index 8c2cc6e..73abd6f 100644
--- a/ipath/Makefile
+++ b/ipath/Makefile
@@ -70,7 +70,7 @@ ${TARGLIB}.so.${MAJOR}: ${TARGLIB}.so.${MAJOR}.${MINOR}
 # file around.  Generate it such that the ident command can find it
 # and strings -a | grep InfiniPath does a reasonable job as well.
 ${TARGLIB}.so.${MAJOR}.${MINOR}: ${${TARGLIB}-objs}
-	date +'static __attribute__ ((unused)) char __psc_infinipath_revision[] ="$$""Date: %F %R ${rpm_extra_description}InfiniPath $$";' > _revision.c
+	date -u -d@$${SOURCE_DATE_EPOCH:-$$(date +%s)} +'static __attribute__ ((unused)) char __psc_infinipath_revision[] ="$$""Date: %F %R ${rpm_extra_description}InfiniPath $$";' > _revision.c
 	$(CC) -c $(BASECFLAGS) $(INCLUDES) _revision.c -o _revision.o
 	$(CC) -o $@ -Wl,-soname=${TARGLIB}.so.${MAJOR} -shared \
 		-Wl,--unique='*fastpath*' \
e database (scope "/var/guix/db/")) (chmod (scope "/var/guix/db/db.sqlite") #o644) (mkdir-p* "/var/guix/profiles") (mkdir-p* "/var/guix/gcroots") (symlink* "/var/guix/profiles" "/var/guix/gcroots/profiles") ;; Make root's profile, which makes it a GC root. (mkdir-p* %root-profile) (symlink* profile (string-append %root-profile "/" profile-name "-1-link")) (symlink* (string-append profile-name "-1-link") (string-append %root-profile "/" profile-name))) (define* (populate-single-profile-directory directory #:key profile closure (profile-name "guix-profile") database) "Populate DIRECTORY with a store containing PROFILE, whose closure is given in the file called CLOSURE (as generated by #:references-graphs.) DIRECTORY is initialized to contain a single profile under /root pointing to PROFILE. When DATABASE is true, copy it to DIRECTORY/var/guix/db and create DIRECTORY/var/guix/gcroots and friends. PROFILE-NAME is the name of the profile being created under /var/guix/profiles, typically either \"guix-profile\" or \"current-guix\". This is used to create the self-contained tarballs with 'guix pack'." (define (scope file) (string-append directory "/" file)) (define (mkdir-p* dir) (mkdir-p (scope dir))) (define (symlink* old new) (symlink old (scope new))) ;; Populate the store. (populate-store (list closure) directory) (when database (install-database-and-gc-roots directory database profile #:profile-name profile-name)) (match profile-name ("guix-profile" (mkdir-p* "/root") (symlink* (string-append %root-profile "/guix-profile") "/root/.guix-profile")) ("current-guix" (mkdir-p* "/root/.config/guix") (symlink* (string-append %root-profile "/current-guix") "/root/.config/guix/current")) (_ #t))) (define (mount-cow-store target backing-directory) "Make the store copy-on-write, using TARGET as the backing store. This is useful when TARGET is on a hard disk, whereas the current store is on a RAM disk." (define (set-store-permissions directory) "Set the right perms on DIRECTORY to use it as the store." (chown directory 0 30000) ;use the fixed 'guixbuild' GID (chmod directory #o1775)) (let ((tmpdir (string-append target "/tmp"))) (mkdir-p tmpdir) (mount tmpdir "/tmp" "none" MS_BIND)) (let* ((rw-dir (string-append target backing-directory)) (work-dir (string-append rw-dir "/../.overlayfs-workdir"))) (mkdir-p rw-dir) (mkdir-p work-dir) (mkdir-p "/.rw-store") (set-store-permissions rw-dir) (set-store-permissions "/.rw-store") ;; Mount the overlay, then atomically make it the store. (mount "none" "/.rw-store" "overlay" 0 (string-append "lowerdir=" (%store-directory) "," "upperdir=" rw-dir "," "workdir=" work-dir)) (mount "/.rw-store" (%store-directory) "" MS_MOVE) (rmdir "/.rw-store"))) (define (unmount-cow-store target backing-directory) "Unmount copy-on-write store." (let ((tmp-dir "/remove")) (mkdir-p tmp-dir) (mount (%store-directory) tmp-dir "" MS_MOVE) (umount tmp-dir) (rmdir tmp-dir) (delete-file-recursively (string-append target backing-directory)))) ;;; install.scm ends here