all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Bilke <lars.bilke@ufz.de>
To: 71821@debbugs.gnu.org
Cc: Lars Bilke <lars.bilke@ufz.de>, Andreas Enge <andreas@enge.fr>,
	Eric Bavier <bavier@posteo.net>,
	Sharlatan Hellseher <sharlatanus@gmail.com>
Subject: [bug#71821] [PATCH v3] gnu: petsc: scrub build machine specifics
Date: Mon, 22 Jul 2024 10:25:47 +0200	[thread overview]
Message-ID: <891ca7832b5e73ee35d277ad1f7fe0f070dace8b.1721636747.git.lars.bilke@ufz.de> (raw)
In-Reply-To: <d580228f33d99676e3df5f5c48f437d63f00b53b.1719578824.git.lars.bilke@ufz.de>

Resending patch because of CI failure.

'Libraries compiled on' does not have to be removed since PETSc 3.9:

https: //gitlab.com/petsc/petsc/-/commit/a970bd748978a4e12790be7c36b10e832ec0149f

Also merged all add-after 'install phases into `clean-install.

Change-Id: I41d82339e43187d7dc7e3fc189a338784c363c68

sort source files in generated makefiles for reproducibility

Change-Id: I86e5b9cd0d7184019617bd8ae9a23eaf459891d7
---
 gnu/packages/maths.scm | 56 ++++++++++++++++++------------------------
 1 file changed, 24 insertions(+), 32 deletions(-)

diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 1265ae13e9..decc7ee67e 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -3545,38 +3545,41 @@ (define-public petsc
               (let* ((prefix (assoc-ref outputs "out"))
                      (flags `(,(string-append "--prefix=" prefix)
                               ,@configure-flags)))
+                ;; sort source files in configure (for reproducibility)
+                (substitute* "config/gmakegen.py"
+                   (("join\\(srcs\\[lang\\]\\)") "join(sorted(srcs[lang]))"))
                 (format #t "build directory: ~s~%" (getcwd))
                 (format #t "configure flags: ~s~%" flags)
                 (apply invoke "./configure" flags)
-
+                ;; Prevent build directory Linux version from leaking into
+                ;; compiled code
+                (substitute* (find-files "." "petscmachineinfo.h")
+                  (((getcwd)) out)
+                  ;; Scrub build machine characteristic
+                  (("Machine characteristics: Linux-[0-9]+\\.[0-9]+\\.[0-9]+")
+                    "Machine characteristics: Linux-x.x.x"))
                 ;; Generate test scripts with the right shebang.
                 (substitute* "config/example_template.py"
                   (("#!/usr/bin/env bash")
                    (string-append "#!" (which "bash")))))))
-          (add-after 'configure 'clean-local-references
-            (lambda* (#:key outputs #:allow-other-keys)
-              (let ((out (assoc-ref outputs "out")))
-                (substitute* (find-files "." "^petsc(conf|machineinfo).h$")
-                  ;; Prevent build directory from leaking into compiled code
-                  (((getcwd)) out)
-                  ;; Scrub timestamp for reproducibility
-                  ((".*Libraries compiled on.*") ""))
-                (substitute* (find-files "." "petscvariables")
-                  ;; Do not expose build machine characteristics, set to defaults.
-                  (("MAKE_NP = [:digit:]+") "MAKE_NP = 2")
-                  (("NPMAX = [:digit:]+") "NPMAX = 2")))))
           (add-after 'install 'clean-install
-            ;; Try to keep installed files from leaking build directory names.
             (lambda* (#:key inputs outputs #:allow-other-keys)
               (let ((out (assoc-ref outputs "out")))
-                (substitute* (map (lambda (file)
-                                    (string-append out "/lib/petsc/conf/" file))
-                                  '("petscvariables"))
-                  (((getcwd)) out))
-                ;; Make compiler references point to the store
                 (substitute* (string-append out "/lib/petsc/conf/petscvariables")
-                  (("= (gcc|g\\+\\+|gfortran)" _ compiler)
-                   (string-append "= " (which compiler))))
+                  ;; Try to keep installed files from leaking build directory names.
+                  (((getcwd)) out)
+                  ;; Do not expose build machine characteristics, set to defaults.
+                  (("MAKE_NP = [[:digit:]]+") "MAKE_NP = 2")
+                  (("MAKE_TEST_NP = [[:digit:]]+") "MAKE_TEST_NP = 2")
+                  (("MAKE_LOAD = [[:digit:]]+\\.[[:digit:]]+") "MAKE_LOAD = 2.0")
+                  (("NPMAX = [[:digit:]]+") "NPMAX = 2")
+                  ;; Do not retain a reference to GCC and other build only inputs.
+                  (("([[:graph:]]+)/bin/gcc") "gcc")
+                  (("([[:graph:]]+)/bin/g\\+\\+") "g++")
+                  (("([[:graph:]]+)/bin/make") "make")
+                  (("([[:graph:]]+)/bin/diff") "diff")
+                  (("([[:graph:]]+)/bin/sed") "sed")
+                  (("([[:graph:]]+)/bin/gfortran") "gfortran"))
                 ;; PETSc installs some build logs, which aren't necessary.
                 (for-each (lambda (file)
                             (let ((f (string-append out "/lib/petsc/conf/" file)))
@@ -3588,17 +3591,6 @@ (define-public petsc
                             "configure-hash"
                             ;; Once installed, should uninstall with Guix
                             "uninstall.py")))))
-          (add-after 'clean-install 'clear-reference-to-compiler
-            (lambda* (#:key inputs outputs #:allow-other-keys)
-              ;; Do not retain a reference to GCC and other build only inputs.
-              (let ((out (assoc-ref outputs "out")))
-              (substitute* (string-append out "/lib/petsc/conf/petscvariables")
-                (("([[:graph:]]+)/bin/gcc") "gcc")
-                (("([[:graph:]]+)/bin/g\\+\\+") "g++")
-                (("([[:graph:]]+)/bin/make") "make")
-                (("([[:graph:]]+)/bin/diff") "diff")
-                (("([[:graph:]]+)/bin/sed") "sed")
-                (("([[:graph:]]+)/bin/gfortran") "gfortran")))))
           (add-after 'install 'move-examples
             (lambda* (#:key outputs #:allow-other-keys)
               (let* ((out (assoc-ref outputs "out"))

base-commit: e5c0b62debc6f48a32a65736d9ba3da0b1e59cb9
-- 
2.44.0





  parent reply	other threads:[~2024-07-22  8:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-28 12:47 [bug#71821] [PATCH] gnu: petsc: make it reproducible Lars Bilke
2024-06-28 13:08 ` [bug#71821] [PATCH v2] gnu: petsc: scrub build machine specifics Lars Bilke
2024-07-22  8:25 ` Lars Bilke [this message]
2024-07-26 17:24   ` bug#71821: [PATCH v3] " Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=891ca7832b5e73ee35d277ad1f7fe0f070dace8b.1721636747.git.lars.bilke@ufz.de \
    --to=lars.bilke@ufz.de \
    --cc=71821@debbugs.gnu.org \
    --cc=andreas@enge.fr \
    --cc=bavier@posteo.net \
    --cc=sharlatanus@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.