summary refs log tree commit diff
diff options
context:
space:
mode:
authorJulien Lepiller <julien@lepiller.eu>2019-02-01 15:35:45 +0100
committerJulien Lepiller <julien@lepiller.eu>2019-02-05 22:33:13 +0100
commitc3a191fafd88e1ecd8bf0ab0adc0cb959c038c94 (patch)
tree52a916b5c8defb253416a44091d820998980f2a8
parent51e52f47df65dacb5dba7bea7f0df28b5b5b031d (diff)
downloadguix-c3a191fafd88e1ecd8bf0ab0adc0cb959c038c94.tar.gz
import: opam: Work around janestreet version numbers.
janestreet reversionned its packages and prefixed them with "v". Let the
importer know about that and choose "v" versions first.

* guix/import/opam.scm (find-latest-version): Work around version
rewrite from janestreet.
(opam->guix-package): Do not pass "v" to version number.
-rw-r--r--guix/import/opam.scm11
1 files changed, 8 insertions, 3 deletions
diff --git a/guix/import/opam.scm b/guix/import/opam.scm
index fa8dc86d32..7b2e832e92 100644
--- a/guix/import/opam.scm
+++ b/guix/import/opam.scm
@@ -1,4 +1,3 @@
-;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2018 Julien Lepiller <julien@lepiller.eu>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -117,7 +116,11 @@ path to the repository."
                         (lambda (dir)
                           (string-join (cdr (string-split dir #\.)) "."))
                         versions)))
-        (latest-version versions))
+        ;; Workaround for janestreet re-versionning
+        (let ((v-versions (filter (lambda (version) (string-prefix? "v" version)) versions)))
+          (if (null? v-versions)
+            (latest-version versions)
+            (string-append "v" (latest-version (map (lambda (version) (substring version 1)) v-versions))))))
       (begin
         (format #t (G_ "Package not found in opam repository: ~a~%") package)
         #f))))
@@ -239,7 +242,9 @@ path to the repository."
                  (values
                   `(package
                      (name ,(ocaml-name->guix-name name))
-                     (version ,version)
+                     (version ,(if (string-prefix? "v" version)
+                                 (substring version 1)
+                                 version))
                      (source
                        (origin
                          (method url-fetch)