[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/20: utils: Define target-linux? predicate.
From: |
guix-commits |
Subject: |
01/20: utils: Define target-linux? predicate. |
Date: |
Mon, 12 Jul 2021 11:15:40 -0400 (EDT) |
mothacehe pushed a commit to branch wip-meson
in repository guix.
commit 020e575d1c9df79c052b5a34edabfe65bc1056f7
Author: Maxime Devos <maximedevos@telenet.be>
AuthorDate: Sun Jul 11 13:47:04 2021 +0200
utils: Define target-linux? predicate.
* guix/utils.scm (target-linux?): New predicate.
* tests/utils.scm
("target-linux?"): Test it.
("target-mingw?"): Also test ‘target-mingw?’.
Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
---
guix/utils.scm | 8 ++++++++
tests/utils.scm | 16 ++++++++++++++++
2 files changed, 24 insertions(+)
diff --git a/guix/utils.scm b/guix/utils.scm
index 65d709a..016ad34 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -11,6 +11,7 @@
;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
;;; Copyright © 2021 Chris Marusich <cmmarusich@gmail.com>
+;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -83,6 +84,7 @@
%current-system
%current-target-system
package-name->name+version
+ target-linux?
target-mingw?
target-arm32?
target-aarch64?
@@ -632,7 +634,13 @@ 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))))
+ "Is the operating system of TARGET Linux?"
+ (->bool (string-contains target "linux")))
+
(define* (target-mingw? #:optional (target (%current-target-system)))
+ "Is the operating system of TARGET Windows 32 bits?"
(and target
(string-suffix? "-mingw32" target)))
diff --git a/tests/utils.scm b/tests/utils.scm
index 7fcbb25..7142ac2 100644
--- a/tests/utils.scm
+++ b/tests/utils.scm
@@ -3,6 +3,7 @@
;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
;;; Copyright © 2016 Mathieu Lirzin <mthl@gnu.org>
;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
+;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -289,6 +290,21 @@ 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))
- 06/20: libgpg-error: Remove trailing #f from phases., (continued)
- 06/20: libgpg-error: Remove trailing #f from phases., guix-commits, 2021/07/12
- 08/20: libgpg-error: Fix cross-compilation error., guix-commits, 2021/07/12
- 18/20: glib: Look up "tzdata" in 'native-inputs', not 'inputs'., guix-commits, 2021/07/12
- 10/20: openssl: Remove trailing #t from phases., guix-commits, 2021/07/12
- 17/20: glib: Verify the cross-compiled python is used in installed scripts., guix-commits, 2021/07/12
- 15/20: openssl: Extract logic for computing CONFIGURE_TARGET_ARCH., guix-commits, 2021/07/12
- 07/20: libgpg-error: Prevent silent miscompilation some systems., guix-commits, 2021/07/12
- 09/20: python: Fix reference to input when cross-compiling., guix-commits, 2021/07/12
- 13/20: openssl: Move documentation instead of copying and deleting it., guix-commits, 2021/07/12
- 14/20: openssl: Move all man pages to separate output, not only man3., guix-commits, 2021/07/12
- 01/20: utils: Define target-linux? predicate.,
guix-commits <=
- 12/20: openssl: Use G-exp machinery for referring to outputs., guix-commits, 2021/07/12
- 03/20: packages: Define this-package-input and this-package-native-input., guix-commits, 2021/07/12
- 05/20: tzdata: Don't bother with cross-compiling., guix-commits, 2021/07/12
- 19/20: libelf: Update configure script and config.guess and config.sub., guix-commits, 2021/07/12