From cde1e967cfc0849c7010eda0bc700dadf222275f Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 9 Feb 2015 17:17:07 +0100 Subject: utils: Add 'version>=?'. * guix/utils.scm (version>?): Clarify docstring. (version>=?): New procedure. --- guix/utils.scm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/guix/utils.scm b/guix/utils.scm index 1c619c3ef9..3d38ba1223 100644 --- a/guix/utils.scm +++ b/guix/utils.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012, 2013, 2014 Ludovic Courtès +;;; Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès ;;; Copyright © 2013, 2014, 2015 Mark H Weaver ;;; Copyright © 2014 Eric Bavier ;;; Copyright © 2014 Ian Denhardt @@ -67,6 +67,7 @@ %current-target-system version-compare version>? + version>=? version-prefix version-major+minor guile-version>? @@ -554,9 +555,15 @@ minor version numbers from version-string." (version-prefix version-string 2)) (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))) +(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) "Return #t if the running Guile version is greater than STR." ;; Note: Using (version>? (version) "2.0.5") or similar doesn't work, -- cgit v1.2.3