gnu: hurd: Fix hurd-target?, add hurd-system?.

* gnu/packages/hurd.scm (hurd-target?): Bugfix; the arguments to
string-suffix? to test (%current-system) were transposed, always resulting
in #f.  Use hurd-triplet?.
(hurd-system?): New exported variable.
This commit is contained in:
Jan Nieuwenhuizen 2020-03-04 11:49:46 -05:00
parent 654de94e74
commit 9b943db357
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273

View file

@ -3,6 +3,7 @@
;;; Copyright © 2018 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2018 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il> ;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com> ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -34,8 +35,9 @@ (define-module (gnu packages hurd)
#:use-module (gnu packages base) #:use-module (gnu packages base)
#:use-module (gnu packages texinfo) #:use-module (gnu packages texinfo)
#:use-module (guix git-download) #:use-module (guix git-download)
#:export (hurd-triplet? #:export (hurd-system?
hurd-target?)) hurd-target?
hurd-triplet?))
(define (hurd-triplet? triplet) (define (hurd-triplet? triplet)
(and (string-suffix? "-gnu" triplet) (and (string-suffix? "-gnu" triplet)
@ -45,7 +47,12 @@ (define (hurd-target?)
"Return true if the cross-compilation target or the current system is "Return true if the cross-compilation target or the current system is
GNU/Hurd." GNU/Hurd."
(or (and=> (%current-target-system) hurd-triplet?) (or (and=> (%current-target-system) hurd-triplet?)
(string-suffix? (%current-system) "-gnu"))) (and (not (%current-target-system))
(and=> (%current-system) hurd-triplet?))))
(define (hurd-system?)
"Return true if the current system is the Hurd."
(and=> (%current-system) hurd-triplet?))
(define (hurd-source-url version) (define (hurd-source-url version)
(string-append "mirror://gnu/hurd/hurd-" (string-append "mirror://gnu/hurd/hurd-"