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 qClWD9TVzGDrYgAAgWs5BA (envelope-from ) for ; Fri, 18 Jun 2021 19:20:20 +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 8N0jC9TVzGA8SwAA1q6Kng (envelope-from ) for ; Fri, 18 Jun 2021 17:20:20 +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 B97BE136A1 for ; Fri, 18 Jun 2021 19:20:18 +0200 (CEST) Received: from localhost ([::1]:49264 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1luIAD-0007bF-8K for larch@yhetil.org; Fri, 18 Jun 2021 13:20:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37686) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1luI9z-0007ab-2O for guix-patches@gnu.org; Fri, 18 Jun 2021 13:20:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:46540) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1luI9y-00046Z-Pm for guix-patches@gnu.org; Fri, 18 Jun 2021 13:20:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1luI9y-0004rK-Fl for guix-patches@gnu.org; Fri, 18 Jun 2021 13:20:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49025] [PATCH v3 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 17:20: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.162403675118238 (code B ref 49025); Fri, 18 Jun 2021 17:20:02 +0000 Received: (at 49025) by debbugs.gnu.org; 18 Jun 2021 17:19:11 +0000 Received: from localhost ([127.0.0.1]:57960 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1luI98-0004jc-1b for submit@debbugs.gnu.org; Fri, 18 Jun 2021 13:19:11 -0400 Received: from andre.telenet-ops.be ([195.130.132.53]:34810) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1luI95-0004j3-VO for 49025@debbugs.gnu.org; Fri, 18 Jun 2021 13:19:08 -0400 Received: from localhost.localdomain ([213.119.219.214]) by andre.telenet-ops.be with bizsmtp id JhK5250094e8Tal01hK5aw; Fri, 18 Jun 2021 19:19:06 +0200 From: Maxime Devos Date: Fri, 18 Jun 2021 19:15:55 +0200 Message-Id: <20210618171631.20534-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=1624036746; bh=KuxsCFQnj4ZbArXRFEqUpWBp+xjAPFA4gW0yO+6p0Uk=; h=From:To:Cc:Subject:Date:Reply-To; b=GpbAaqGH+Fclbxs44EqQTHm5Ld8i3n1jKg30EtUOHLQ/dEX4x8UK048m33vMliLux spyom+WxIIsG+7oiGI6LAmL7Na/U5nYXaYp1yv4psUm6k+Z8sM/twkSjM6LTQru96U 7UIcz8nVF5Tuat72xkmC1zSFGxyazKGOR/c4D3Og77RDZRpAiM5PQFo7PZr5vIOIyp UFwDceg+6KhB1BC4uWYLjA/6UBCwLhiUCDoGvtwOppi4b7c6nLRqsx6U1N6R67fquj UwfxCHO7JPaUeOcaf+c2EvJBW80xIO0MGNyPx1BbzCug4hgDVZlIdwNU8gl/Moubs0 glBrmAcHn3VPw== 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=1624036818; 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=GIldkFOdxoSg+GXGN/43MiNXrGLQ7B25xg0qCdU9aBw4XXz2AboH0siiX/HUoCgmvSn1Ws PxSgwe3iSiG/9Ue5JOaBqLfowFP3Wg3X9CNv23MDdm4VXqYB4DtPy5NfY/irLsOjvQJMVJ Py5AbbE5Dyp2wbJXukK3tBPm2xctS+UwvFb+AzZKzKxnchlucpz+4UqKJP4plMwvlYnNm7 1+vzgbk2uMvcaQCw07Dw1nCtraNedj17od6cG2PjmxSWiteVgmDgvgVl+Xrg8y3j33Ir7q 8jLrWGYSNQJXmDgG7WX3DXZl5wUig55BFwOqVZzC0+MwUnzN9J7X1r5pr+08DA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1624036818; a=rsa-sha256; cv=none; b=HpG4E+GvHHO1VIEc53Ib3q2QXqx1KRXegPsaqfEjLDn4gvN3K7vOHt3IIf3uQeiWL04oyZ aZ61VUA1oqmjSQUz/xrIRMB+JYrId8fGHQsjBlY9soiKwIb9sQhluanDhvQfInexFQXw3C faqTttk7vZ/ummoaaGCejzEz804Nf6PyMtVy3nSFPDozgcPdwwhYJ4v75+y6H2XlqPfmHp wr/VgzKWmClBsT4Pden2AYyabGOYm1VMZs5NDXJhJ7ASCPzrd9ZHMV7QhaPKpI3y/I7qi3 VjBj78Sa3pZMHER4ROXzjSRV9n71dXHxnj0N4JzxmUq1vqBWrwi4uvC62XK0JA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=telenet.be header.s=r21 header.b=GpbAaqGH; 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=GpbAaqGH; 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: B97BE136A1 X-Spam-Score: 1.17 X-Migadu-Scanner: scn1.migadu.com X-TUID: X3qQHa8la5ks * 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