utils: Add 'version>=?'.

* guix/utils.scm (version>?): Clarify docstring.
  (version>=?): New procedure.
This commit is contained in:
Ludovic Courtès 2015-02-09 17:17:07 +01:00
parent d4f12db8c0
commit cde1e967cf
1 changed files with 9 additions and 2 deletions

View File

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2013, 2014, 2015 Mark H Weaver <mhw@netris.org> ;;; Copyright © 2013, 2014, 2015 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org> ;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
;;; Copyright © 2014 Ian Denhardt <ian@zenhack.net> ;;; Copyright © 2014 Ian Denhardt <ian@zenhack.net>
@ -67,6 +67,7 @@
%current-target-system %current-target-system
version-compare version-compare
version>? version>?
version>=?
version-prefix version-prefix
version-major+minor version-major+minor
guile-version>? guile-version>?
@ -554,9 +555,15 @@ minor version numbers from version-string."
(version-prefix version-string 2)) (version-prefix version-string 2))
(define (version>? a b) (define (version>? a b)
"Return #t when A denotes a newer version than B." "Return #t when A denotes a version strictly newer than B."
(eq? '> (version-compare a b))) (eq? '> (version-compare a b)))
(define (version>=? a b)
"Return #t when A denotes a version newer or equal to B."
(case (version-compare a b)
((> =) #t)
(else #f)))
(define (guile-version>? str) (define (guile-version>? str)
"Return #t if the running Guile version is greater than STR." "Return #t if the running Guile version is greater than STR."
;; Note: Using (version>? (version) "2.0.5") or similar doesn't work, ;; Note: Using (version>? (version) "2.0.5") or similar doesn't work,