summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Rostovtsev <dan@rostovtsev.org>2026-04-04 23:18:59 -0400
committerDan Rostovtsev <dan@rostovtsev.org>2026-04-07 20:12:36 -0400
commit90574cba9dd029e47948767bca8285ad62f28ce5 (patch)
treeceac93d07e384c68d77d4e4211debbe53a64c5de
parent74a742000554f31e2ac0a5aa0a9000b27d816ca3 (diff)
Added build-and-diff.scm to debug the determinism of builds.
Change-Id: Ia280c5517df7a1226f473001351c5fd2e754128e
-rw-r--r--build-and-diff.scm31
-rw-r--r--patch-checklist.bash5
2 files changed, 34 insertions, 2 deletions
diff --git a/build-and-diff.scm b/build-and-diff.scm
new file mode 100644
index 00000000000..39e164e9e3a
--- /dev/null
+++ b/build-and-diff.scm
@@ -0,0 +1,31 @@
+;; build-and-diff a derivation run twice.
+(use-modules (guix packages)
+ (guix store)
+ (guix derivations)
+ (gnu packages))
+
+(define (get-package-name) (read))
+
+(define (run-derivation-and-save pkgname outdir tag)
+ (let* ((pkg (specification->package pkgname))
+ (store (open-connection))
+ (drv ((package->derivation pkg) store))
+ (output (derivation->output-path drv))
+ (dest (string-append outdir "/" tag)))
+ (if (not (file-exists? outdir)) (mkdir outdir))
+ (build-derivations store (list drv))
+ (system* "chmod" "-R" "u+w" outdir)
+ (system* "rm" "-rf" dest)
+ (system* "cp" "-r" "-L" output dest)
+ dest))
+
+(let* ((pkgname (get-package-name))
+ (outdir (string-append "diff-build-" pkgname))
+ (tags '("a" "b")))
+ (write
+ (map
+ (lambda (tag)
+ (cons tag
+ (run-derivation-and-save pkgname outdir tag)))
+ tags))
+ (newline))
diff --git a/patch-checklist.bash b/patch-checklist.bash
index be2d83ec1bf..a0f1174450c 100644
--- a/patch-checklist.bash
+++ b/patch-checklist.bash
@@ -48,7 +48,7 @@ $DEVGUIX size $PACKAGE
$DEVGUIX refresh --list-dependent $PACKAGE
# 10. Check if build is deterministic
-$DEVGUIX build --rounds=2 --check $PACKAGE
+$DEVGUIX build -q --rounds=2 --check $PACKAGE
# 11. Gender neutral wording.
@@ -64,4 +64,5 @@ autoreconf -vif
make -j 4
# 16. Run a guix pull
-$DEVGUIX pull --url=$PWD --profile=/tmp/guix.temp --disable-authentication
+# -q to make sure local channel settings are ignored
+$DEVGUIX pull -q --url=$PWD --profile=/tmp/guix.temp --disable-authentication