[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
03/40: import: opam: Replace "_" with "-" in imported names.
From: |
guix-commits |
Subject: |
03/40: import: opam: Replace "_" with "-" in imported names. |
Date: |
Tue, 5 Feb 2019 16:34:52 -0500 (EST) |
roptat pushed a commit to branch master
in repository guix.
commit beee37ecdb246bf503c72e7da11e51d0b7d1a0b0
Author: Julien Lepiller <address@hidden>
Date: Fri Feb 1 16:16:25 2019 +0100
import: opam: Replace "_" with "-" in imported names.
* guix/import/opam.scm (ocaml-name->guix-name): Replace "_" with "-".
(opam->guix-packages): Add upstream name when we cannot guess it
properly.
---
guix/import/opam.scm | 31 ++++++++++++++++++++++---------
1 file changed, 22 insertions(+), 9 deletions(-)
diff --git a/guix/import/opam.scm b/guix/import/opam.scm
index 6ffb16b..fa8dc86 100644
--- a/guix/import/opam.scm
+++ b/guix/import/opam.scm
@@ -127,12 +127,17 @@ path to the repository."
(lambda _
(peg:tree (match-pattern records (get-string-all
(current-input-port)))))))
+(define (substitute-char str what with)
+ (string-join (string-split str what) with))
+
(define (ocaml-name->guix-name name)
- (cond
- ((equal? name "ocamlfind") "ocaml-findlib")
- ((string-prefix? "ocaml" name) name)
- ((string-prefix? "conf-" name) (substring name 5))
- (else (string-append "ocaml-" name))))
+ (substitute-char
+ (cond
+ ((equal? name "ocamlfind") "ocaml-findlib")
+ ((string-prefix? "ocaml" name) name)
+ ((string-prefix? "conf-" name) (substring name 5))
+ (else (string-append "ocaml-" name)))
+ #\_ "-"))
(define (metadata-ref file lookup)
(fold (lambda (record acc)
@@ -247,6 +252,10 @@ path to the repository."
,@(if (null? native-inputs)
'()
`((native-inputs ,(list 'quasiquote native-inputs))))
+ ,@(if (equal? name (guix-name->opam-name
(ocaml-name->guix-name name)))
+ '()
+ `((properties
+ ,(list 'quasiquote `((upstream-name . ,name))))))
(home-page ,(metadata-ref opam-content "homepage"))
(synopsis ,(metadata-ref opam-content "synopsis"))
(description ,(metadata-ref opam-content "description"))
@@ -259,6 +268,11 @@ path to the repository."
(opam->guix-package name))
#:guix-name ocaml-name->guix-name))
+(define (guix-name->opam-name name)
+ (if (string-prefix? "ocaml-" name)
+ (substring name 6)
+ name))
+
(define (guix-package->opam-name package)
"Given an OCaml PACKAGE built from OPAM, return the name of the
package in OPAM."
@@ -266,10 +280,9 @@ package in OPAM."
(package-properties package)
'upstream-name))
(name (package-name package)))
- (cond
- (upstream-name upstream-name)
- ((string-prefix? "ocaml-" name) (substring name 6))
- (else name))))
+ (if upstream-name
+ upstream-name
+ (guix-name->opam-name name))))
(define (opam-package? package)
"Return true if PACKAGE is an OCaml package from OPAM"
- 18/40: gnu: Add ocaml-ppx-bench., (continued)
- 18/40: gnu: Add ocaml-ppx-bench., guix-commits, 2019/02/05
- 09/40: gnu: Add ocaml-variantslib., guix-commits, 2019/02/05
- 20/40: gnu: Add ocaml-typerep., guix-commits, 2019/02/05
- 11/40: gnu: Add ocaml-ppx-sexp-conv., guix-commits, 2019/02/05
- 13/40: gnu: Add ocaml-ppx-custom-printf., guix-commits, 2019/02/05
- 07/40: gnu: Add ocaml-ppx-compare., guix-commits, 2019/02/05
- 04/40: gnu: ocaml-ppx-derivers: Add upstream-name., guix-commits, 2019/02/05
- 14/40: gnu: Add ocaml-bin-prot., guix-commits, 2019/02/05
- 10/40: gnu: Add ocaml-ppx-fields-conv., guix-commits, 2019/02/05
- 02/40: import: opam: Fix conditions., guix-commits, 2019/02/05
- 03/40: import: opam: Replace "_" with "-" in imported names.,
guix-commits <=
- 01/40: gnu: unison: Update to 2.51.1., guix-commits, 2019/02/05
- 05/40: import: opam: Work around janestreet version numbers., guix-commits, 2019/02/05