diff options
author | Ian Denhardt <ian@zenhack.net> | 2014-10-18 22:03:42 -0400 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2014-10-20 15:32:54 +0200 |
commit | 29a7c98a422bf3b9503ac8375db2ab28ef2dfe32 (patch) | |
tree | 7fd9219e875e44fb6328b6f84994279e3504d34a /guix | |
parent | 38bf090e7c3952bb30707fe544987cccc85b8677 (diff) | |
download | gnu-guix-29a7c98a422bf3b9503ac8375db2ab28ef2dfe32.tar gnu-guix-29a7c98a422bf3b9503ac8375db2ab28ef2dfe32.tar.gz |
gnu: Add 'version-prefix' and 'version-major+minor'; use them.
The procedure version-prefix truncates a version string to a certain
number of components. version-major+minor is a special case of this,
which extracts the "major.minor" part of the string. Previously this
was handled by an expression common to several packages.
* guix/utils.scm (version-prefix, version-major+minor): New procedures
* gnu/packages/backup.scm (duplicity): Use version-major+minor.
* gnu/packages/cmake.scm (cmake): Likewise.
* gnu/packages/gnome.scm (libbonobo, libbonoboui): Likewise.
* gnu/packages/gnutls.scm (gnutls): Likewise.
* gnu/packages/mail.scm (gmime): Likewise.
* gnu/packages/mpd.scm (mpd): Likewise.
* gnu/packages/mpi.scm (openmpi): Likewise.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'guix')
-rw-r--r-- | guix/utils.scm | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/guix/utils.scm b/guix/utils.scm index 6392914845..9b802b6fb3 100644 --- a/guix/utils.scm +++ b/guix/utils.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2013 Mark H Weaver <mhw@netris.org> ;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org> +;;; Copyright © 2014 Ian Denhardt <ian@zenhack.net> ;;; ;;; This file is part of GNU Guix. ;;; @@ -65,6 +66,8 @@ %current-target-system version-compare version>? + version-prefix + version-major+minor guile-version>? package-name->name+version string-tokenize* @@ -518,6 +521,17 @@ or '= when they denote equal versions." ((negative? result) '<) (else '=)))))) +(define (version-prefix version-string num-parts) + "Truncate version-string to the first num-parts components of the version. +For example, (version-prefix \"2.1.47.4.23\" 3) returns \"2.1.47\"" + (string-join (take (string-split version-string #\.) num-parts) ".")) + + +(define (version-major+minor version-string) + "Return \"<major>.<minor>\", where major and minor are the major and +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." (eq? '> (version-compare a b))) |