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 qEAeMLXa6mBcTwAAgWs5BA (envelope-from ) for ; Sun, 11 Jul 2021 13:49:09 +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 yHn7K7Xa6mD6FwAA1q6Kng (envelope-from ) for ; Sun, 11 Jul 2021 11:49:09 +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 719D42A136 for ; Sun, 11 Jul 2021 13:49:09 +0200 (CEST) Received: from localhost ([::1]:49260 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m2XxM-000420-B7 for larch@yhetil.org; Sun, 11 Jul 2021 07:49:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57510) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m2XxH-00041S-70 for guix-patches@gnu.org; Sun, 11 Jul 2021 07:49:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:50770) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m2XxG-0008HD-Vq for guix-patches@gnu.org; Sun, 11 Jul 2021 07:49:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1m2XxG-00073h-Vl for guix-patches@gnu.org; Sun, 11 Jul 2021 07:49:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49025] [PATCH v5 01/20] utils: Define target-linux? predicate. Resent-From: Maxime Devos Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 11 Jul 2021 11:49:02 +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 Cc: Maxime Devos Received: via spool by 49025-submit@debbugs.gnu.org id=B49025.162600409126935 (code B ref 49025); Sun, 11 Jul 2021 11:49:02 +0000 Received: (at 49025) by debbugs.gnu.org; 11 Jul 2021 11:48:11 +0000 Received: from localhost ([127.0.0.1]:34028 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m2XwK-0006zN-RP for submit@debbugs.gnu.org; Sun, 11 Jul 2021 07:48:11 -0400 Received: from xavier.telenet-ops.be ([195.130.132.52]:38290) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m2XwG-0006xg-Q4 for 49025@debbugs.gnu.org; Sun, 11 Jul 2021 07:48:02 -0400 Received: from localhost.localdomain ([213.119.242.127]) by xavier.telenet-ops.be with bizsmtp id Tnno2500V2ldwth01no0qv; Sun, 11 Jul 2021 13:48:00 +0200 From: Maxime Devos Date: Sun, 11 Jul 2021 13:47:04 +0200 Message-Id: <20210711114723.27568-2-maximedevos@telenet.be> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210711114723.27568-1-maximedevos@telenet.be> References: <419215938396207999184dafa43afaed6d7a0715.camel@telenet.be> <20210711114723.27568-1-maximedevos@telenet.be> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r21; t=1626004080; bh=KuxsCFQnj4ZbArXRFEqUpWBp+xjAPFA4gW0yO+6p0Uk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Jj7lYcNn1kDwmugZC6ybH1uLrzaQ5JNVDst8WsVEFIXv3aBZO/lCGpeE/2Bjq1TY/ WS5JnRyJkDiYl+MCg1Vs5myGcSzmL2t0OLm8mp0OsSBjJpL82NkVraVdD25pwYJCto d4WK9Jz338H2S8bkUqHM2cMEQJwHoXelmbk/4YlbIApYrEljBJGDq/iEAqNSkm939y yATiNp/+BplA4DUt/yWTyFJqCODBra2nSLgRZD9BEmkJikQUOSmO3JKOrQF1lcG4Rm nrJGYVihweC+J+SwkAqV15hPa9kWMptWnv232ev0xUFzFWyx5/2kN6eU302WEZ6M2B NiyAbQgMQELow== 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=1626004149; h=from:from:sender:sender: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=KuxsCFQnj4ZbArXRFEqUpWBp+xjAPFA4gW0yO+6p0Uk=; b=nCYKZtY7JpMEYh7DM+izxkJn6bEKxP+PNnDycy32TXHlNdDqz+ZGcRcmXjXlrmZy4VOTvs X4hGZ4HEuX2w0oV3EGHWvDbzzEVQsViTlOaxUACsPrdRQLpaPkfglG5V6CYRtJfVcZ9B62 pC+3VlwNiBeNSk+M6bglxLjDu5SUPnje8BxSIxbDE96pTYwax6wp6aEz8RuhY/+v20wXE+ gwP21+qFCGxg6Wgg8CbQdEnrhWvzpIChXEcxX7QWztDFInyhAU9TEpIOTCv1wIzKRZ9ElR iZE79296r7rnYup6nmw4sl5xLuDjeJ4adKYy5Rba8m07t0Lly9AffI6zbAWQrA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1626004149; a=rsa-sha256; cv=none; b=CFeIVxzfHUJsbqlne5HhRI7SUspEyK9vRaBa0PBkaWQ7I5c7IEtRLbSf7f7R2oagDkAUt9 orbur3SiooniqnxhnpZYyPuZGTum+LlkXdsuL02iPyvV3cC+hlWPxnrwQtqKNv/csvpsHl HtgVLJz7VUIW3obeLzDfq0UtcNa6XpPLrFOt7R1xBQfeAXI55H9Rq6Q3LHjyqicgFMaXeD 1Nr+YGsaZtx5LKOKRs7p7aM0IEh6t/OJWl0YrJixss2h7Kvu5PeU0ORfMP9rBtHwjcakxm pRJh9jsJ/qNPa5a6Y9lfTL55X5XmLJ3eYsEnQEZNqcbaQrkkbtxeJJZXxw34xQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=telenet.be header.s=r21 header.b=Jj7lYcNn; 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: -0.31 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=telenet.be header.s=r21 header.b=Jj7lYcNn; 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: 719D42A136 X-Spam-Score: -0.31 X-Migadu-Scanner: scn0.migadu.com X-TUID: ylVtnplurkN5 * guix/utils.scm (target-linux?): New predicate. * tests/utils.scm ("target-linux?"): Test it. ("target-mingw?"): Also test ‘target-mingw?’. --- guix/utils.scm | 6 ++++++ tests/utils.scm | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/guix/utils.scm b/guix/utils.scm index 19990ceb8a..4ff2602e23 100644 --- a/guix/utils.scm +++ b/guix/utils.scm @@ -11,6 +11,7 @@ ;;; Copyright © 2020 Maxim Cournoyer ;;; Copyright © 2021 Simon Tournier ;;; Copyright © 2021 Chris Marusich +;;; Copyright © 2021 Maxime Devos ;;; ;;; This file is part of GNU Guix. ;;; @@ -81,6 +82,7 @@ %current-system %current-target-system package-name->name+version + target-linux? target-mingw? target-arm32? target-aarch64? @@ -543,6 +545,10 @@ a character other than '@'." (idx (values (substring spec 0 idx) (substring spec (1+ idx)))))) +(define* (target-linux? #:optional (target (or (%current-target-system) + (%current-system)))) + (string-contains target "linux")) + (define* (target-mingw? #:optional (target (%current-target-system))) (and target (string-suffix? "-mingw32" target))) diff --git a/tests/utils.scm b/tests/utils.scm index 7fcbb25552..80a0e669a4 100644 --- a/tests/utils.scm +++ b/tests/utils.scm @@ -3,6 +3,7 @@ ;;; Copyright © 2014 Eric Bavier ;;; Copyright © 2016 Mathieu Lirzin ;;; Copyright © 2021 Simon Tournier +;;; Copyright © 2021 Maxime Devos ;;; ;;; This file is part of GNU Guix. ;;; @@ -289,6 +290,22 @@ skip these tests." (string-closest "hello" '("kikoo" "helo" "hihihi" "halo")) (string-closest "hello" '("aaaaa" "12345" "hellohello" "h")))) +(test-equal "target-linux?" + '(#t #f #f #t) + (map (compose ->bool target-linux?) + '("i686-linux-gnu" "i686-w64-mingw32" + ;; Checking that "gnu" is present is not sufficient, + ;; as GNU/Hurd exists. + "i686-pc-gnu" + ;; Some targets have a suffix. + "arm-linux-gnueabihf"))) + +(test-equal "target-mingw?" + '(#f #f #t) + (map (compose ->bool target-mingw?) + '("i686-linux-gnu" "i686-pc-gnu" + "i686-w64-mingw32"))) + (test-end) (false-if-exception (delete-file temp-file)) -- 2.32.0