mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2026-04-06 21:20:33 +02:00
guix: opam: More flexibility in the importer.
* guix/scripts/import/opam.scm: Pass all instances of --repo as a list to the importer. * guix/import/opam.scm (opam-fetch): Stop expecting "expanded" repositories and call get-opam-repository instead to keep values "symbolic" as long as possible and factorize. (get-opam-repository): Use the same repository source as CLI opam does (i.e. HTTP-served index.tar.gz instead of git repositories). (find-latest-version): Be more flexible on the repositories structure instead of expecting packages/PACKAGE-NAME/PACKAGE-NAME.VERSION/. * tests/opam.scm: Update the call to opam->guix-package since repo is now expected to be a list and remove the mocked get-opam-repository deprecated by the support for local folders by the actual implementation. * doc/guix.texi: Document the new semantics and valid arguments for the --repo option. Signed-off-by: Julien Lepiller <julien@lepiller.eu>
This commit is contained in:
committed by
Julien Lepiller
parent
6d9d10ae3f
commit
fc29c80b96
@@ -82,41 +82,39 @@ url {
|
||||
(set! test-source-hash
|
||||
(call-with-input-file file-name port-sha256))))
|
||||
(_ (error "Unexpected URL: " url)))))
|
||||
(mock ((guix import opam) get-opam-repository
|
||||
(const test-repo))
|
||||
(let ((my-package (string-append test-repo
|
||||
"/packages/foo/foo.1.0.0")))
|
||||
(mkdir-p my-package)
|
||||
(with-output-to-file (string-append my-package "/opam")
|
||||
(lambda _
|
||||
(format #t "~a" test-opam-file))))
|
||||
(match (opam->guix-package "foo" #:repo test-repo)
|
||||
(('package
|
||||
('name "ocaml-foo")
|
||||
('version "1.0.0")
|
||||
('source ('origin
|
||||
('method 'url-fetch)
|
||||
('uri "https://example.org/foo-1.0.0.tar.gz")
|
||||
('sha256
|
||||
('base32
|
||||
(? string? hash)))))
|
||||
('build-system 'ocaml-build-system)
|
||||
('propagated-inputs
|
||||
('quasiquote
|
||||
(("ocaml-zarith" ('unquote 'ocaml-zarith)))))
|
||||
('native-inputs
|
||||
('quasiquote
|
||||
(("ocaml-alcotest" ('unquote 'ocaml-alcotest))
|
||||
("ocamlbuild" ('unquote 'ocamlbuild)))))
|
||||
('home-page "https://example.org/")
|
||||
('synopsis "Some example package")
|
||||
('description "This package is just an example.")
|
||||
('license 'license:bsd-3))
|
||||
(string=? (bytevector->nix-base32-string
|
||||
test-source-hash)
|
||||
hash))
|
||||
(x
|
||||
(pk 'fail x #f))))))
|
||||
(let ((my-package (string-append test-repo
|
||||
"/packages/foo/foo.1.0.0")))
|
||||
(mkdir-p my-package)
|
||||
(with-output-to-file (string-append my-package "/opam")
|
||||
(lambda _
|
||||
(format #t "~a" test-opam-file))))
|
||||
(match (opam->guix-package "foo" #:repo (list test-repo))
|
||||
(('package
|
||||
('name "ocaml-foo")
|
||||
('version "1.0.0")
|
||||
('source ('origin
|
||||
('method 'url-fetch)
|
||||
('uri "https://example.org/foo-1.0.0.tar.gz")
|
||||
('sha256
|
||||
('base32
|
||||
(? string? hash)))))
|
||||
('build-system 'ocaml-build-system)
|
||||
('propagated-inputs
|
||||
('quasiquote
|
||||
(("ocaml-zarith" ('unquote 'ocaml-zarith)))))
|
||||
('native-inputs
|
||||
('quasiquote
|
||||
(("ocaml-alcotest" ('unquote 'ocaml-alcotest))
|
||||
("ocamlbuild" ('unquote 'ocamlbuild)))))
|
||||
('home-page "https://example.org/")
|
||||
('synopsis "Some example package")
|
||||
('description "This package is just an example.")
|
||||
('license 'license:bsd-3))
|
||||
(string=? (bytevector->nix-base32-string
|
||||
test-source-hash)
|
||||
hash))
|
||||
(x
|
||||
(pk 'fail x #f)))))
|
||||
|
||||
;; Test the opam file parser
|
||||
;; We fold over some test cases. Each case is a pair of the string to parse and the
|
||||
|
||||
Reference in New Issue
Block a user