From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id QOuzG1B9x2CwbAAAgWs5BA (envelope-from ) for ; Mon, 14 Jun 2021 18:01:20 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id EPf6FlB9x2B2GgAAbx9fmQ (envelope-from ) for ; Mon, 14 Jun 2021 16:01: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 B281C34D25 for ; Mon, 14 Jun 2021 18:01:19 +0200 (CEST) Received: from localhost ([::1]:38300 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lsp1a-0000tg-NH for larch@yhetil.org; Mon, 14 Jun 2021 12:01:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54440) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lsof5-0008Jh-31 for guix-patches@gnu.org; Mon, 14 Jun 2021 11:38:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:35999) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lsof4-00077b-PH for guix-patches@gnu.org; Mon, 14 Jun 2021 11:38:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lsof4-0004Di-Nj for guix-patches@gnu.org; Mon, 14 Jun 2021 11:38:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49025] [PATCH core-updates 01/37] utils: Define target-linux? predicate. Resent-From: Maxime Devos Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 14 Jun 2021 15:38: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 Received: via spool by 49025-submit@debbugs.gnu.org id=B49025.162368503916035 (code B ref 49025); Mon, 14 Jun 2021 15:38:02 +0000 Received: (at 49025) by debbugs.gnu.org; 14 Jun 2021 15:37:19 +0000 Received: from localhost ([127.0.0.1]:47503 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lsoeN-0004AZ-2R for submit@debbugs.gnu.org; Mon, 14 Jun 2021 11:37:19 -0400 Received: from michel.telenet-ops.be ([195.130.137.88]:41494) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lsoeL-0004AR-Gm for 49025@debbugs.gnu.org; Mon, 14 Jun 2021 11:37:18 -0400 Received: from butterfly.local ([IPv6:2a02:1811:8c09:9d00:aaf1:9810:a0b8:a55d]) by michel.telenet-ops.be with bizsmtp id H3dG250020mfAB4063dGr2; Mon, 14 Jun 2021 17:37:16 +0200 Message-ID: <1006ad56f7750b41a6566edc2310105b80434aef.camel@telenet.be> From: Maxime Devos Date: Mon, 14 Jun 2021 17:37:16 +0200 In-Reply-To: References: Content-Type: multipart/mixed; boundary="=-EXoauoUcFIELojDkzoZx" 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=1623685036; bh=O3dLFRNgrcLOgQ05ElriE16zWpQ323uQya/Y3etXMcg=; h=Subject:From:To:Date:In-Reply-To:References; b=Y0PBhrUQRLo5Fx/mqii8n9z21RomunWGj/BeBWtt1tx24htP+WrFhBqi2zieNnQk8 1IEcfYBxZFDfoR53uYrf8NqLjkMWmY1ev1pCw/bi088qxeUn63BSRdptRKgFC0BerD QuuwDPRlNzwnSx7pFE+WOkrn2Dvpxo+fJehtm1e5zkZmKW0tsnNEyCsp9pKmIOppsl VI4YAanrSV0wkpUAVWDmoxPobGtmMBxKEnNWuWcOtZRCYvF2Sq0JVYxBzp+5ejS/fc e1Z2eq2odUHFLjmFJZNeD5gnakgdwdX/5meObBNq0WNI5sgswTzbZ+q4DMl80ajAxJ 2ZdoMt5dblG6w== 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=1623686479; 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=O3dLFRNgrcLOgQ05ElriE16zWpQ323uQya/Y3etXMcg=; b=XF3ja4pnzd22j6XcVU65oiROYDnfXhaSzm0NMYWPOFJa7WUEzaPkfQNZpS9VGPfxMGUUyI LiK+n++YWeIUHZLZ3fVezxMGeqjxOw2FewCkmXmsao5Cdu7dXNmnfBAS1IupZOazIzfZyP +kSOuwoAOzchoJ4+O3SedhZv2evxZDlI/r/tpX9YFAP7maWztdZqBnxSomr81Kd7mEaHuY +XSVmT8iXuNn2uCXnalfd1x1G3alBVGcv7JHMk+bYL7Ojm7IvYHxLGJBlfNb4KAuJfI+AA 4cwy1yx5PFW0+wzLziHnwMZ0m4dJGz1h/hebmtDYSUQymsjeHuSbu7+VCgCpmA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1623686479; a=rsa-sha256; cv=none; b=qswJDkA0sk+vWWqjBMUsqeFPJPV3dlmk8uusSmytHDVpwWGtlWR/jH4lYeKesIl+EKzQR7 B9+xMx5QL2DC8o3Nw89lFknJ7Ikvx/jaK9onvtBMDc+9ZTNaRPrXRXJ1NHQBJTFBq78R8W EeSuYHICMe9bSc6oLuE9PVInbF5vMv8VAa6T71KSJDDrAfHut1sgINm2URH3miLSTOqGjr VxTsIVILbmo5s8jVs17xLRVBakKfkQ1fIvIU6vwjH+uwH26LSKTwqvyJUD4bMnzS/tGSIk H8g/sxpMgQWc5mIYnOucs4zAE6EuIZ5H8gb4jWBG+IrQXpm7dY3W9U1Ke6q74Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=telenet.be header.s=r21 header.b=Y0PBhrUQ; 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=Y0PBhrUQ; 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: B281C34D25 X-Spam-Score: -1.33 X-Migadu-Scanner: scn0.migadu.com X-TUID: oHG4wDOh+8WK --=-EXoauoUcFIELojDkzoZx Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit * 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(+) --=-EXoauoUcFIELojDkzoZx Content-Disposition: attachment; filename="0001-utils-Define-target-linux-predicate.patch" Content-Transfer-Encoding: 8bit Content-Type: text/x-patch; name="0001-utils-Define-target-linux-predicate.patch"; charset="UTF-8" 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)) --=-EXoauoUcFIELojDkzoZx--