From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 8JlIABdy92B/AQEAgWs5BA (envelope-from ) for ; Wed, 21 Jul 2021 03:02:15 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id oHyDNxZy92D8DAAA1q6Kng (envelope-from ) for ; Wed, 21 Jul 2021 01:02:14 +0000 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 4691817D19 for ; Wed, 21 Jul 2021 03:02:14 +0200 (CEST) Received: from localhost ([::1]:38644 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m60cn-0007Ri-5X for larch@yhetil.org; Tue, 20 Jul 2021 21:02:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57404) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m60cd-0007Q0-0E for guix-patches@gnu.org; Tue, 20 Jul 2021 21:02:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:52465) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m60cc-0007hg-OO for guix-patches@gnu.org; Tue, 20 Jul 2021 21:02:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1m60cc-000093-Mo for guix-patches@gnu.org; Tue, 20 Jul 2021 21:02:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49672] [PATCH 2/9] utils: Add =?UTF-8?Q?=E2=80=98current-target-nix-system=E2=80=99?= helper Resent-From: Thiago Jung Bauermann Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 21 Jul 2021 01:02: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: Thiago Jung Bauermann Received: via spool by 49672-submit@debbugs.gnu.org id=B49672.1626829289424 (code B ref 49672); Wed, 21 Jul 2021 01:02:02 +0000 Received: (at 49672) by debbugs.gnu.org; 21 Jul 2021 01:01:29 +0000 Received: from localhost ([127.0.0.1]:35751 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m60c5-00006l-DX for submit@debbugs.gnu.org; Tue, 20 Jul 2021 21:01:29 -0400 Received: from mx.kolabnow.com ([95.128.36.40]:59496) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m60c1-00006B-B4 for 49672@debbugs.gnu.org; Tue, 20 Jul 2021 21:01:25 -0400 Received: from localhost (unknown [127.0.0.1]) by ext-mx-out003.mykolab.com (Postfix) with ESMTP id A2FD0405B8 for <49672@debbugs.gnu.org>; Wed, 21 Jul 2021 03:01:19 +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= 1626829279; x=1628643680; bh=GFRSO9hwK9Ix1U2vSpPPEERhAc0ECXwS5jo cGimT+Cw=; b=ohrHIfcTTh8PR6D4QkR/uSL0vv1SHBXl0DM0uWrQlirdSS5oqNr 4Jp2ACvLqfujSuifP5mOrH7k/02T4UcxRRPF/7gfyBv+lAxAk2WsJPNd0VkeenEY eN4OhkbTocXFhjNZ+Hg2pzQzHjAQCBEPttrF6h56kMGAEtP+D6IOMyXEcaSq9ihf wSienpbBxnUQpXJjYmAg0AwkqlCm1I3pEUgpa7g5AjVdCuKCA2/0cMDBaE6BOtEG HIpdbd0Yamx4zROa+W/Y5SIEqq2aCdiQ+IhNnVxeBgdfSOs9hb1Y3VBxyqdPJ3PO mMQVedduyGWb1g6P4+hDMuASWyDPST2SAf6gVRhCEukpUGhSYcNW5nrJn4J7OsOP p1hFV6LamlQv7PzVc8OziATGcIEhIPXYOvdBa+yiD4aiTS8EDBMT3UO+jzDSYxaX GGKpZjA1dIsMhfoALFn3/08jY0vrtmvuFskcckgHe9VkjRYEpVXdtvYcEyQq4Uke YqWN1+PWHIRHf1WXfsLF6BQJAeAO9BhiKuLKandnHK27rvVfLV+R35a68O+vilVp uxhHOKujOC6Aci8yivDQS2U+gDqaqSfhlWpgRQLYIXlKtlDGtGpkfcVwmqFGxPB0 ifEcSNIZa0r+VN8cXqmxKoDyV+aowxnlS9gserZb6uow5Ny+6ig8+95w= X-Virus-Scanned: amavisd-new at mykolab.com Received: from mx.kolabnow.com ([127.0.0.1]) by localhost (ext-mx-out003.mykolab.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id st6Qh1x9Aou1 for <49672@debbugs.gnu.org>; Wed, 21 Jul 2021 03:01:19 +0200 (CEST) Received: from int-mx001.mykolab.com (unknown [10.9.13.1]) by ext-mx-out003.mykolab.com (Postfix) with ESMTPS id 06063403CB for <49672@debbugs.gnu.org>; Wed, 21 Jul 2021 03:01:17 +0200 (CEST) Received: from ext-subm003.mykolab.com (unknown [10.9.6.3]) by int-mx001.mykolab.com (Postfix) with ESMTPS id 12B0F323; Wed, 21 Jul 2021 03:01:16 +0200 (CEST) Date: Tue, 20 Jul 2021 22:00:36 -0300 Message-Id: <20210721010043.632012-2-bauermann@kolabnow.com> In-Reply-To: <20210721010043.632012-1-bauermann@kolabnow.com> References: <20210721010043.632012-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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1626829334; 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=GFRSO9hwK9Ix1U2vSpPPEERhAc0ECXwS5jocGimT+Cw=; b=Hkt2XR89GUPkE7tOB4E5l388RP4j11aFtNawHVgZLevEwtZDpgYuHRPZ2zt8aOPJI5i4TT j9bIjHaVxuvuM7gam1X5ioVvgk2BaO9fBYHwx/FDjpmwSJNIv0hv37iDFhx/zZ90Ivob0Y wrRkgsifSdfgQQf9jvq2jQyEuudqcCf6MQxrNzEM5b1MfrMm6miiM23kfPeRHjCbmlnpNC i2EBZl8TgB+SigQID99KthWTlr/WkX7VPUT432BQ9D8mo2ddAXZ4NwRVpPo2IveDryNCg7 owWooMcjVjY9Ix1VbjcCnSh0sYiYOPqthfUJ/N91UyCyui162uE8fR7NnVtHWw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1626829334; a=rsa-sha256; cv=none; b=hNs18ybbRS6gNMBuOYnB9QU6gj5sanN422mDZerZX+btqvPG+MUaZVb/r4DJvKJpcFqcCS oAnrR4Gmbd+Lnaab9qHCndSD2jUg794h49zO4769CccBX1Rp27YMW+16lUB/SN7xG6vDjA t4Y4s4YL4gOEDmZ7SpGtVfKPUMjnhhBCFGk4FK65qxvbn/XkRiADa9lva43x82jHyTmwNu Dm/s0o3jS91DJ+xrh8lbHYS+wMkaDKf85PxfGH+SafF6QeBzIM1tUHccOtLRRb1tW4WRgk x9HIIoGtcXrnbFW8WU8zZeVCjGxz46Aii9GiOCx180oh+GZBp7XI/m1dy3jiAg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=kolabnow.com header.s=dkim20160331 header.b=ohrHIfcT; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: -2.92 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=kolabnow.com header.s=dkim20160331 header.b=ohrHIfcT; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 4691817D19 X-Spam-Score: -2.92 X-Migadu-Scanner: scn0.migadu.com X-TUID: d3o6wE3DKSSw Many places check a Nix system identifier string against ‘%current-target-system’ and ‘%current-target’. This is problematic because these parameters hold different kinds of identifiers. The former holds a GNU triplet (or #f if not cross-compiling), while the latter holds a Nix system identifier. As a first step to solve the confusion, introduce the ‘current-target-nix-system’ procedure which looks at both parameters and always returns a Nix system identifier. The code is factored out from ‘glibc-dynamic-linker’ and ‘system->llvm-target’. * 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 new procedure. --- gnu/packages/bootstrap.scm | 6 ++---- gnu/packages/llvm.scm | 4 +--- guix/utils.scm | 7 +++++++ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/gnu/packages/bootstrap.scm b/gnu/packages/bootstrap.scm index c598cedc0ae2..b7134653cfc4 100644 --- a/gnu/packages/bootstrap.scm +++ b/gnu/packages/bootstrap.scm @@ -35,7 +35,7 @@ #:select (run-with-store add-to-store add-text-to-store)) #:use-module ((guix derivations) #:select (derivation derivation-input derivation->output-path)) - #:use-module ((guix utils) #:select (gnu-triplet->nix-system)) + #:use-module (guix utils) #:use-module ((guix gexp) #:select (lower-object)) #:use-module (guix memoization) #:use-module (guix i18n) @@ -286,9 +286,7 @@ or false to signal an error." 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 575c63c713e9..3c4e5930d044 100644 --- a/gnu/packages/llvm.scm +++ b/gnu/packages/llvm.scm @@ -66,9 +66,7 @@ #:export (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 2c56c8b2e08b..4072dea89051 100644 --- a/guix/utils.scm +++ b/guix/utils.scm @@ -77,6 +77,7 @@ gnu-triplet->nix-system %current-system %current-target-system + current-target-nix-system package-name->name+version target-mingw? target-arm32? @@ -520,6 +521,12 @@ returned by `config.guess'." ;; 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\"