Skip to content

Commit 0dba6a5

Browse files
author
B. Wilson
committed
make3: Explicitly define guix channel revision
For 100% build reproducibility we also need to ensure that we build against a stable set of dependencies. This commit defines an explicit guix channel revision against which the build script runs. In particular, without an explicit channel revision and when run on different machines, the build script is likely to produce different outputs, causing a mismatch with the target hash. In fact, the same may happen on a single machine, if invoked across `guix pull` updates.
1 parent 1dcae03 commit 0dba6a5

File tree

2 files changed

+46
-32
lines changed

2 files changed

+46
-32
lines changed

jbuild.scm renamed to make3/build.scm

Lines changed: 35 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
#!/usr/bin/env -S guix repl
1+
#!/usr/bin/env sh
2+
dir=${0%/*}; dir=${dir:-.}
3+
exec guix time-machine --channels=$dir/channels.scm -- repl "$0"
24
!#
35
;;; GNU Guix development package.
46
;;;
@@ -65,48 +67,49 @@
6567
#:use-module ((gnu packages maths) #:select (sleef)))
6668

6769

68-
(define %source-dir (dirname (current-filename)))
70+
(define %source-dir
71+
(let ((pipe (open-pipe* OPEN_READ "git" "rev-parse" "--show-toplevel")))
72+
(read-line pipe)))
6973

7074
(define (git-version)
7175
"Return a version string suitable for development builds."
72-
(let* ((pipe (with-directory-excursion %source-dir
73-
(open-pipe* OPEN_READ "git" "describe" "--always"
76+
(with-directory-excursion %source-dir
77+
(let* ((pipe (open-pipe* OPEN_READ "git" "describe" "--always"
7478
"--tags"
75-
"--abbrev=0")))
76-
(version (string-append (read-line pipe) "+git")))
77-
(close-pipe pipe)
78-
version))
79+
"--abbrev=0"))
80+
(version (string-append (read-line pipe) "+git")))
81+
(close-pipe pipe)
82+
version)))
7983

8084
(define (git-user)
8185
"Return a user info string scraped from Git."
82-
(let* ((name-pipe (with-directory-excursion %source-dir
83-
(open-pipe* OPEN_READ "git" "config" "user.name")))
84-
(email-pipe (with-directory-excursion %source-dir
85-
(open-pipe* OPEN_READ "git" "config" "user.email")))
86-
(name (read-line name-pipe))
87-
(email (read-line email-pipe))
88-
(status (every identity (map close-pipe `(,name-pipe ,email-pipe)))))
89-
(format #f "~a <~a>" name email)))
86+
(with-directory-excursion %source-dir
87+
(let* ((name-pipe (open-pipe* OPEN_READ "git" "config" "user.name"))
88+
(email-pipe (open-pipe* OPEN_READ "git" "config" "user.email"))
89+
(name (read-line name-pipe))
90+
(email (read-line email-pipe))
91+
(status (every identity (map close-pipe `(,name-pipe ,email-pipe)))))
92+
(format #f "~a <~a>" name email))))
9093
9194
;; Predicate intended for SELECT? argument of local-file procedure. Returns
9295
;; true if and only if file is tracked by git.
9396
(define git-file?
94-
(let* ((pipe (with-directory-excursion %source-dir
95-
(open-pipe* OPEN_READ "git" "ls-files")))
96-
(files (let loop ((lines '()))
97-
(match (read-line pipe)
98-
((? eof-object?) (reverse lines))
99-
((? (lambda (file) ; skip this file
100-
(string-match (current-filename)
101-
(canonicalize-path file))))
102-
(loop lines))
103-
(line (loop (cons line lines))))))
104-
(status (close-pipe pipe)))
105-
(lambda (file stat)
106-
(match (stat:type stat)
107-
('directory #t)
108-
((or 'regular 'symlink) (any (cut string-suffix? <> file) files))
109-
(_ #f)))))
97+
(with-directory-excursion %source-dir
98+
(let* ((pipe (open-pipe* OPEN_READ "git" "ls-files"))
99+
(files (let loop ((lines '()))
100+
(match (read-line pipe)
101+
((? eof-object?) (reverse lines))
102+
((? (lambda (file) ; skip this file
103+
(string-match (current-filename)
104+
(canonicalize-path file))))
105+
(loop lines))
106+
(line (loop (cons line lines))))))
107+
(status (close-pipe pipe)))
108+
(lambda (file stat)
109+
(match (stat:type stat)
110+
('directory #t)
111+
((or 'regular 'symlink) (any (cut string-suffix? <> file) files))
112+
(_ #f))))))
110113
111114
112115
;; G-exp script that detects AVX/AVX2 support at runtime and executes jconsole

make3/channels.scm

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
(list (channel
2+
(name 'guix)
3+
(url "https://git.savannah.gnu.org/git/guix.git")
4+
(branch "master")
5+
(commit
6+
"c026db3f469d79e92155e7cb883830ccafc4206d")
7+
(introduction
8+
(make-channel-introduction
9+
"9edb3f66fd807b096b48283debdcddccfea34bad"
10+
(openpgp-fingerprint
11+
"BBB0 2DDF 2CEA F6A8 0D1D E643 A2A0 6DF2 A33A 54FA")))))

0 commit comments

Comments
 (0)