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.
This commit is contained in:
Julien Lepiller 2019-02-01 15:35:45 +01:00
parent 51e52f47df
commit c3a191fafd
No known key found for this signature in database
GPG Key ID: 43111F4520086A0C
1 changed files with 8 additions and 3 deletions

View File

@ -1,4 +1,3 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2018 Julien Lepiller <julien@lepiller.eu> ;;; Copyright © 2018 Julien Lepiller <julien@lepiller.eu>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
@ -117,7 +116,11 @@ path to the repository."
(lambda (dir) (lambda (dir)
(string-join (cdr (string-split dir #\.)) ".")) (string-join (cdr (string-split dir #\.)) "."))
versions))) 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 (begin
(format #t (G_ "Package not found in opam repository: ~a~%") package) (format #t (G_ "Package not found in opam repository: ~a~%") package)
#f)))) #f))))
@ -239,7 +242,9 @@ path to the repository."
(values (values
`(package `(package
(name ,(ocaml-name->guix-name name)) (name ,(ocaml-name->guix-name name))
(version ,version) (version ,(if (string-prefix? "v" version)
(substring version 1)
version))
(source (source
(origin (origin
(method url-fetch) (method url-fetch)