me
/
guix
Archived
1
0
Fork 0

tests: Use quasiquoted 'match' patterns for package sexps.

Turns out it's easier to read.

* tests/cpan.scm ("cpan->guix-package"): Use a quasiquoted pattern.
* tests/elpa.scm (eval-test-with-elpa): Likewise.
* tests/gem.scm ("gem->guix-package")
("gem->guix-package with a specific version")
("gem-recursive-import")
("gem-recursive-import with a specific version"): Likewise.
* tests/hexpm.scm ("hexpm-recursive-import"): Likewise.
* tests/opam.scm ("opam->guix-package"): Likewise.
* tests/pypi.scm ("pypi->guix-package, no wheel")
("pypi->guix-package, wheels")
("pypi->guix-package, no usable requirement file.")
("pypi->guix-package, package name contains \"-\" followed by digits"):
Likewise.
* tests/texlive.scm ("texlive->guix-package"): Likewise.
master
Ludovic Courtès 2023-05-31 23:50:06 +02:00
parent 9f7cd1fcaf
commit 654fcf9971
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
7 changed files with 278 additions and 284 deletions

View File

@ -73,22 +73,21 @@
(parameterize ((%metacpan-base-url (%local-url))
(current-http-proxy (%local-url)))
(match (cpan->guix-package "Foo::Bar")
(('package
('name "perl-foo-bar")
('version "0.1")
('source ('origin
('method 'url-fetch)
('uri ('string-append "http://example.com/Foo-Bar-"
'version ".tar.gz"))
('sha256
('base32
(? string? hash)))))
('build-system 'perl-build-system)
('propagated-inputs ('list 'perl-test-script))
('home-page "https://metacpan.org/release/Foo-Bar")
('synopsis "Fizzle Fuzz")
('description 'fill-in-yourself!)
('license 'perl-license))
(`(package
(name "perl-foo-bar")
(version "0.1")
(source (origin
(method url-fetch)
(uri (string-append "http://example.com/Foo-Bar-"
version ".tar.gz"))
(sha256
(base32 ,(? string? hash)))))
(build-system perl-build-system)
(propagated-inputs (list perl-test-script))
(home-page "https://metacpan.org/release/Foo-Bar")
(synopsis "Fizzle Fuzz")
(description fill-in-yourself!)
(license perl-license))
(string=? (bytevector->nix-base32-string
(call-with-input-string test-source port-sha256))
hash))

View File

@ -66,20 +66,20 @@
(200 "fake tarball contents"))
(parameterize ((current-http-proxy (%local-url)))
(match (elpa->guix-package pkg #:repo 'gnu/http)
(('package
('name "emacs-auctex")
('version "11.88.6")
('source
('origin
('method 'url-fetch)
('uri ('string-append
"http://elpa.gnu.org/packages/auctex-" 'version ".tar"))
('sha256 ('base32 (? string? hash)))))
('build-system 'emacs-build-system)
('home-page "http://www.gnu.org/software/auctex/")
('synopsis "Integrated environment for *TeX*")
('description "This is the description.")
('license 'license:gpl3+))
(`(package
(name "emacs-auctex")
(version "11.88.6")
(source
(origin
(method url-fetch)
(uri (string-append
"http://elpa.gnu.org/packages/auctex-" version ".tar"))
(sha256 (base32 ,(? string? hash)))))
(build-system emacs-build-system)
(home-page "http://www.gnu.org/software/auctex/")
(synopsis "Integrated environment for *TeX*")
(description "This is the description.")
(license license:gpl3+))
#t)
(x
(pk 'fail x #f))))))

View File

@ -105,21 +105,21 @@
(string-length test-foo-json)))
(_ (error "Unexpected URL: " url)))))
(match (gem->guix-package "foo")
(('package
('name "ruby-foo")
('version "1.0.0")
('source ('origin
('method 'url-fetch)
('uri ('rubygems-uri "foo" 'version))
('sha256
('base32
(`(package
(name "ruby-foo")
(version "1.0.0")
(source (origin
(method url-fetch)
(uri (rubygems-uri "foo" version))
(sha256
(base32
"1a270mlajhrmpqbhxcqjqypnvgrq4pgixpv3w9gwp1wrrapnwrzk"))))
('build-system 'ruby-build-system)
('propagated-inputs ('list 'bundler 'ruby-bar))
('synopsis "A cool gem")
('description "This package provides a cool gem")
('home-page "https://example.com")
('license ('list 'license:expat 'license:asl2.0)))
(build-system ruby-build-system)
(propagated-inputs (list bundler ruby-bar))
(synopsis "A cool gem")
(description "This package provides a cool gem")
(home-page "https://example.com")
(license (list license:expat license:asl2.0)))
#t)
(x
(pk 'fail x #f)))))
@ -134,21 +134,21 @@
(string-length test-foo-v2-json)))
(_ (error "Unexpected URL: " url)))))
(match (gem->guix-package "foo" #:version "2.0.0")
(('package
('name "ruby-foo")
('version "2.0.0")
('source ('origin
('method 'url-fetch)
('uri ('rubygems-uri "foo" 'version))
('sha256
('base32
(`(package
(name "ruby-foo")
(version "2.0.0")
(source (origin
(method url-fetch)
(uri (rubygems-uri "foo" version))
(sha256
(base32
"1a270mlajhrmpqbhxcqjqypnvgrq4pgixpv3w9gwp1wrrapnwrzk"))))
('build-system 'ruby-build-system)
('propagated-inputs ('list 'bundler 'ruby-bar))
('synopsis "A cool gem")
('description "This package provides a cool gem")
('home-page "https://example.com")
('license ('list 'license:expat 'license:asl2.0)))
(build-system ruby-build-system)
(propagated-inputs (list bundler ruby-bar))
(synopsis "A cool gem")
(description "This package provides a cool gem")
(home-page "https://example.com")
(license (list license:expat license:asl2.0)))
#t)
(x
(pk 'fail x #f)))))
@ -169,38 +169,38 @@
(string-length test-bundler-json)))
(_ (error "Unexpected URL: " url)))))
(match (gem-recursive-import "foo")
((('package
('name "ruby-bar")
('version "1.0.0")
('source
('origin
('method 'url-fetch)
('uri ('rubygems-uri "bar" 'version))
('sha256
('base32
"1a270mlajhrmpqbhxcqjqypnvgrq4pgixpv3w9gwp1wrrapnwrzk"))))
('build-system 'ruby-build-system)
('propagated-inputs ('list 'bundler))
('synopsis "Another cool gem")
('description "Another cool gem")
('home-page "https://example.com")
('license #f)) ;no licensing info
('package
('name "ruby-foo")
('version "1.0.0")
('source
('origin
('method 'url-fetch)
('uri ('rubygems-uri "foo" 'version))
('sha256
('base32
"1a270mlajhrmpqbhxcqjqypnvgrq4pgixpv3w9gwp1wrrapnwrzk"))))
('build-system 'ruby-build-system)
('propagated-inputs ('list 'bundler 'ruby-bar))
('synopsis "A cool gem")
('description "This package provides a cool gem")
('home-page "https://example.com")
('license ('list 'license:expat 'license:asl2.0))))
(`((package
(name "ruby-bar")
(version "1.0.0")
(source
(origin
(method url-fetch)
(uri (rubygems-uri "bar" version))
(sha256
(base32
"1a270mlajhrmpqbhxcqjqypnvgrq4pgixpv3w9gwp1wrrapnwrzk"))))
(build-system ruby-build-system)
(propagated-inputs (list bundler))
(synopsis "Another cool gem")
(description "Another cool gem")
(home-page "https://example.com")
(license #f)) ;no licensing info
(package
(name "ruby-foo")
(version "1.0.0")
(source
(origin
(method url-fetch)
(uri (rubygems-uri "foo" version))
(sha256
(base32
"1a270mlajhrmpqbhxcqjqypnvgrq4pgixpv3w9gwp1wrrapnwrzk"))))
(build-system ruby-build-system)
(propagated-inputs (list bundler ruby-bar))
(synopsis "A cool gem")
(description "This package provides a cool gem")
(home-page "https://example.com")
(license (list license:expat license:asl2.0))))
#t)
(x
(pk 'fail x #f)))))
@ -221,38 +221,38 @@
(string-length test-bundler-json)))
(_ (error "Unexpected URL: " url)))))
(match (gem-recursive-import "foo" "2.0.0")
((('package
('name "ruby-bar")
('version "1.0.0")
('source
('origin
('method 'url-fetch)
('uri ('rubygems-uri "bar" 'version))
('sha256
('base32
"1a270mlajhrmpqbhxcqjqypnvgrq4pgixpv3w9gwp1wrrapnwrzk"))))
('build-system 'ruby-build-system)
('propagated-inputs ('list 'bundler))
('synopsis "Another cool gem")
('description "Another cool gem")
('home-page "https://example.com")
('license #f)) ;no licensing info
('package
('name "ruby-foo")
('version "2.0.0")
('source
('origin
('method 'url-fetch)
('uri ('rubygems-uri "foo" 'version))
('sha256
('base32
"1a270mlajhrmpqbhxcqjqypnvgrq4pgixpv3w9gwp1wrrapnwrzk"))))
('build-system 'ruby-build-system)
('propagated-inputs ('list 'bundler 'ruby-bar))
('synopsis "A cool gem")
('description "This package provides a cool gem")
('home-page "https://example.com")
('license ('list 'license:expat 'license:asl2.0))))
(`((package
(name "ruby-bar")
(version "1.0.0")
(source
(origin
(method url-fetch)
(uri (rubygems-uri "bar" version))
(sha256
(base32
"1a270mlajhrmpqbhxcqjqypnvgrq4pgixpv3w9gwp1wrrapnwrzk"))))
(build-system ruby-build-system)
(propagated-inputs (list bundler))
(synopsis "Another cool gem")
(description "Another cool gem")
(home-page "https://example.com")
(license #f)) ;no licensing info
(package
(name "ruby-foo")
(version "2.0.0")
(source
(origin
(method url-fetch)
(uri (rubygems-uri "foo" version))
(sha256
(base32
"1a270mlajhrmpqbhxcqjqypnvgrq4pgixpv3w9gwp1wrrapnwrzk"))))
(build-system ruby-build-system)
(propagated-inputs (list bundler ruby-bar))
(synopsis "A cool gem")
(description "This package provides a cool gem")
(home-page "https://example.com")
(license (list license:expat license:asl2.0))))
#t)
(x
(pk 'fail x #f)))))

View File

@ -139,22 +139,22 @@
"source")
(_ (error "url-fetch got unexpected URL: " url))))))))
(match (hexpm->guix-package "bla")
(('package
('name "erlang-bla")
('version "1.5.0")
('source
('origin
('method 'url-fetch)
('uri ('hexpm-uri "bla" 'version))
('sha256
('base32
"0zcl4dgcmqwl1g5xb901pd6dz61r1xgmac9mqlwvh022paa6gks1"))))
('build-system 'rebar-build-system)
('inputs ('list 'erlang-blubb 'erlang-fasel))
('synopsis "A cool package")
('description "This package provides a cool package")
('home-page "https://hex.pm/packages/bla")
('license ('list 'license:expat 'license:asl2.0)))
(`(package
(name "erlang-bla")
(version "1.5.0")
(source
(origin
(method url-fetch)
(uri (hexpm-uri "bla" version))
(sha256
(base32
"0zcl4dgcmqwl1g5xb901pd6dz61r1xgmac9mqlwvh022paa6gks1"))))
(build-system rebar-build-system)
(inputs (list erlang-blubb erlang-fasel))
(synopsis "A cool package")
(description "This package provides a cool package")
(home-page "https://hex.pm/packages/bla")
(license (list license:expat license:asl2.0)))
#t)
(x
(pk 'fail x #f))))))
@ -199,53 +199,53 @@
"fasel-source")
(_ (error "url-fetch got unexpected URL: " url))))))))
(match (hexpm-recursive-import "bla")
((('package
('name "erlang-blubb")
('version "0.3.1")
('source
('origin
('method 'url-fetch)
('uri ('hexpm-uri "blubb" 'version))
('sha256
('base32
"17y88b5y8ld7s1c2bcwwwa04pf1cl4402i9zk3inna221ps3ppj2"))))
('build-system 'mix-build-system)
('inputs ('list 'erlang-fasel))
('synopsis "Another cool package")
('description "Another cool package")
('home-page "https://hex.pm/packages/blubb")
('license 'license:expat))
('package
('name "erlang-fasel")
('version "1.2.1")
('source
('origin
('method 'url-fetch)
('uri ('hexpm-uri "fasel" 'version))
('sha256
('base32
"1k6d70mxwqgq78jrbr7yqnw187yki74jnagybi7nacrj4a67qjha"))))
('build-system 'gnu-build-system)
('synopsis "Yet another cool package")
('description "Yet another cool package")
('home-page "https://hex.pm/packages/fasel")
('license "GPL"))
('package
('name "erlang-bla")
('version "1.5.0")
('source
('origin
('method 'url-fetch)
('uri ('hexpm-uri "bla" 'version))
('sha256
('base32
"0d3gj746c4swbb1m6ycylxb239jsavvdcizag6bfbg2aqccxwij8"))))
('build-system 'rebar-build-system)
('inputs ('list 'erlang-blubb 'erlang-fasel))
('synopsis "A cool package")
('description "This package provides a cool package")
('home-page "https://hex.pm/packages/bla")
('license ('list 'license:expat 'license:asl2.0))))
(`((package
(name "erlang-blubb")
(version "0.3.1")
(source
(origin
(method url-fetch)
(uri (hexpm-uri "blubb" version))
(sha256
(base32
"17y88b5y8ld7s1c2bcwwwa04pf1cl4402i9zk3inna221ps3ppj2"))))
(build-system mix-build-system)
(inputs (list erlang-fasel))
(synopsis "Another cool package")
(description "Another cool package")
(home-page "https://hex.pm/packages/blubb")
(license license:expat))
(package
(name "erlang-fasel")
(version "1.2.1")
(source
(origin
(method url-fetch)
(uri (hexpm-uri "fasel" version))
(sha256
(base32
"1k6d70mxwqgq78jrbr7yqnw187yki74jnagybi7nacrj4a67qjha"))))
(build-system gnu-build-system)
(synopsis "Yet another cool package")
(description "Yet another cool package")
(home-page "https://hex.pm/packages/fasel")
(license "GPL"))
(package
(name "erlang-bla")
(version "1.5.0")
(source
(origin
(method url-fetch)
(uri (hexpm-uri "bla" version))
(sha256
(base32
"0d3gj746c4swbb1m6ycylxb239jsavvdcizag6bfbg2aqccxwij8"))))
(build-system rebar-build-system)
(inputs (list erlang-blubb erlang-fasel))
(synopsis "A cool package")
(description "This package provides a cool package")
(home-page "https://hex.pm/packages/bla")
(license (list license:expat license:asl2.0))))
#t)
(x
(pk 'fail x #f))))))

View File

@ -92,23 +92,22 @@ url {
(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 ('list 'ocaml-zarith))
('native-inputs
('list 'ocaml-alcotest 'ocamlbuild))
('home-page "https://example.org/")
('synopsis "Some example package")
('description "This package is just an example.")
('license 'license:bsd-3))
(`(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 (list ocaml-zarith))
(native-inputs
(list ocaml-alcotest 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))

View File

@ -302,22 +302,21 @@ files specified by SPECS. Return its file name."
("/foo/json" 200 ,(lambda (port)
(display (foo-json) port)))))
(match (pypi->guix-package "foo")
(('package
('name "python-foo")
('version "1.0.0")
('source ('origin
('method 'url-fetch)
('uri ('pypi-uri "foo" 'version))
('sha256
('base32
(? string? hash)))))
('build-system 'pyproject-build-system)
('propagated-inputs ('list 'python-bar 'python-foo))
('native-inputs ('list 'python-pytest))
('home-page "http://example.com")
('synopsis "summary")
('description "summary")
('license 'license:lgpl2.0))
(`(package
(name "python-foo")
(version "1.0.0")
(source (origin
(method url-fetch)
(uri (pypi-uri "foo" version))
(sha256
(base32 ,(? string? hash)))))
(build-system pyproject-build-system)
(propagated-inputs (list python-bar python-foo))
(native-inputs (list python-pytest))
(home-page "http://example.com")
(synopsis "summary")
(description "summary")
(license license:lgpl2.0))
(and (string=? default-sha256/base32 hash)
(equal? (pypi->guix-package "foo" #:version "1.0.0")
(pypi->guix-package "foo"))
@ -344,22 +343,21 @@ to make sure we're testing wheels"))))
;; computed in the previous test.
(invalidate-memoization! pypi->guix-package)
(match (pypi->guix-package "foo")
(('package
('name "python-foo")
('version "1.0.0")
('source ('origin
('method 'url-fetch)
('uri ('pypi-uri "foo" 'version))
('sha256
('base32
(? string? hash)))))
('build-system 'pyproject-build-system)
('propagated-inputs ('list 'python-bar 'python-baz))
('native-inputs ('list 'python-pytest))
('home-page "http://example.com")
('synopsis "summary")
('description "summary")
('license 'license:lgpl2.0))
(`(package
(name "python-foo")
(version "1.0.0")
(source (origin
(method url-fetch)
(uri (pypi-uri "foo" version))
(sha256
(base32 ,(? string? hash)))))
(build-system pyproject-build-system)
(propagated-inputs (list python-bar python-baz))
(native-inputs (list python-pytest))
(home-page "http://example.com")
(synopsis "summary")
(description "summary")
(license license:lgpl2.0))
(string=? default-sha256/base32 hash))
(x
(pk 'fail x #f))))))
@ -375,20 +373,19 @@ to make sure we're testing wheels"))))
;; value computed in the previous test.
(invalidate-memoization! pypi->guix-package)
(match (pypi->guix-package "foo")
(('package
('name "python-foo")
('version "1.0.0")
('source ('origin
('method 'url-fetch)
('uri ('pypi-uri "foo" 'version))
('sha256
('base32
(? string? hash)))))
('build-system 'pyproject-build-system)
('home-page "http://example.com")
('synopsis "summary")
('description "summary")
('license 'license:lgpl2.0))
(`(package
(name "python-foo")
(version "1.0.0")
(source (origin
(method url-fetch)
(uri (pypi-uri "foo" version))
(sha256
(base32 ,(? string? hash)))))
(build-system pyproject-build-system)
(home-page "http://example.com")
(synopsis "summary")
(description "summary")
(license license:lgpl2.0))
(string=? default-sha256/base32 hash))
(x
(pk 'fail x #f))))))
@ -403,23 +400,22 @@ to make sure we're testing wheels"))))
(display (foo-json #:name "foo-99")
port))))
(match (pypi->guix-package "foo-99")
(('package
('name "python-foo-99")
('version "1.0.0")
('source ('origin
('method 'url-fetch)
('uri ('pypi-uri "foo-99" 'version))
('sha256
('base32
(? string? hash)))))
('properties ('quote (("upstream-name" . "foo-99"))))
('build-system 'pyproject-build-system)
('propagated-inputs ('list 'python-bar 'python-foo))
('native-inputs ('list 'python-pytest))
('home-page "http://example.com")
('synopsis "summary")
('description "summary")
('license 'license:lgpl2.0))
(`(package
(name "python-foo-99")
(version "1.0.0")
(source (origin
(method url-fetch)
(uri (pypi-uri "foo-99" version))
(sha256
(base32 ,(? string? hash)))))
(properties (quote (("upstream-name" . "foo-99"))))
(build-system pyproject-build-system)
(propagated-inputs (list python-bar python-foo))
(native-inputs (list python-pytest))
(home-page "http://example.com")
(synopsis "summary")
(description "summary")
(license license:lgpl2.0))
(string=? default-sha256/base32 hash))
(x
(pk 'fail x #f))))))

View File

@ -174,27 +174,27 @@ completely compatible with Plain TeX.")
#:package-database
(lambda _ %fake-tlpdb))))
(match result
(('package
('inherit ('simple-texlive-package
(`(package
(inherit (simple-texlive-package
"texlive-texsis"
('list "bibtex/bst/texsis/"
"doc/man/man1/"
"doc/otherformats/texsis/base/"
"tex/texsis/base/"
"tex/texsis/config/")
('base32 (? string? hash))
(list "bibtex/bst/texsis/"
"doc/man/man1/"
"doc/otherformats/texsis/base/"
"tex/texsis/base/"
"tex/texsis/config/")
(base32 ,(? string? hash))
#:trivial? #t))
('version . any)
('propagated-inputs
('list 'texlive-cm
'texlive-hyphen-base
'texlive-knuth-lib
'texlive-plain
'texlive-tex))
('home-page (? string?))
('synopsis (? string?))
('description (? string?))
('license 'lppl))
(version ,_)
(propagated-inputs
(list texlive-cm
texlive-hyphen-base
texlive-knuth-lib
texlive-plain
texlive-tex))
(home-page ,(? string?))
(synopsis ,(? string?))
(description ,(? string?))
(license lppl))
#true)
(_
(begin