From patchwork Sun Mar 27 21:40:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thiago Jung Bauermann X-Patchwork-Id: 38153 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 4E73A27BBEA; Sun, 27 Mar 2022 22:42:14 +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=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable 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 460C327BBE9 for ; Sun, 27 Mar 2022 22:42:13 +0100 (BST) Received: from localhost ([::1]:36238 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nYaeI-0006vK-KO for patchwork@mira.cbaines.net; Sun, 27 Mar 2022 17:42:12 -0400 Received: from eggs.gnu.org ([209.51.188.92]:48672) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nYaeA-0006ub-FQ for guix-patches@gnu.org; Sun, 27 Mar 2022 17:42:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:34567) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nYaeA-0005Yg-74 for guix-patches@gnu.org; Sun, 27 Mar 2022 17:42:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nYaeA-0004XR-5M for guix-patches@gnu.org; Sun, 27 Mar 2022 17:42:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49672] [PATCH v2 4/6] gnu: Use =?utf-8?q?=E2=80=98current-targ?= =?utf-8?q?et-nix-system=E2=80=99?= for matches Resent-From: Thiago Jung Bauermann Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 27 Mar 2022 21:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49672 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 49672@debbugs.gnu.org Cc: Maxime Devos , Thiago Jung Bauermann Received: via spool by 49672-submit@debbugs.gnu.org id=B49672.164841727217360 (code B ref 49672); Sun, 27 Mar 2022 21:42:02 +0000 Received: (at 49672) by debbugs.gnu.org; 27 Mar 2022 21:41:12 +0000 Received: from localhost ([127.0.0.1]:56689 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nYadL-0004Vv-98 for submit@debbugs.gnu.org; Sun, 27 Mar 2022 17:41:11 -0400 Received: from mx.kolabnow.com ([212.103.80.155]:18460) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nYadJ-0004Vh-8O for 49672@debbugs.gnu.org; Sun, 27 Mar 2022 17:41:10 -0400 Received: from localhost (unknown [127.0.0.1]) by mx.kolabnow.com (Postfix) with ESMTP id 21697141B; Sun, 27 Mar 2022 23:41:03 +0200 (CEST) Authentication-Results: ext-mx-out002.mykolab.com (amavisd-new); dkim=pass (4096-bit key) reason="pass (just generated, assumed good)" header.d=kolabnow.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kolabnow.com; h= content-transfer-encoding:content-type:content-type:mime-version :references:in-reply-to:message-id:date:date:subject:subject :from:from:received:received:received; s=dkim20160331; t= 1648417262; x=1650231663; bh=iAhegk3fIkKjwuEGb3aeeoPW9sUL9vpibhc 0UxkN2Gw=; b=uphtYJYnqIjjBFXOG/R0LMlthTWFzwK1/+3m+kcXZgcNE5WMZyx 46McF4TMk5sdnZxF8VFpc7qbU7PNmtWXvKBQf3ldB1vSkbcV4Qht1hjvhVh0MRqo 2pDnFZ/LVSrCpv2Rrma74aDajV3OkKS1EgN3MNIyXaXxtMMeSrQyfCyC26xoWCCa gQsIpre1qEP5IcC84tvmfBaieORA2XPcn0mZ3LopISyY0g6Ba3lKU1ZHoGs4v92o FiEndJmsfe2Dd2xvU7AonSvzj9lG75xhx5pp25s6MYjIGKaCIbqfx27sgQhPjvJu ZdBNr+IgF58MOxufGLp1MCyfxupuo6X3epP64kyIDCWYCH1e4DpiusNLspdHYExH RfUBY9gEmp3E2AOKhR+5fUFlWds8HmWVa9BBIktlxsbGXNv+z1oybp/PKHFrk2Hn SsjG8U4Ko5ABxPv4mX0A65VWSmQB7q6tW5PHaL6tQn6vD3tKRu4StfYXdXMUBbuo 3P1h4HDfL6o/I/rL5rD7CeOSFMdrrn5SZgzZOKdckv7Vfi+4Jk4ELD8R8plsXf/g 1JRZkJSnh+5/UoRmG/YgDM4o+55+dC0tIHO/tJu96YOhA5gOC5VDEWkc2SFLSVE3 XstWyrxgob87ay0bNBRbN4BABQAoOM/EZcB1OG+e7flkSD4a6/cCWksk= X-Virus-Scanned: amavisd-new at mykolab.com Received: from mx.kolabnow.com ([127.0.0.1]) by localhost (ext-mx-out002.mykolab.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TdL-oFG60kr9; Sun, 27 Mar 2022 23:41:02 +0200 (CEST) Received: from int-mx003.mykolab.com (unknown [10.9.13.3]) by mx.kolabnow.com (Postfix) with ESMTPS id 7957A1419; Sun, 27 Mar 2022 23:41:01 +0200 (CEST) Received: from ext-subm001.mykolab.com (unknown [10.9.6.1]) by int-mx003.mykolab.com (Postfix) with ESMTPS id CCE9AA86; Sun, 27 Mar 2022 23:41:00 +0200 (CEST) Date: Sun, 27 Mar 2022 18:40:24 -0300 Message-Id: <20220327214026.102723-5-bauermann@kolabnow.com> In-Reply-To: <20220327214026.102723-1-bauermann@kolabnow.com> References: <20220327214026.102723-1-bauermann@kolabnow.com> MIME-Version: 1.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" Reply-to: Thiago Jung Bauermann X-ACL-Warn: , Thiago Jung Bauermann via Guix-patches X-Patchwork-Original-From: Thiago Jung Bauermann via Guix-patches via From: Thiago Jung Bauermann X-getmail-retrieved-from-mailbox: Patches Several packages try to match both ‘%current-target-system’ and ‘%current-system’ against lists of Nix system identifiers. This is a bug because while ‘%current-system’ does contain a Nix system identifier, ‘%current-target-system’ contains a GNU triplet, which is different. Some places also check whether the system identifier starts with “-linux”, which is a Nix system identifier. The GNU triplet identifier stored in ‘%current-target-system’ may not match the pattern if it includes a vendor field (e.g., “x86_64-unknown-linux-gnu”, or "i586-pc-gnu”). To fix these problems make these places use the function ‘current-target-nix-system’, which always returns a Nix system identifier. In the case of the “go” and “clisp” packages, this also fixes a bug where ‘%current-system’ and ‘%current-target-system’ were being checked in the wrong order. * gnu/packages/astronomy.scm (libpasastro)[arguments]<#:make-flags>: Use ‘current-target-nix-system’ to match list of Nix system identifiers. * gnu/packages/bootloaders.scm (u-boot-tools)[arguments]<#:phases>: Likewise. * gnu/packages/c.scm (tcc)[arguments]<#:configure-flags>: Likewise. * gnu/packages/compression.scm (zpaq)[arguments]<#:make-flags>: Likewise. * gnu/packages/debug.scm (american-fuzzy-lop): Likewise. (qemu-for-american-fuzzy-lop): Likewise. * gnu/packages/digest.scm (xxhash)[arguments]<#:make-flags>: Likewise. * gnu/packages/golang.scm (go-1.4)[arguments]<#:system>: Likewise. (go-1.14)[arguments]<#:system>: Likewise. * gnu/packages/java.scm (java-swt)[source]: Likewise. (java-jansi)[arguments]<#:phases>: Likewise. * gnu/packages/julia.scm (julia)[arguments]<#:make-flags>: Likewise. * gnu/packages/lisp.scm (clisp)[arguments]<#:configure-flags>: Likewise. * gnu/packages/make-bootstrap.scm (%bootstrap-tarballs)[arguments] <#:builder>: Likewise * gnu/packages/mes.scm (mes)[native-inputs]: Likewise. * gnu/packages/pascal.scm (fpc)[native-inputs]: Likewise. [arguments]<#:phases>: Likewise. * gnu/packages/video.scm (mplayer)[arguments]<#:phases>: Likewise. * gnu/packages/web.scm (nginx)[arguments]<#:phases>: Likewise. * gnu/packages/web.scm (nginx-accept-language-module)[arguments] <#:phases>: Likewise. --- gnu/packages/astronomy.scm | 4 ++-- gnu/packages/bootloaders.scm | 4 +--- gnu/packages/c.scm | 3 +-- gnu/packages/compression.scm | 6 ++---- gnu/packages/debug.scm | 6 ++---- gnu/packages/digest.scm | 3 +-- gnu/packages/golang.scm | 6 ++---- gnu/packages/java.scm | 4 ++-- gnu/packages/julia.scm | 3 +-- gnu/packages/lisp.scm | 3 +-- gnu/packages/make-bootstrap.scm | 2 +- gnu/packages/mes.scm | 3 +-- gnu/packages/pascal.scm | 6 ++---- gnu/packages/video.scm | 3 +-- gnu/packages/web.scm | 6 ++---- 15 files changed, 22 insertions(+), 40 deletions(-) diff --git a/gnu/packages/astronomy.scm b/gnu/packages/astronomy.scm index c209b1538f72..baa48e382ba4 100644 --- a/gnu/packages/astronomy.scm +++ b/gnu/packages/astronomy.scm @@ -1021,11 +1021,11 @@ (define-public libpasastro `(#:tests? #f #:make-flags (list - ,(match (or (%current-target-system) (%current-system)) + ,(match (current-target-nix-system) ((or "aarch64-linux" "armhf-linux" "i686-linux" "x86_64-linux") "OS_TARGET=linux") (_ #f)) - ,(match (or (%current-target-system) (%current-system)) + ,(match (current-target-nix-system) ("i686-linux" "CPU_TARGET=i386") ("x86_64-linux" "CPU_TARGET=x86_64") ((or "armhf-linux" "aarch64-linux") "CPU_TARGET=armv7l") diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm index 798764103117..40dd38fdd28a 100644 --- a/gnu/packages/bootloaders.scm +++ b/gnu/packages/bootloaders.scm @@ -640,9 +640,7 @@ (define-public u-boot-tools (invoke "test/image/test-imagetools.sh"))) ;; Only run full test suite on x86_64 systems, as many tests ;; assume x86_64. - ,@(if (string-match "^x86_64-linux" - (or (%current-target-system) - (%current-system))) + ,@(if (string-match "^x86_64-linux" (current-target-nix-system)) '((add-after 'check 'check-x86 (lambda* (#:key make-flags test-target #:allow-other-keys) (apply invoke "make" "mrproper" make-flags) diff --git a/gnu/packages/c.scm b/gnu/packages/c.scm index d545d98938b0..f9e4c497de6a 100644 --- a/gnu/packages/c.scm +++ b/gnu/packages/c.scm @@ -90,8 +90,7 @@ (define-public tcc (assoc-ref %build-inputs "libc") "/lib") ,@(if (string-prefix? "armhf-linux" - (or (%current-target-system) - (%current-system))) + (current-target-nix-system)) `("--triplet=arm-linux-gnueabihf") '())) #:test-target "test")) diff --git a/gnu/packages/compression.scm b/gnu/packages/compression.scm index 3edaecd9518f..7e906eceda52 100644 --- a/gnu/packages/compression.scm +++ b/gnu/packages/compression.scm @@ -1449,16 +1449,14 @@ (define-public zpaq #:make-flags (list (string-append "CPPFLAGS=-Dunix" - ,(match (or (%current-target-system) - (%current-system)) + ,(match (current-target-nix-system) ("x86_64-linux" "") ("i686-linux" "") (_ " -DNOJIT"))) ;; These should be safe, lowest-common-denominator instruction sets, ;; allowing for some optimisation while remaining reproducible. (string-append "CXXFLAGS=-O3 -DNDEBUG" - ,(match (or (%current-target-system) - (%current-system)) + ,(match (current-target-nix-system) ("x86_64-linux" " -march=nocona -mtune=generic") ("i686-linux" " -march=i686 -mtune=generic") ("armhf-linux" " -mtune=generic-armv7-a") diff --git a/gnu/packages/debug.scm b/gnu/packages/debug.scm index 80685900ebb6..d96217c95b76 100644 --- a/gnu/packages/debug.scm +++ b/gnu/packages/debug.scm @@ -228,8 +228,7 @@ (define-public c-vise (license license:ncsa))) (define-public american-fuzzy-lop - (let ((machine (match (or (%current-target-system) - (%current-system)) + (let ((machine (match (current-target-nix-system) ("x86_64-linux" "x86_64") ("i686-linux" "i386") ("aarch64-linux" "aarch64") @@ -304,8 +303,7 @@ (define-public american-fuzzy-lop (define-public qemu-for-american-fuzzy-lop ;; afl only supports using a single afl-qemu-trace executable, so ;; we only build qemu for the native target. - (let ((machine (match (or (%current-target-system) - (%current-system)) + (let ((machine (match (current-target-nix-system) ("x86_64-linux" "x86_64") ("i686-linux" "i386") ("aarch64-linux" "aarch64") diff --git a/gnu/packages/digest.scm b/gnu/packages/digest.scm index 4211848fdb61..31e9d315cd07 100644 --- a/gnu/packages/digest.scm +++ b/gnu/packages/digest.scm @@ -82,8 +82,7 @@ (define-public xxhash (arguments (list #:make-flags #~(list #$(string-append "CC=" (cc-for-target)) - #$(match (or (%current-target-system) - (%current-system)) + #$(match (current-target-nix-system) ;; Detect vector instruction set at run time. ((or "i686-linux" "x86_64-linux") "DISPATCH=1") (_ "DISPATCH=0")) diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm index a8b845e3012a..e7ebf09f1c46 100644 --- a/gnu/packages/golang.scm +++ b/gnu/packages/golang.scm @@ -114,8 +114,7 @@ (define-public go-1.4 (guix build utils) (srfi srfi-1)) #:tests? #f ; Tests are run by the all.bash script. - ,@(if (string-prefix? "aarch64-linux" (or (%current-system) - (%current-target-system))) + ,@(if (string-prefix? "aarch64-linux" (current-target-nix-system)) '(#:system "armhf-linux") '()) #:phases @@ -264,8 +263,7 @@ (define-public go-1.14 (arguments (substitute-keyword-arguments (package-arguments go-1.4) ((#:system system) - (if (string-prefix? "aarch64-linux" (or (%current-system) - (%current-target-system))) + (if (string-prefix? "aarch64-linux" (current-target-nix-system)) "aarch64-linux" system)) ((#:phases phases) diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm index b27892841ec6..aead02d93c31 100644 --- a/gnu/packages/java.scm +++ b/gnu/packages/java.scm @@ -3483,7 +3483,7 @@ (define-public java-swt (file32 "x86") (file64 "x86_64")) (let-values (((hash file) - (match (or (%current-target-system) (%current-system)) + (match (current-target-nix-system) ("x86_64-linux" (values hash64 file64)) (_ (values hash32 file32))))) (origin @@ -12092,7 +12092,7 @@ (define-public java-jansi (lambda _ (let ((dir (string-append "build/classes/org/fusesource/" "jansi/internal/native/" - ,(match (or (%current-target-system) (%current-system)) + ,(match (current-target-nix-system) ("i686-linux" "Linux/x86") ("x86_64-linux" "Linux/x86_64") ("armhf-linux" "Linux/armv7") diff --git a/gnu/packages/julia.scm b/gnu/packages/julia.scm index 0bdac6617508..c1a1d185d544 100644 --- a/gnu/packages/julia.scm +++ b/gnu/packages/julia.scm @@ -452,8 +452,7 @@ (define-public julia ;; Passing the MARCH or JULIA_CPU_TARGET flag is necessary to build ;; binary substitutes for the supported architectures. See also ;; https://docs.julialang.org/en/v1/devdocs/sysimg/#Specifying-multiple-system-image-targets - ,(match (or (%current-target-system) - (%current-system)) + ,(match (current-target-nix-system) ("x86_64-linux" ;; These are the flags that upstream uses for their binaries. "JULIA_CPU_TARGET=generic;generic,-cx16,clone_all;sandybridge,-xsaveopt,clone_all;haswell,-rdrnd,base(1)") diff --git a/gnu/packages/lisp.scm b/gnu/packages/lisp.scm index 361d6409d43a..e6e1aada5b1c 100644 --- a/gnu/packages/lisp.scm +++ b/gnu/packages/lisp.scm @@ -356,8 +356,7 @@ (define-public clisp (inputs (list libffcall ncurses readline libsigsegv)) (arguments `(#:configure-flags '(,@(if (string-prefix? "armhf-linux" - (or (%current-system) - (%current-target-system))) + (current-target-nix-system)) '("CFLAGS=-falign-functions=4") '()) "--with-dynamic-ffi" diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm index 4ea97368a99e..595630d22b58 100644 --- a/gnu/packages/make-bootstrap.scm +++ b/gnu/packages/make-bootstrap.scm @@ -897,7 +897,7 @@ (define out #$output) %build-inputs)))) (inputs (append (list %guile-bootstrap-tarball) - (match (or (%current-target-system) (%current-system)) + (match (current-target-nix-system) ((or "i686-linux" "x86_64-linux") (list %mescc-tools-bootstrap-tarball %mes-bootstrap-tarball diff --git a/gnu/packages/mes.scm b/gnu/packages/mes.scm index a862d84fc8ce..e5e947cb4df9 100644 --- a/gnu/packages/mes.scm +++ b/gnu/packages/mes.scm @@ -179,8 +179,7 @@ (define-public mes (propagated-inputs (list mescc-tools nyacc-1.00.2)) (native-inputs (append (list guile-3.0) - (let ((target-system (or (%current-target-system) - (%current-system)))) + (let ((target-system (current-target-nix-system))) (cond ((string-prefix? "x86_64-linux" target-system) ;; Use cross-compiler rather than #:system "i686-linux" to get diff --git a/gnu/packages/pascal.scm b/gnu/packages/pascal.scm index af7857f08495..7a3260ccbbaf 100644 --- a/gnu/packages/pascal.scm +++ b/gnu/packages/pascal.scm @@ -89,8 +89,7 @@ (define-public fpc (list expat glibc ld-wrapper ncurses zlib)) (native-inputs ;; FPC is built with FPC, so we need bootstrap binaries. - `(("fpc-binary" ,(match (or (%current-target-system) - (%current-system)) + `(("fpc-binary" ,(match (current-target-nix-system) ("i686-linux" fpc-bootstrap-i386) ;;("powerpc64le-linux" fpc-bootstrap-ppc64le) ;;("powerpc-linux" fpc-bootstrap-ppc) @@ -103,8 +102,7 @@ (define-public fpc #:phases (let ((fpc-bootstrap-path (string-append (getcwd) "/" ,name "-" ,version "/fpc-bin")) - (arch ,(match (or (%current-target-system) - (%current-system)) + (arch ,(match (current-target-nix-system) ("i686-linux" "i386") ("x86_64-linux" "x86_64") (_ "unknown")))) diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm index dc05c0a22265..3684421ecaa7 100644 --- a/gnu/packages/video.scm +++ b/gnu/packages/video.scm @@ -2089,8 +2089,7 @@ (define-public mplayer (string-append "--prefix=" out) ;; Enable runtime cpu detection where supported, ;; and choose a suitable target. - ,@(match (or (%current-target-system) - (%current-system)) + ,@(match (current-target-nix-system) ("x86_64-linux" '("--enable-runtime-cpudetection" "--target=x86_64-linux")) diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm index 75aa5ce9078b..24535226ec20 100644 --- a/gnu/packages/web.scm +++ b/gnu/packages/web.scm @@ -413,8 +413,7 @@ (define-public nginx ,(let ((system "Linux") ; uname -s (release "3.2.0") ; uname -r ;; uname -m - (machine (match (or (%current-target-system) - (%current-system)) + (machine (match (current-target-nix-system) ("x86_64-linux" "x86_64") ("i686-linux" "i686") ("mips64el-linux" "mips64") @@ -603,8 +602,7 @@ (define-public nginx-accept-language-module ,(let ((system "Linux") ; uname -s (release "3.2.0") ; uname -r ;; uname -m - (machine (match (or (%current-target-system) - (%current-system)) + (machine (match (current-target-nix-system) ("x86_64-linux" "x86_64") ("i686-linux" "i686") ("mips64el-linux" "mips64")