From 0b131612d5f0387eb68da4ac49a384c57ca78851 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 8 Apr 2015 10:20:25 +0200 Subject: tests: Skip 'guix-package-net.sh' when prerequisites aren't met. * tests/guix-package-net.sh: Reinstate networking and shebang test that inadvertently vanished in commit 57b8623. --- tests/guix-package-net.sh | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests') diff --git a/tests/guix-package-net.sh b/tests/guix-package-net.sh index cedfa3217b..cf3233bee2 100644 --- a/tests/guix-package-net.sh +++ b/tests/guix-package-net.sh @@ -37,6 +37,14 @@ shebang_too_long () -ge 128 } +if ! guile -c '(getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)' 2> /dev/null \ + || shebang_too_long +then + # Skipping. + exit 77 +fi + + profile="t-profile-$$" rm -f "$profile" -- cgit v1.2.3 From b29455cfe7440e08f485eabc7a9335a856cacab8 Mon Sep 17 00:00:00 2001 From: Federico Beffa Date: Sun, 8 Mar 2015 07:48:38 +0100 Subject: import: Add hackage importer. * guix/import/hackage.scm: New file. * tests/hackage.scm: New file. --- tests/hackage.scm | 134 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 tests/hackage.scm (limited to 'tests') diff --git a/tests/hackage.scm b/tests/hackage.scm new file mode 100644 index 0000000000..23b854caa4 --- /dev/null +++ b/tests/hackage.scm @@ -0,0 +1,134 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2015 Federico Beffa +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (test-hackage) + #:use-module (guix import hackage) + #:use-module (guix tests) + #:use-module (srfi srfi-64) + #:use-module (ice-9 match)) + +(define test-cabal-1 + "name: foo +version: 1.0.0 +homepage: http://test.org +synopsis: synopsis +description: description +license: BSD3 +executable cabal + build-depends: + HTTP >= 4000.2.5 && < 4000.3, + mtl >= 2.0 && < 3 +") + +;; Use TABs to indent lines and to separate keys from value. +(define test-cabal-2 + "name: foo +version: 1.0.0 +homepage: http://test.org +synopsis: synopsis +description: description +license: BSD3 +executable cabal + build-depends: HTTP >= 4000.2.5 && < 4000.3, + mtl >= 2.0 && < 3 +") + +;; Use indentation with comma as found, e.g., in 'haddock-api'. +(define test-cabal-3 + "name: foo +version: 1.0.0 +homepage: http://test.org +synopsis: synopsis +description: description +license: BSD3 +executable cabal + build-depends: + HTTP >= 4000.2.5 && < 4000.3 + , mtl >= 2.0 && < 3 +") + +(define test-cond-1 + "(os(darwin) || !(flag(debug))) && flag(cips)") + +(define read-cabal + (@@ (guix import hackage) read-cabal)) + +(define eval-cabal-keywords + (@@ (guix import hackage) eval-cabal-keywords)) + +(define conditional->sexp-like + (@@ (guix import hackage) conditional->sexp-like)) + +(test-begin "hackage") + +(define (eval-test-with-cabal test-cabal) + (mock + ((guix import hackage) hackage-fetch + (lambda (name-version) + (call-with-input-string test-cabal + read-cabal))) + (match (hackage->guix-package "foo") + (('package + ('name "ghc-foo") + ('version "1.0.0") + ('source + ('origin + ('method 'url-fetch) + ('uri ('string-append + "http://hackage.haskell.org/package/foo/foo-" + 'version + ".tar.gz")) + ('sha256 + ('base32 + (? string? hash))))) + ('build-system 'haskell-build-system) + ('inputs + ('quasiquote + (("ghc-http" ('unquote 'ghc-http)) + ("ghc-mtl" ('unquote 'ghc-mtl))))) + ('home-page "http://test.org") + ('synopsis (? string?)) + ('description (? string?)) + ('license 'bsd-3)) + #t) + (x + (pk 'fail x #f))))) + +(test-assert "hackage->guix-package test 1" + (eval-test-with-cabal test-cabal-1)) + +(test-assert "hackage->guix-package test 2" + (eval-test-with-cabal test-cabal-2)) + +(test-assert "hackage->guix-package test 3" + (eval-test-with-cabal test-cabal-3)) + +(test-assert "conditional->sexp-like" + (match + (eval-cabal-keywords + (conditional->sexp-like test-cond-1) + '(("debug" . "False"))) + (('and ('or ('string-match "darwin" ('%current-system)) ('not '#f)) '#t) + #t) + (x + (pk 'fail x #f)))) + +(test-end "hackage") + + +(exit (= (test-runner-fail-count (test-runner-current)) 0)) -- cgit v1.2.3 From 042bc828fcd2dc7bbacbe6ef0408722a3d51a684 Mon Sep 17 00:00:00 2001 From: Federico Beffa Date: Sat, 4 Apr 2015 22:51:13 +0200 Subject: profiles: Generate GHC's package database cache. * guix/profiles.scm (ghc-package-cache-file): New procedure. (profile-derivation): Add 'ghc-package-cache?' keyword argument. If true (the default), add the result of 'ghc-package-cache-file' to 'inputs'. * guix/scripts/package.scm (guix-package)[process-actions]: Pass #:ghc-package-cache? to 'profile-generation'. * tests/packages.scm ("--search-paths with pattern"): Likewise. * tests/profiles.scm ("profile-derivation"): Likewise. --- tests/packages.scm | 1 + tests/profiles.scm | 2 ++ 2 files changed, 3 insertions(+) (limited to 'tests') diff --git a/tests/packages.scm b/tests/packages.scm index c9dd5d859a..4e3a116cb8 100644 --- a/tests/packages.scm +++ b/tests/packages.scm @@ -600,6 +600,7 @@ (manifest (map package->manifest-entry (list p1 p2))) #:info-dir? #f + #:ghc-package-cache? #f #:ca-certificate-bundle? #f) #:guile-for-build (%guile-for-build)))) (build-derivations %store (list prof)) diff --git a/tests/profiles.scm b/tests/profiles.scm index 7b942e35b0..d20cb9d808 100644 --- a/tests/profiles.scm +++ b/tests/profiles.scm @@ -184,6 +184,7 @@ (guile (package->derivation %bootstrap-guile)) (drv (profile-derivation (manifest (list entry)) #:info-dir? #f + #:ghc-package-cache? #f #:ca-certificate-bundle? #f)) (profile -> (derivation->output-path drv)) (bindir -> (string-append profile "/bin")) @@ -197,6 +198,7 @@ ((entry -> (package->manifest-entry packages:glibc "debug")) (drv (profile-derivation (manifest (list entry)) #:info-dir? #f + #:ghc-package-cache? #f #:ca-certificate-bundle? #f))) (return (derivation-inputs drv)))) -- cgit v1.2.3