From 12024d0faddfd49d0da7644ea231772bcb128869 Mon Sep 17 00:00:00 2001 From: Dan Rostovtsev Date: Sun, 5 Apr 2026 17:17:07 -0400 Subject: Zeroing in on rocq diff: * reproduce.bash: using guix build / gc to get two isolated build results * build-and-diff.scm: removed. Change-Id: I4de1ee1bdd769bf2030b173ff454be0179ca82d7 --- build-and-diff.scm | 31 ------------------------------- reproduce.bash | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 31 deletions(-) delete mode 100644 build-and-diff.scm create mode 100644 reproduce.bash diff --git a/build-and-diff.scm b/build-and-diff.scm deleted file mode 100644 index 39e164e9e3a..00000000000 --- a/build-and-diff.scm +++ /dev/null @@ -1,31 +0,0 @@ -;; 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/reproduce.bash b/reproduce.bash new file mode 100644 index 00000000000..cb2f6993c9b --- /dev/null +++ b/reproduce.bash @@ -0,0 +1,45 @@ +# a tool to reproduce a build for checking diffs + +while getopts :p: OPT; do + case $OPT in + p|+p) + PACKAGE=$OPTARG + ;; + *) + echo "usage: ${0##*/} [+-p ARG} [--] ARGS..." + exit 2 + esac +done +shift $(( OPTIND - 1 )) +OPTIND=1 + +if [ ! $PACKAGE ] +then + echo "Please set package with -p" + exit 1 +fi + +function reproduce-and-tag +{ + TAG=$1 + OUT=$(guix build --no-substitutes $PACKAGE) + REPRODIR=repro/$PACKAGE/$TAG + mkdir -p $REPRODIR + cp -r $OUT/* $REPRODIR + chmod -R u+w $REPRODIR # default not writeable in store + guix gc -D $OUT + if [ -f $OUT ] + then + echo [ERROR] $OUT was not deleted + exit 1 + fi + echo "=== REPRODUCTION SUMMARY ===" + echo "Tag: $TAG" + echo "Store Output: $OUT" + echo "Copied to: $REPRODIR" + echo "----------------------------" + echo +} + +reproduce-and-tag "A" +reproduce-and-tag "B" -- cgit v1.3