From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id WPaWFVncQGJlhAAAgWs5BA (envelope-from ) for ; Sun, 27 Mar 2022 23:51:21 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id IMspDlncQGI7UQEAG6o9tA (envelope-from ) for ; Sun, 27 Mar 2022 23:51:21 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id B46D41B1D9 for ; Sun, 27 Mar 2022 23:51:20 +0200 (CEST) Received: from localhost ([::1]:39424 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nYan8-00018j-Ho for larch@yhetil.org; Sun, 27 Mar 2022 17:51:18 -0400 Received: from eggs.gnu.org ([209.51.188.92]:49632) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nYams-00018O-87 for guix-patches@gnu.org; Sun, 27 Mar 2022 17:51:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:34578) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nYamr-0006hH-Vk for guix-patches@gnu.org; Sun, 27 Mar 2022 17:51:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nYamr-0004o8-Ji for guix-patches@gnu.org; Sun, 27 Mar 2022 17:51:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49672] [PATCH v2 3/6] utils: Introduce the =?UTF-8?Q?=E2=80=98current-target-nix-system=E2=80=99?= procedure Resent-From: Thiago Jung Bauermann Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 27 Mar 2022 21:51:01 +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.164841785218462 (code B ref 49672); Sun, 27 Mar 2022 21:51:01 +0000 Received: (at 49672) by debbugs.gnu.org; 27 Mar 2022 21:50:52 +0000 Received: from localhost ([127.0.0.1]:56708 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nYamh-0004ng-Oy for submit@debbugs.gnu.org; Sun, 27 Mar 2022 17:50:52 -0400 Received: from mx.kolabnow.com ([212.103.80.154]:3440) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nYamf-0004nT-Jw for 49672@debbugs.gnu.org; Sun, 27 Mar 2022 17:50:50 -0400 Received: from localhost (unknown [127.0.0.1]) by mx.kolabnow.com (Postfix) with ESMTP id E54031A0D; Sun, 27 Mar 2022 23:41:00 +0200 (CEST) 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= 1648417260; x=1650231661; bh=UCCO8iMFjJihEEtub0kvSDOnPlu+KT7clTY WTK8y2Z8=; b=wa/6iKOSIp7N7yIZgAvGsqY8ZtiPgAJk8XX9uVxErxZw3tbBfxs GcBqf+ShFZecMuxsVf8H2M165v1wNUsg/JTGmfX27Dr4SjzTP8jlh2LeA1Hs0YFI ybBPbWINmAe2Tx0Z0K+3AqflCKZ3UZwq0IKt9bI6FkXHrJNiKPXIKeHSiGTerRVD fBM5NVMFNqQ81HKJmQ1tOp3St0Xw5Zk01NzdyLxeDetnJf/UIP377+WfZgyuRtBQ tCciophfHoJdoTPXmzri2PBn9NwhP9ZWLCAjH8sBPXLzuF+X2rjdUr/AwTID5kyw bggYFeAOlk3SO3sIrVVmQAAc6BQJ9BXX2wDMmZ9xiwyLup/ebCQr6SycMzS7DqVf 6lGUeu6CKR2ja3o/mYzkV3/qYAVQGC89kZBGGCbePPNOjNZjA6YSLdE5zN8FfHRJ wmvXazJUIAKUW4Lvycc7dt/LOTsoi27VLIhAPhUkhHTzQCIahhTEO7NyBvZanNvp srbDsZYJ1VrpQDqpsT0lzGh14qFLB4KHYLgiR89C1c/+0KDzkqk/GddkWalp93cn W21ghzIt9ylUQoqp4cG89ZoYgpWG0puEUipUflDnX4AvQf94f+bxu3SgL1Tn0VfR YzDnlY1LB7E+kkEoMwFbn99E4mUrCaHB+ufBi6asPnAtHBKgEhpi/YFA= X-Virus-Scanned: amavisd-new at mykolab.com Received: from mx.kolabnow.com ([127.0.0.1]) by localhost (ext-mx-out001.mykolab.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6cTEAJDDo5ia; Sun, 27 Mar 2022 23:41:00 +0200 (CEST) Received: from int-mx001.mykolab.com (unknown [10.9.13.1]) by mx.kolabnow.com (Postfix) with ESMTPS id C8A5F14D8; Sun, 27 Mar 2022 23:40:50 +0200 (CEST) Received: from ext-subm001.mykolab.com (unknown [10.9.6.1]) by int-mx001.mykolab.com (Postfix) with ESMTPS id 496EBBC9; Sun, 27 Mar 2022 23:40:50 +0200 (CEST) Date: Sun, 27 Mar 2022 18:40:23 -0300 Message-Id: <20220327214026.102723-4-bauermann@kolabnow.com> In-Reply-To: <20220327214026.102723-1-bauermann@kolabnow.com> References: <20220327214026.102723-1-bauermann@kolabnow.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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+larch=yhetil.org@gnu.org Sender: "Guix-patches" Reply-to: Thiago Jung Bauermann X-ACL-Warn: , Thiago Jung Bauermann via Guix-patches From: Thiago Jung Bauermann via Guix-patches via X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1648417881; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=UCCO8iMFjJihEEtub0kvSDOnPlu+KT7clTYWTK8y2Z8=; b=XgfABlhbgcCLnuRA2KDQqv8yGwpmiY8rcFF6nSqH55XRvxesZjo+c4Xj/mq+CPH7OXUUUa GOkxO+V1a1ust7cZeKT6s03WB1fyIGj9OmYazCuQQiTC9JR2dkseRlxANSOmBjq+0CP7hS aQ1B3kwL4cDG2W4spoDO8ZYyV0LciJCUXc4vLD/MPQW3uYb9lrQuFlolBZ82MuFAsFg7MO U7qAwtUuV2FsvlCQBEbfw5LfoR4PhUSN+JQfAUH8KllrRBNYnvY8iPB5MahA1nyYQ+Y6AI eB1593X4viWZWbvm4o+rCcsllJojgCa02HUwJLRz8v1lKLjmLoToLGYXm2T/KQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1648417881; a=rsa-sha256; cv=none; b=ksCcxpDphsLlxabFsCjgtmZxxIUDW3dgTKj8Qrh5cZcdVtndDxB0i3WXwyDtsGwX85GTV7 I1vVGciyJzx5+89DHigOhnCoznmhlk9Ugtu3qOtLQSnLsm70njI8ExIT2/1BGCVSSdals7 8fNXf3Rbfc6kgZGt9Dxy+VbVOful0ns6GHjOBlCaCJJl+mR7xp1hzDC9/rZ++1BMcqFRKv mY6LOux+4AJ+bcChgvuHi633SXqYC55rYRbqxh/3dkNAk5t70Xrvx/S7cBFxQ3YRSl1DHT gfxgbdOgAvF3crWhO67wrhXUZtg/GYTTfEW+sppjhlA9FKbhu1OrZbmgHO/Q9w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=kolabnow.com header.s=dkim20160331 header.b="wa/6iKOS"; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -4.37 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=kolabnow.com header.s=dkim20160331 header.b="wa/6iKOS"; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: B46D41B1D9 X-Spam-Score: -4.37 X-Migadu-Scanner: scn0.migadu.com X-TUID: 07O7eP0+9CBU Both ‘glibc-dynamic-linker’ and ‘system->llvm-target’ use the same logic for the default value of their arguments, so factor it out into a separate procedure. It turns out that this procedure will be useful in other places as well. * gnu/packages/bootstrap.scm (glibc-dynamic-linker): Use result of ‘current-target-nix-system’ as default value for ‘system’ argument. * gnu/packages/llvm.scm (system->llvm-target): Likewise. * guix/utils.scm (current-target-nix-system): Define. --- gnu/packages/bootstrap.scm | 4 +--- gnu/packages/llvm.scm | 4 +--- guix/utils.scm | 7 +++++++ 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/gnu/packages/bootstrap.scm b/gnu/packages/bootstrap.scm index 8bd0c4eaf3ab..8f444b1ff338 100644 --- a/gnu/packages/bootstrap.scm +++ b/gnu/packages/bootstrap.scm @@ -309,9 +309,7 @@ (define rewritten-input package-with-bootstrap-guile))))) (define* (glibc-dynamic-linker - #:optional (system (or (and=> (%current-target-system) - gnu-triplet->nix-system) - (%current-system)))) + #:optional (system (current-target-nix-system))) "Return the name of Glibc's dynamic linker for SYSTEM." ;; See the 'SYSDEP_KNOWN_INTERPRETER_NAMES' cpp macro in libc. (cond ((string=? system "x86_64-linux") "/lib/ld-linux-x86-64.so.2") diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm index eb949bed1b47..e2bc5398715a 100644 --- a/gnu/packages/llvm.scm +++ b/gnu/packages/llvm.scm @@ -77,9 +77,7 @@ (define-module (gnu packages llvm) system->llvm-target)) (define* (system->llvm-target #:optional - (system (or (and=> (%current-target-system) - gnu-triplet->nix-system) - (%current-system)))) + (system (current-target-nix-system))) "Return the LLVM target name that corresponds to SYSTEM, a system type such as \"x86_64-linux\"." ;; See the 'lib/Target' directory of LLVM for a list of supported targets. diff --git a/guix/utils.scm b/guix/utils.scm index 44c46cb4a96c..d5e15581acea 100644 --- a/guix/utils.scm +++ b/guix/utils.scm @@ -85,6 +85,7 @@ (define-module (guix utils) gnu-triplet->nix-system %current-system %current-target-system + current-target-nix-system package-name->name+version target-linux? target-hurd? @@ -635,6 +636,12 @@ (define %current-target-system ;; cross-building to. (make-parameter #f)) +(define (current-target-nix-system) + "Return the Nix system identifier for the current target, whether we are +cross-building or not." + (or (and=> (%current-target-system) gnu-triplet->nix-system) + (%current-system))) + (define* (package-name->name+version spec #:optional (delimiter #\@)) "Given SPEC, a package name like \"foo@0.9.1b\", return two values: \"foo\"