summaryrefslogtreecommitdiff
path: root/guix/utils.scm
diff options
context:
space:
mode:
authorMaxime Devos <maximedevos@telenet.be>2021-07-14 13:12:46 +0200
committerMathieu Othacehe <othacehe@gnu.org>2021-07-14 15:38:03 +0200
commitef71965c162ff19c7b4b85889b0330d7c428dda5 (patch)
tree0c68d09690f4b32bbee991317dfbf9106e0e82d5 /guix/utils.scm
parentb4ccf3df0bb141da4301c6937e5e6660a29d4727 (diff)
downloadguix-patches-ef71965c162ff19c7b4b85889b0330d7c428dda5.tar
guix-patches-ef71965c162ff19c7b4b85889b0330d7c428dda5.tar.gz
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>
Diffstat (limited to 'guix/utils.scm')
-rw-r--r--guix/utils.scm7
1 files changed, 7 insertions, 0 deletions
diff --git a/guix/utils.scm b/guix/utils.scm
index 65d709a01f..1ac17b3657 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,6 +634,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)))