From 4c0c4db0702048488a9712dbba7cad862c667d54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 15 Mar 2017 21:54:34 +0100 Subject: utils: Move base16 procedures to (guix base16). * guix/utils.scm (bytevector->base16-string, base16-string->bytevector): Move to... * guix/base16.scm: ... here. New file. * tests/utils.scm ("bytevector->base16-string->bytevector"): Move to... * tests/base16.scm: ... here. New file. * Makefile.am (MODULES): Add guix/base16.scm. (SCM_TESTS): Add tests/base16.scm. * build-aux/download.scm, guix/derivations.scm, guix/docker.scm, guix/import/snix.scm, guix/pk-crypto.scm, guix/scripts/authenticate.scm, guix/scripts/download.scm, guix/scripts/hash.scm, guix/store.scm, tests/hash.scm, tests/pk-crypto.scm: Adjust imports accordingly. --- tests/base16.scm | 34 ++++++++++++++++++++++++++++++++++ tests/hash.scm | 2 +- tests/pk-crypto.scm | 3 ++- tests/utils.scm | 9 +-------- 4 files changed, 38 insertions(+), 10 deletions(-) create mode 100644 tests/base16.scm (limited to 'tests') diff --git a/tests/base16.scm b/tests/base16.scm new file mode 100644 index 0000000000..a64b650bec --- /dev/null +++ b/tests/base16.scm @@ -0,0 +1,34 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2012, 2017 Ludovic Courtès +;;; +;;; 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-base16) + #:use-module (guix base16) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-64) + #:use-module (rnrs bytevectors)) + +(test-begin "base16") + +(test-assert "bytevector->base16-string->bytevector" + (every (lambda (bv) + (equal? (base16-string->bytevector + (bytevector->base16-string bv)) + bv)) + (map string->utf8 '("" "f" "fo" "foo" "foob" "fooba" "foobar")))) + +(test-end "base16") diff --git a/tests/hash.scm b/tests/hash.scm index 86501dca2d..b189e435c8 100644 --- a/tests/hash.scm +++ b/tests/hash.scm @@ -18,7 +18,7 @@ (define-module (test-hash) #:use-module (guix hash) - #:use-module (guix utils) + #:use-module (guix base16) #:use-module (srfi srfi-1) #:use-module (srfi srfi-11) #:use-module (srfi srfi-64) diff --git a/tests/pk-crypto.scm b/tests/pk-crypto.scm index 5024a15a43..fe33a6f7b5 100644 --- a/tests/pk-crypto.scm +++ b/tests/pk-crypto.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013, 2014 Ludovic Courtès +;;; Copyright © 2013, 2014, 2017 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -19,6 +19,7 @@ (define-module (test-pk-crypto) #:use-module (guix pk-crypto) #:use-module (guix utils) + #:use-module (guix base16) #:use-module (guix hash) #:use-module (srfi srfi-1) #:use-module (srfi srfi-11) diff --git a/tests/utils.scm b/tests/utils.scm index bcfaa14faa..035886dd16 100644 --- a/tests/utils.scm +++ b/tests/utils.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012, 2013, 2014, 2015, 2016 Ludovic Courtès +;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017 Ludovic Courtès ;;; Copyright © 2014 Eric Bavier ;;; Copyright © 2016 Mathieu Lirzin ;;; @@ -36,13 +36,6 @@ (test-begin "utils") -(test-assert "bytevector->base16-string->bytevector" - (every (lambda (bv) - (equal? (base16-string->bytevector - (bytevector->base16-string bv)) - bv)) - (map string->utf8 '("" "f" "fo" "foo" "foob" "fooba" "foobar")))) - (test-assert "gnu-triplet->nix-system" (let ((samples '(("i586-gnu0.3" "i686-gnu") ("x86_64-unknown-linux-gnu" "x86_64-linux") -- cgit v1.2.3 From d938a58beefc669ab340aa1aeab49df3dc24d123 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 15 Mar 2017 22:14:36 +0100 Subject: gexp: Add '=>' syntax to import computed modules. * guix/gexp.scm (imported-files)[file-pair]: Add case for pairs where the cdr is not a string. (imported-modules): Support '=>' syntax in MODULES. * tests/gexp.scm ("imported-files with file-like objects") ("gexp->derivation & with-imported-module & computed module"): New tests. * doc/guix.texi (G-Expressions): Document '=>' syntax for 'with-imported-modules'. --- tests/gexp.scm | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'tests') diff --git a/tests/gexp.scm b/tests/gexp.scm index baf78837ae..b3f7323984 100644 --- a/tests/gexp.scm +++ b/tests/gexp.scm @@ -598,6 +598,23 @@ get-bytevector-all)))) files)))))) +(test-assertm "imported-files with file-like objects" + (mlet* %store-monad ((plain -> (plain-file "foo" "bar!")) + (q-scm -> (search-path %load-path "ice-9/q.scm")) + (files -> `(("a/b/c" . ,q-scm) + ("p/q" . ,plain))) + (drv (imported-files files))) + (mbegin %store-monad + (built-derivations (list drv)) + (mlet %store-monad ((dir -> (derivation->output-path drv)) + (plain* (text-file "foo" "bar!")) + (q-scm* (interned-file q-scm "c"))) + (return + (and (string=? (readlink (string-append dir "/a/b/c")) + q-scm*) + (string=? (readlink (string-append dir "/p/q")) + plain*))))))) + (test-equal "gexp-modules & ungexp" '((bar) (foo)) ((@@ (guix gexp) gexp-modules) @@ -668,6 +685,28 @@ (equal? '(chdir "/foo") (call-with-input-file b read)))))))) +(test-assertm "gexp->derivation & with-imported-module & computed module" + (mlet* %store-monad + ((module -> (scheme-file "x" #~(begin + (define-module (foo bar) + #:export (the-answer)) + + (define the-answer 42)))) + (build -> (with-imported-modules `(((foo bar) => ,module) + (guix build utils)) + #~(begin + (use-modules (guix build utils) + (foo bar)) + mkdir-p + (call-with-output-file #$output + (lambda (port) + (write the-answer port)))))) + (drv (gexp->derivation "thing" build)) + (out -> (derivation->output-path drv))) + (mbegin %store-monad + (built-derivations (list drv)) + (return (= 42 (call-with-input-file out read)))))) + (test-assertm "gexp->derivation #:references-graphs" (mlet* %store-monad ((one (text-file "one" (random-text))) -- cgit v1.2.3 From 48b444304e206c35cf2c8e0d87a4711f1aac4fd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Fri, 17 Mar 2017 17:37:00 +0100 Subject: pack: Move absolute file name to . * guix/scripts/pack.scm ()[package]: Remove. [command]: Document as being a gexp with an absolute file name. (%compressors): Adjust accordingly. (self-contained-tarball): Simplify PATH expression. Move 'string-join' for the compressor command on the build side. (docker-image): Simplify PATH expression. * tests/pack.scm (%gzip-compressor): Adjust accordingly. --- tests/pack.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/pack.scm b/tests/pack.scm index de9ef8e6ab..eb643c3229 100644 --- a/tests/pack.scm +++ b/tests/pack.scm @@ -42,7 +42,8 @@ (define %gzip-compressor ;; Compressor that uses the bootstrap 'gzip'. ((@ (guix scripts pack) compressor) "gzip" - %bootstrap-coreutils&co "gz" '("gzip" "-6n"))) + "gz" + #~(#+(file-append %bootstrap-coreutils&co "/bin/gzip") "-6n"))) (define %tar-bootstrap %bootstrap-coreutils&co) -- cgit v1.2.3 From 176febe3776b272dffbe757414225702d08c3bdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Fri, 17 Mar 2017 21:48:40 +0100 Subject: profiles: Packages in a profile can be cross-compiled. * guix/profiles.scm (profile-derivation): Add #:target parameter; pass it to 'gexp->derivation'. * tests/profiles.scm ("profile-derivation, cross-compilation"): New test. --- tests/profiles.scm | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/profiles.scm b/tests/profiles.scm index 5536364889..d0b1e14a86 100644 --- a/tests/profiles.scm +++ b/tests/profiles.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013, 2014, 2015, 2016 Ludovic Courtès +;;; Copyright © 2013, 2014, 2015, 2016, 2017 Ludovic Courtès ;;; Copyright © 2014 Alex Kost ;;; ;;; This file is part of GNU Guix. @@ -212,6 +212,35 @@ #:locales? #f))) (return (derivation-inputs drv)))) +(test-assertm "profile-derivation, cross-compilation" + (mlet* %store-monad + ((manifest -> (packages->manifest (list packages:sed packages:grep))) + (target -> "arm-linux-gnueabihf") + (grep (package->cross-derivation packages:grep target)) + (sed (package->cross-derivation packages:sed target)) + (locales (package->derivation packages:glibc-utf8-locales)) + (drv (profile-derivation manifest + #:hooks '() + #:locales? #t + #:target target))) + (define (find-input name) + (let ((name (string-append name ".drv"))) + (any (lambda (input) + (let ((input (derivation-input-path input))) + (and (string-suffix? name input) input))) + (derivation-inputs drv)))) + + ;; The inputs for grep and sed should be cross-build derivations, but that + ;; for the glibc-utf8-locales should be a native build. + (return (and (string=? (derivation-system drv) (%current-system)) + (string=? (find-input (package-full-name packages:grep)) + (derivation-file-name grep)) + (string=? (find-input (package-full-name packages:sed)) + (derivation-file-name sed)) + (string=? (find-input + (package-full-name packages:glibc-utf8-locales)) + (derivation-file-name locales)))))) + (test-assert "package->manifest-entry defaults to \"out\"" (let ((outputs (package-outputs packages:glibc))) (equal? (manifest-entry-output -- cgit v1.2.3 From 36626c556ed75219bce196ac93d148f6b9af984c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Fri, 17 Mar 2017 23:07:01 +0100 Subject: build: Require Guile >= 2.0.9. * configure.ac: Bump requirement to 2.0.9. * doc/guix.texi (Requirements): Adjust accordingly. * README (Requirements): Likewise. * build-aux/download.scm: Remove workaround for . * guix/build/download.scm: Likewise. (http-fetch)[post-2.0.7?]: Remove. Remove conditional code for not POST-2.0.7?. * guix/http-client.scm: Remove workaround for . (http-fetch)[post-2.0.7?]: Remove. Remove conditional code for not POST-2.0.7?. * guix/serialization.scm (read-latin1-string): Remove mention of 2.0.9. * tests/nar.scm: Use (ice-9 control). (let/ec): Remove. --- tests/nar.scm | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'tests') diff --git a/tests/nar.scm b/tests/nar.scm index 28ead8b783..61646db964 100644 --- a/tests/nar.scm +++ b/tests/nar.scm @@ -35,6 +35,7 @@ #:use-module (srfi srfi-64) #:use-module (ice-9 ftw) #:use-module (ice-9 regex) + #:use-module ((ice-9 control) #:select (let/ec)) #:use-module (ice-9 match)) ;; Test the (guix nar) module. @@ -148,17 +149,6 @@ (string-append (dirname (search-path %load-path "pre-inst-env")) "/test-nar-" (number->string (getpid)))) -(define-syntax-rule (let/ec k exp...) - ;; This one appeared in Guile 2.0.9, so provide a copy here. - (let ((tag (make-prompt-tag))) - (call-with-prompt tag - (lambda () - (let ((k (lambda args - (apply abort-to-prompt tag args)))) - exp...)) - (lambda (_ . args) - (apply values args))))) - (test-begin "nar") -- cgit v1.2.3 From f6396d862f9f8ce0c0e6894ce30599773167af0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sun, 19 Mar 2017 17:30:44 +0100 Subject: gnu: Rename "guile-next" to "guile". * gnu/packages/guile.scm (guile-next): Rename to... (guile-2.2): ... this. Update users. [name]: Change to "guile". [synopsis]: Remove. [properties]: Remove 'upstream-name', 'ftp-server', and 'ftp-directory'. * gnu/packages/bioinformatics.scm (rcas-web): Update accordingly. * gnu/packages/tls.scm (gnutls/guile-2.2): Likewise. * tests/guix-build.sh: Use 'guile@2.2' instead of 'guile-next'. * doc/guix.texi (Package Transformation Options): Update examples that referred to "guile-next". --- tests/guix-build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/guix-build.sh b/tests/guix-build.sh index e1ec560641..ab911b7210 100644 --- a/tests/guix-build.sh +++ b/tests/guix-build.sh @@ -1,5 +1,5 @@ # GNU Guix --- Functional package management for GNU -# Copyright © 2012, 2013, 2014, 2016 Ludovic Courtès +# Copyright © 2012, 2013, 2014, 2016, 2017 Ludovic Courtès # # This file is part of GNU Guix. # @@ -160,7 +160,7 @@ rm -f "$result" guix build coreutils --target=mips64el-linux-gnu --dry-run --no-substitutes # Replacements. -drv1=`guix build guix --with-input=guile=guile-next -d` +drv1=`guix build guix --with-input=guile@2.0=guile@2.2 -d` drv2=`guix build guix -d` test "$drv1" != "$drv2" -- cgit v1.2.3