From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id sL3mCph9x2AmbQAAgWs5BA (envelope-from ) for ; Mon, 14 Jun 2021 18:02:32 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id wOqABph9x2CGNQAAB5/wlQ (envelope-from ) for ; Mon, 14 Jun 2021 16:02:32 +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 C14B126515 for ; Mon, 14 Jun 2021 18:02:31 +0200 (CEST) Received: from localhost ([::1]:41874 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lsp2k-0003HS-QO for larch@yhetil.org; Mon, 14 Jun 2021 12:02:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54794) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lsoh3-0006rF-31 for guix-patches@gnu.org; Mon, 14 Jun 2021 11:40:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:36111) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lsoh2-0008MY-KR for guix-patches@gnu.org; Mon, 14 Jun 2021 11:40:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lsoh2-0004Mz-I0 for guix-patches@gnu.org; Mon, 14 Jun 2021 11:40:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49025] [PATCH core-updates 02/37] utils: Define a target-x86-32? and target-x86-64? predicate. Resent-From: Maxime Devos Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 14 Jun 2021 15:40:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49025 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 49025@debbugs.gnu.org Received: via spool by 49025-submit@debbugs.gnu.org id=B49025.162368518516735 (code B ref 49025); Mon, 14 Jun 2021 15:40:04 +0000 Received: (at 49025) by debbugs.gnu.org; 14 Jun 2021 15:39:45 +0000 Received: from localhost ([127.0.0.1]:47652 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lsogj-0004Lr-EN for submit@debbugs.gnu.org; Mon, 14 Jun 2021 11:39:45 -0400 Received: from laurent.telenet-ops.be ([195.130.137.89]:49724) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lsogZ-0004Kz-HE for 49025@debbugs.gnu.org; Mon, 14 Jun 2021 11:39:44 -0400 Received: from butterfly.local ([IPv6:2a02:1811:8c09:9d00:aaf1:9810:a0b8:a55d]) by laurent.telenet-ops.be with bizsmtp id H3fa2500E0mfAB4013fbl3; Mon, 14 Jun 2021 17:39:35 +0200 Message-ID: <0e7d032a02bca4bc6d3b3b1a3936f039f7f56da5.camel@telenet.be> From: Maxime Devos Date: Mon, 14 Jun 2021 17:39:34 +0200 In-Reply-To: References: Content-Type: multipart/mixed; boundary="=-ctfliosNXztPLJPfVToo" User-Agent: Evolution 3.34.2 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r21; t=1623685175; bh=n2Dy1NxqjV2Du24S0QoUHh5TG8tI/tG4wLxZmJOGW9M=; h=Subject:From:To:Date:In-Reply-To:References; b=TVE15dkFGDanURXkTumxinmgWzMlKDNCj4Xd/ddNxOtB6Ojpl694YZ1YLgrvz0o0J Lu8x+BdqNzo/t3UezkT0VpDpKy04sYrMd54RJdS2pKjfsfHQcCmlin/zFE5Z/jwXcq Ls0qPN/RoJmy4JSMbawT0uWEIX/JnfRHsttp9xBC8bcDpL7Pw9Wmkhbb59SODBCha3 0ypW3YvMHmOXaUPSid3TeVRH+QgOKs1py4woONOqo56telV761oTUB/cOKDRfG8HF0 XjOcwmvuXnb2XXLtq+W9Hjgc4NxD89nQovS1jnjQmuZO+iiVwsyX561Wue/DSIf6HW 4uWfl0WyaliLA== 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" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1623686551; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: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=n2Dy1NxqjV2Du24S0QoUHh5TG8tI/tG4wLxZmJOGW9M=; b=D60TJgbxTGfU04tWLWEKsZg/E21uV9hOPDdYPmatwxUoE39qA12bZPXIUx2MFBeK+BNAE+ oZJfLf7Vs8LRV9gS4e94pgTiTHMMrbDyG9EcEWe5njrqliE1cQI5wvcvUeyzyk0Qw+tmNd 8O2C7wQxwrPswRn1BGN1FuV8H62K/xFWHWQJVG948t2XibXQqoC4xjbmxqAjmkYJ5e54ii KZ+ZILv1F7k9F0HIb2ld0DpnwzQfUiI4QSoIBdxjDOvh2xtmt05FlkOjfmETs+N6drGHmW s8v/wxzKCjpchqEtk3Tap6+Mefixs3cQv8lbuh5hzMjmDWRKiXHPfAj3WUUUbw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1623686551; a=rsa-sha256; cv=none; b=hypSW+pqtX64qcXop5owkQSSasXXAx8DRcFj9xkND189G0c2s2XX6KF8j/iQcIZgQVBcsO SZfR4AbOd017TkLak6aHvPcN4XztY/2vklLt668GTnijYpGcQ6lhECHjnKwz8qoWoTzcFH rINU8tCVOY6qkj5XiE/VmmUE1xcPKsXkuo9FILVy2pt+OCEk9LbhqeQGX96ZCaRpduSYO4 isH9csIz0ru2Hdj8PxmhKEoVFe8yBqEFIPn6aKO8pomwT8j+8sw6ERYC7ezFoUIN96zWoU JrX+50x0UuVQ74VMEAayRxP8iu46unkH89ugyODo/NANlUFXLH5X1DUi7g1XWw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=telenet.be header.s=r21 header.b=TVE15dkF; dmarc=fail reason="SPF not aligned (relaxed)" header.from=telenet.be (policy=none); 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: -1.33 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=telenet.be header.s=r21 header.b=TVE15dkF; dmarc=fail reason="SPF not aligned (relaxed)" header.from=telenet.be (policy=none); 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: C14B126515 X-Spam-Score: -1.33 X-Migadu-Scanner: scn1.migadu.com X-TUID: XqnTLH7dB/UV --=-ctfliosNXztPLJPfVToo Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit * guix/utils.scm (target-x86-32?, target-x86-64?): New predicates. * tests/utils.scm ("target-x86-32?", "target-x86-64?"): New tests. --- guix/utils.scm | 20 ++++++++++++++++++++ tests/utils.scm | 23 +++++++++++++++++++++++ 2 files changed, 43 insertions(+) --=-ctfliosNXztPLJPfVToo Content-Disposition: attachment; filename="0002-utils-Define-a-target-x86-32-and-target-x86-64-predi.patch" Content-Transfer-Encoding: 7bit Content-Type: text/x-patch; name="0002-utils-Define-a-target-x86-32-and-target-x86-64-predi.patch"; charset="us-ascii" diff --git a/guix/utils.scm b/guix/utils.scm index 4ff2602e23..2256ea2ca6 100644 --- a/guix/utils.scm +++ b/guix/utils.scm @@ -84,6 +84,8 @@ package-name->name+version target-linux? target-mingw? + target-x86-32? + target-x86-64? target-arm32? target-aarch64? target-arm? @@ -553,6 +555,24 @@ a character other than '@'." (and target (string-suffix? "-mingw32" target))) +(define* (target-x86-32? #:optional (target (or (%current-target-system) + (%current-system)))) + "Is the architecture of TARGET a variant of Intel's 32-bit architecture +(IA32)?" + ;; Intel also has a 16-bit architecture in the iN86 series, i286 + ;; (see, e.g. https://en.wikipedia.org/wiki/Intel/808286) so this + ;; procedure is not named target-x86?. + (or (string-prefix? "i386-" target) + (string-prefix? "i486-" target) + (string-prefix? "i586-" target) + (string-prefix? "i686-" target))) + +(define* (target-x86-64? #:optional (target (or (%current-target-system) + (%current-system)))) + "Is the architecture of TARGET a variant of Intel/AMD's 64-bit +architecture (x86_64)?" + (string-prefix? "x86_64-" target)) + (define* (target-arm32? #:optional (target (or (%current-target-system) (%current-system)))) (string-prefix? "arm" target)) diff --git a/tests/utils.scm b/tests/utils.scm index 80a0e669a4..92439b5587 100644 --- a/tests/utils.scm +++ b/tests/utils.scm @@ -306,6 +306,29 @@ skip these tests." '("i686-linux-gnu" "i686-pc-gnu" "i686-w64-mingw32"))) +(test-equal "target-x86-32?" + '(#f #f #f #t #t #t #t #f) + ;; These are (according to Wikipedia) two RISC architectures + ;; by Intel and presumably not compatible with the x86-32 series. + (map target-x86-32? + '("i860-gnu" "i960-gnu" + ;; This is a 16-bit architecture + "i286-gnu" + ;; These are part of the x86-32 series. + "i386-gnu" "i486-gnu" "i586-gnu" "i686-gnu" + ;; Maybe this one will exist some day, but not yet. + "i786-gnu"))) + +(test-equal "target-x86-64?" + '(#t #f #f #f) + (map target-x86-64? + `("x86_64-linux-gnu" "i386-linux-gnu" + ;; Just because it includes "64" doesn't make it 64-bit. + "aarch64-linux-gnu" + ;; Note that (expt 2 109) in decimal notation starts with 64. + ;; However, it isn't 32-bit. + ,(format #f "x86_~a-linux-gnu" (expt 2 109))))) + (test-end) (false-if-exception (delete-file temp-file)) --=-ctfliosNXztPLJPfVToo--