aboutsummaryrefslogtreecommitdiff
path: root/tests/guix-build.sh
diff options
context:
space:
mode:
authorEric Bavier <bavier@member.fsf.org>2015-01-28 13:33:28 -0600
committerEric Bavier <bavier@member.fsf.org>2015-05-02 23:15:40 -0500
commit2cdfe13deaf3d959e1ecb3a207cdbc28985e0e79 (patch)
tree3c716eba667051f5ccb9f11f9e4b520bf9a8fe6a /tests/guix-build.sh
parentf77bcbc374bb94272c57508dc04fb8599b56a9d8 (diff)
downloadpatches-2cdfe13deaf3d959e1ecb3a207cdbc28985e0e79.tar
patches-2cdfe13deaf3d959e1ecb3a207cdbc28985e0e79.tar.gz
guix: build: Add transitive source building.
* guix/scripts/build.scm (%options, options->derivations): Add --sources option. * doc/guix.texi (Invoking guix build): Document --sources option. * tests/guix-build.sh: Add tests.
Diffstat (limited to 'tests/guix-build.sh')
-rw-r--r--tests/guix-build.sh82
1 files changed, 82 insertions, 0 deletions
diff --git a/tests/guix-build.sh b/tests/guix-build.sh
index 836c45e776..a72ce0911d 100644
--- a/tests/guix-build.sh
+++ b/tests/guix-build.sh
@@ -36,6 +36,88 @@ guix build -e '(@@ (gnu packages bootstrap) %bootstrap-guile)' | \
guix build hello -d | \
grep -e '-hello-[0-9\.]\+\.drv$'
+# Check --sources option with its arguments
+module_dir="t-guix-build-$$"
+mkdir "$module_dir"
+trap "rm -rf $module_dir" EXIT
+
+cat > "$module_dir/foo.scm"<<EOF
+(define-module (foo)
+ #:use-module (guix packages)
+ #:use-module (guix download)
+ #:use-module (guix build-system trivial))
+
+(define-public foo
+ (package
+ (name "foo")
+ (version "42")
+ (source (origin
+ (method url-fetch)
+ (uri "http://www.example.com/foo.tar.gz")
+ (sha256
+ (base32
+ "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"))))
+ (build-system trivial-build-system)
+ (inputs
+ (quasiquote (("bar" ,bar))))
+ (home-page "www.example.com")
+ (synopsis "Dummy package")
+ (description "foo is a dummy package for testing.")
+ (license #f)))
+
+(define-public bar
+ (package
+ (name "bar")
+ (version "9001")
+ (source (origin
+ (method url-fetch)
+ (uri "http://www.example.com/bar.tar.gz")
+ (sha256
+ (base32
+ "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"))))
+ (build-system trivial-build-system)
+ (inputs
+ (quasiquote
+ (("data" ,(origin
+ (method url-fetch)
+ (uri "http://www.example.com/bar.dat")
+ (sha256
+ (base32
+ "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz")))))))
+ (home-page "www.example.com")
+ (synopsis "Dummy package")
+ (description "bar is a dummy package for testing.")
+ (license #f)))
+EOF
+
+GUIX_PACKAGE_PATH="$module_dir"
+export GUIX_PACKAGE_PATH
+
+# foo.tar.gz
+guix build -d -S foo
+guix build -d -S foo | grep -e 'foo\.tar\.gz'
+
+guix build -d --sources=package foo
+guix build -d --sources=package foo | grep -e 'foo\.tar\.gz'
+
+# bar.tar.gz and bar.dat
+guix build -d --sources bar
+test `guix build -d --sources bar \
+ | grep -e 'bar\.tar\.gz' -e 'bar\.dat' \
+ | wc -l` -eq 2
+
+# bar.tar.gz and bar.dat
+guix build -d --sources=all bar
+test `guix build -d --sources bar \
+ | grep -e 'bar\.tar\.gz' -e 'bar\.dat' \
+ | wc -l` -eq 2
+
+# Should include foo.tar.gz, bar.tar.gz, and bar.dat
+guix build -d --sources=transitive foo
+test `guix build -d --sources=transitive foo \
+ | grep -e 'foo\.tar\.gz' -e 'bar\.tar\.gz' -e 'bar\.dat' \
+ | wc -l` -eq 3
+
# Should all return valid log files.
drv="`guix build -d -e '(@@ (gnu packages bootstrap) %bootstrap-guile)'`"
out="`guix build -e '(@@ (gnu packages bootstrap) %bootstrap-guile)'`"