From patchwork Fri Jun 28 13:08:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars Bilke X-Patchwork-Id: 65710 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 4CE3A27BBEA; Fri, 28 Jun 2024 14:10:29 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 33ECE27BBE9 for ; Fri, 28 Jun 2024 14:10:28 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sNBMf-00024C-TE; Fri, 28 Jun 2024 09:10:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNBMa-00023p-Lh for guix-patches@gnu.org; Fri, 28 Jun 2024 09:10:04 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sNBMa-0001RT-Bq for guix-patches@gnu.org; Fri, 28 Jun 2024 09:10:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sNBMY-0002XI-AM; Fri, 28 Jun 2024 09:10:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#71821] [PATCH v2] gnu: petsc: scrub build machine specifics References: In-Reply-To: Resent-From: Lars Bilke Original-Sender: "Debbugs-submit" Resent-CC: andreas@enge.fr, bavier@posteo.net, sharlatanus@gmail.com, guix-patches@gnu.org Resent-Date: Fri, 28 Jun 2024 13:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71821 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 71821@debbugs.gnu.org Cc: Lars Bilke , Andreas Enge , Eric Bavier , Sharlatan Hellseher X-Debbugs-Original-Xcc: Andreas Enge , Eric Bavier , Sharlatan Hellseher Received: via spool by 71821-submit@debbugs.gnu.org id=B71821.17195801479664 (code B ref 71821); Fri, 28 Jun 2024 13:10:02 +0000 Received: (at 71821) by debbugs.gnu.org; 28 Jun 2024 13:09:07 +0000 Received: from localhost ([127.0.0.1]:44859 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sNBLf-0002Vn-8M for submit@debbugs.gnu.org; Fri, 28 Jun 2024 09:09:07 -0400 Received: from mailgate5.ufz.de ([141.65.7.212]:56562 helo=mailgate.ufz.de) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sNBLd-0002VG-1q for 71821@debbugs.gnu.org; Fri, 28 Jun 2024 09:09:06 -0400 Received: from imap.intranet.ufz.de (dcs1.intranet.ufz.de [141.65.125.135]) by mailgate.ufz.de (Mailgate5-UFZ) with ESMTP id 55912160309 for <71821@debbugs.gnu.org>; Fri, 28 Jun 2024 15:08:57 +0200 (CEST) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: TEXT/PLAIN Received: from conversion-daemon.imap.intranet.ufz.de by imap.intranet.ufz.de (Oracle Communications Messaging Server 8.0.2.6.20200227 64bit (built Feb 27 2020)) id <0SFS00100K923Z00@imap.intranet.ufz.de> for 71821@debbugs.gnu.org; Fri, 28 Jun 2024 15:08:57 +0200 (CEST) Received: from smtp1.ufz.de ([141.65.7.216]) by imap.intranet.ufz.de (Oracle Communications Messaging Server 8.0.2.6.20200227 64bit (built Feb 27 2020)) with ESMTPS id <0SFS00AOPKIW8WD0@imap.intranet.ufz.de> for 71821@debbugs.gnu.org; Fri, 28 Jun 2024 15:08:56 +0200 (CEST) Received: from envinf4.minotaur-alpha.ts.net (unknown [141.65.34.85]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp1.ufz.de (smtp1-UFZ) with ESMTPSA id 78C188007C; Fri, 28 Jun 2024 15:08:56 +0200 (CEST) Date: Fri, 28 Jun 2024 15:08:12 +0200 From: Lars Bilke Message-id: X-Mailer: git-send-email 2.44.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches '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(-) base-commit: 6a7d5cda17fd9d4bd99c58f7a5dbdd2d021354f9 diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm index de8e886485..8ab18cedf2 100644 --- a/gnu/packages/maths.scm +++ b/gnu/packages/maths.scm @@ -3544,38 +3544,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))) @@ -3587,17 +3590,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"))