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 kKb9FuLGzGB2RQAAgWs5BA (envelope-from ) for ; Fri, 18 Jun 2021 18:16:34 +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 aBvTEuLGzGDgXgAAB5/wlQ (envelope-from ) for ; Fri, 18 Jun 2021 16:16:34 +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 CEBE810E79 for ; Fri, 18 Jun 2021 18:16:33 +0200 (CEST) Received: from localhost ([::1]:54028 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1luHAW-0003QC-S8 for larch@yhetil.org; Fri, 18 Jun 2021 12:16:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51130) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1luH4F-0007K5-1L for guix-patches@gnu.org; Fri, 18 Jun 2021 12:10:06 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:46137) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1luH4E-0001Pt-MK for guix-patches@gnu.org; Fri, 18 Jun 2021 12:10:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1luH4E-0002oe-93 for guix-patches@gnu.org; Fri, 18 Jun 2021 12:10:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49025] [[PATCH v2 core-updates] 01/37] utils: Define target-linux? predicate. References: <419215938396207999184dafa43afaed6d7a0715.camel@telenet.be> In-Reply-To: <419215938396207999184dafa43afaed6d7a0715.camel@telenet.be> Resent-From: Maxime Devos Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 18 Jun 2021 16:10: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: othacehe@gnu.org, Maxime Devos Received: via spool by 49025-submit@debbugs.gnu.org id=B49025.162403259710806 (code B ref 49025); Fri, 18 Jun 2021 16:10:02 +0000 Received: (at 49025) by debbugs.gnu.org; 18 Jun 2021 16:09:57 +0000 Received: from localhost ([127.0.0.1]:57683 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1luH49-0002oE-AG for submit@debbugs.gnu.org; Fri, 18 Jun 2021 12:09:57 -0400 Received: from baptiste.telenet-ops.be ([195.130.132.51]:49146) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1luH47-0002o5-LN for 49025@debbugs.gnu.org; Fri, 18 Jun 2021 12:09:56 -0400 Received: from localhost.localdomain ([188.188.242.184]) by baptiste.telenet-ops.be with bizsmtp id Jg9t250053zRM2s01g9tHv; Fri, 18 Jun 2021 18:09:54 +0200 From: Maxime Devos Date: Fri, 18 Jun 2021 18:09:00 +0200 Message-Id: <20210618160936.18972-1-maximedevos@telenet.be> X-Mailer: git-send-email 2.32.0 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=1624032594; bh=KuxsCFQnj4ZbArXRFEqUpWBp+xjAPFA4gW0yO+6p0Uk=; h=From:To:Cc:Subject:Date:Reply-To; b=T01CmRzB5t3B0a+VAFnBuoxxuIRNNzvKJcJP80w2c1U4P7LyYDJ7IaV36t7jh6Q8w DW5KIAn+xLC6mSdtw1up+JQWMmn9rDWhfzM35heNxF+Iop2SpV2dVoztyBO+bOO600 qJFBOke9/ZRE/WP7EDx/KEJKrj46kg6B0BEjfuokftfXsqpFb2uCfwlbi3y6y4MCRH ixmTV7/HgBvJniIOSdxIiMeEVkyOgop8TN7d/ry8X12VTXGzyuPXLsodnVWQD8U6zI x4vCnLYSsP7hYiUDUEH2iH4SUYucRWZAcjRjhFEeU3p+4+9zo36bPT/UsJRqAko2Qd AeK9o4H9NEPzg== 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: , Reply-To: 49025@debbugs.gnu.org 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=1624032993; 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=KuxsCFQnj4ZbArXRFEqUpWBp+xjAPFA4gW0yO+6p0Uk=; b=GPsmgJpJ/fpVTbxOecxaZaE8sJsfVIe9pX/l0KgCofZdD6olBTlhP31R4vVrc1PGUt/wLN DtAIjpH3zaoWEQckT09d5qqOT521OFnlmnkq8wAQzdekSgVLwdfemrCVBrcY34icoS9EuL xsgusnLR5LEr8ZtBsQq7wLe1j0fPFq4Vdrki0Fmdfh8NO5gwWRe5Oj1yfCvW8H+owX3TNK UgfUs0EU2yss8W38UKNFGDE3wdGpsD6vL7qFhUNirVarG1zIlKMWOG5ClwShoFpq4C3H6J iSZUipPtSdEV9tONKocTlM4tqtR9qf8OeI/dOGKwOZ+KmwkzbZ62x+CHeupDsQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1624032993; a=rsa-sha256; cv=none; b=iptKy1aPA1veXrwVWDTJgZMwz7vQg/vtCAL/fhvCJwVqVZxOPG5p1my7sXUz4efO8r2Voh qoNDTaVelwKyGtvBhoRodvBYXj4R7d0EKr9MyR9+/SMG+dB/upktR4xpwDAkO48VVs1D++ My+PiCa6Go0lkImSqjylj0x19rGjDEXtEfa+55Z4w7/6DCZEq0butvdOHvVL6T8jWbFiuJ zjOQZUF81ZW4XNE5IpRaNCcf0MUS05TOlJlSMcFmAsvcoLo30ZZYBcfs3JWU81XnuvJVvD SaRPyZ1yETQBQWD3j4WIQWqx7KyA0guvTOxKWuwY7Q3cP7kjtSig7s/ItfQC0A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=telenet.be header.s=r21 header.b=T01CmRzB; 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.17 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=telenet.be header.s=r21 header.b=T01CmRzB; 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: CEBE810E79 X-Spam-Score: 1.17 X-Migadu-Scanner: scn1.migadu.com X-TUID: o5BHiq/bbUJK * 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