From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id uLk8BgnH7mCsAAAAgWs5BA (envelope-from ) for ; Wed, 14 Jul 2021 13:14:17 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id MJ4CAgnH7mD0DQAA1q6Kng (envelope-from ) for ; Wed, 14 Jul 2021 11:14:17 +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 72A1B1968F for ; Wed, 14 Jul 2021 13:14:16 +0200 (CEST) Received: from localhost ([::1]:45544 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m3cqF-0000xL-6d for larch@yhetil.org; Wed, 14 Jul 2021 07:14:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57210) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m3cq3-0000tx-F3 for guix-patches@gnu.org; Wed, 14 Jul 2021 07:14:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:59872) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m3cq2-0000vl-DL for guix-patches@gnu.org; Wed, 14 Jul 2021 07:14:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1m3cq2-0001P7-6g for guix-patches@gnu.org; Wed, 14 Jul 2021 07:14:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49025] [PATCH v6 01/22] utils: Define 'target-linux?' predicate. Resent-From: Maxime Devos Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 14 Jul 2021 11:14: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: Mathieu Othacehe , Maxime Devos Received: via spool by 49025-submit@debbugs.gnu.org id=B49025.16262612025107 (code B ref 49025); Wed, 14 Jul 2021 11:14:02 +0000 Received: (at 49025) by debbugs.gnu.org; 14 Jul 2021 11:13:22 +0000 Received: from localhost ([127.0.0.1]:43107 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m3cpN-0001K6-Mc for submit@debbugs.gnu.org; Wed, 14 Jul 2021 07:13:22 -0400 Received: from andre.telenet-ops.be ([195.130.132.53]:39796) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m3cpL-0001Jd-JX for 49025@debbugs.gnu.org; Wed, 14 Jul 2021 07:13:20 -0400 Received: from localhost.localdomain ([188.188.219.228]) by andre.telenet-ops.be with bizsmtp id UzDG2500W4wFxCU01zDJEh; Wed, 14 Jul 2021 13:13:18 +0200 From: Maxime Devos Date: Wed, 14 Jul 2021 13:12:46 +0200 Message-Id: <20210714111307.19324-2-maximedevos@telenet.be> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210714111307.19324-1-maximedevos@telenet.be> References: <20210714111307.19324-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=1626261198; bh=kcy0rH3VMbH+9vfeePVlkWsyyE303P2KPNipuvBft4g=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=QR6UW1jP2g7Wpq2iRdit9RqVkWSLQwpguiBWZ0h0rM35DaWtt9wFoF643bGFxCUAt N7NQY4ZGCVawrppYbsSuSquaO6kR4kutc7iPhCGUVRsAlDCC7D5xbYNV2VkJ57ur3P FmnzMAP+qna6ad2tHEnLmlob9BQmff7l5AJLr8lQkEVJemg1hgV8Kiy4vcDbJqVDz1 JNmUhdo/gDVgskwjx16xSmaJaA725wUe4pLmW2VW9PI4KGnuIR+EJoKZmwpcLdUocO lNCp/Zv4owMBwfiRPrNlVLB5ksYKS/B1pxa0w4SCc/NPxsBtZ8ACl/tVL8r7ihYxRY ZvT+ZDn6pUlRw== 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=1626261256; 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=kcy0rH3VMbH+9vfeePVlkWsyyE303P2KPNipuvBft4g=; b=RFa0bySdincExUmCY1puSz6A6lMLRLWol89dPnXrseuyXmDeOPaYKpmFSF9rEyEE3d83yn 9Dk4Mnrw68//K5QXHiYbsc+cpJzvqtxYZAuJ8I6/RkO6AGeCuvVu/l8w/mgxkusjaQbS3u hQT/V8FpyK1mK+/mMH9h26sdztOTTrEnW8pHRGH23epfycS/O+qPNqRE+ozOoqLS8JpdFd AoF1HqNhHqPnlzVBDX6Os+5+anMSbQMpVE8GJRNSovVyFKhg38Lt+9d1cdmlgw9ER+mdZg JBJJWKXektcC4v/k7KhIWGnSypxqtZfeFGIHTbNWYNEikjKjnJ7OnpEevvV12g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1626261256; a=rsa-sha256; cv=none; b=TSLSBXE+LBEsgSA+iO/1vJDm3Zy9FThEVh1gAHCXMO4ogLr6hnrVeEzsL8yL/dLOl69KSP CgNnKyD3v0e82w9OAfKdlmxRG/szSIZ+bSaEHsDgX5IWHWf7Ctdt61JppFT1YFZm33awve CpF+55f1sb6aV1KRaMVpKn1veXtf8OBHA5KUmc9DvzIWeTzuUpjI/33dgTztP/dpISp7HL aYEmpEiTjmFuHM531GAZ07vN0inoyEhuk37HsEbAQVZtvy764UzWHQzqmTE6ikHgeK/Giy nMqrYVpvKdMOmWoDBgAgWS8JGS0sPFNcJofFXdljg/JYUMqNTYlZhUrNUBvkFg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=telenet.be header.s=r21 header.b=QR6UW1jP; 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.30 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=telenet.be header.s=r21 header.b=QR6UW1jP; 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: 72A1B1968F X-Spam-Score: -0.30 X-Migadu-Scanner: scn0.migadu.com X-TUID: g0siBcaL6YWt * guix/utils.scm (target-linux?): New predicate. * tests/utils.scm ("target-linux?"): Test it. ("target-mingw?"): Also test ‘target-mingw?’. --- guix/utils.scm | 7 +++++++ tests/utils.scm | 17 +++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/guix/utils.scm b/guix/utils.scm index 19990ceb8a..58bbff2b36 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,11 @@ 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)))) + "Does the operating system of TARGET use the Linux kernel?" + (->bool (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..e170070907 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 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 target-mingw? + '("i686-linux-gnu" "i686-pc-gnu" + "i686-w64-mingw32"))) + (test-end) (false-if-exception (delete-file temp-file)) -- 2.32.0