2013-01-06 00:47:50 +01:00
|
|
|
# GNU Guix --- Functional package management for GNU
|
2014-04-27 23:19:11 +02:00
|
|
|
# Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org>
|
2012-10-31 23:27:51 +01:00
|
|
|
#
|
2013-01-06 00:47:50 +01:00
|
|
|
# This file is part of GNU Guix.
|
2012-10-31 23:27:51 +01:00
|
|
|
#
|
2013-01-06 00:47:50 +01:00
|
|
|
# GNU Guix is free software; you can redistribute it and/or modify it
|
2012-10-31 23:27:51 +01:00
|
|
|
# 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.
|
|
|
|
#
|
2013-01-06 00:47:50 +01:00
|
|
|
# GNU Guix is distributed in the hope that it will be useful, but
|
2012-10-31 23:27:51 +01:00
|
|
|
# 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
|
2013-01-06 00:47:50 +01:00
|
|
|
# along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
|
2012-10-31 23:27:51 +01:00
|
|
|
|
|
|
|
#
|
Replace individual scripts with master 'guix' script.
* scripts/guix.in: New script.
* Makefile.am (bin_SCRIPTS): Add 'scripts/guix'. Remove 'guix-build',
'guix-download', 'guix-import', 'guix-package', and 'guix-gc'.
(MODULES): Add 'guix/scripts/build.scm', 'guix/scripts/download.scm',
'guix/scripts/import.scm', 'guix/scripts/package.scm', and
'guix/scripts/gc.scm'.
* configure.ac (AC_CONFIG_FILES): Add 'scripts/guix'. Remove 'guix-build',
'guix-download', 'guix-import', 'guix-package', and 'guix-gc'.
* guix-build.in, guix-download.in, guix-gc.in, guix-import.in,
guix-package.in: Remove shell script boilerplate. Move to guix-COMMAND.in
to guix/scripts/COMMAND.scm. Rename module from (guix-COMMAND) to
(guix scripts COMMAND). Change "guix-COMMAND" to "guix COMMAND" in
usage help string.
* pre-inst-env.in: Add "@abs_top_builddir@/scripts" to the front of $PATH.
Export $GUIX_UNINSTALLED.
* tests/guix-build.sh, tests/guix-daemon.sh, tests/guix-download.sh,
tests/guix-gc.sh, tests/guix-package.sh: Use "guix COMMAND" instead of
"guix-COMMAND".
* doc/guix.texi: Replace all occurrences of "guix-COMMAND" with
"guix COMMAND".
* po/POTFILES.in: Update.
2013-02-14 10:15:25 +01:00
|
|
|
# Test the `guix build' command-line utility.
|
2012-10-31 23:27:51 +01:00
|
|
|
#
|
|
|
|
|
Replace individual scripts with master 'guix' script.
* scripts/guix.in: New script.
* Makefile.am (bin_SCRIPTS): Add 'scripts/guix'. Remove 'guix-build',
'guix-download', 'guix-import', 'guix-package', and 'guix-gc'.
(MODULES): Add 'guix/scripts/build.scm', 'guix/scripts/download.scm',
'guix/scripts/import.scm', 'guix/scripts/package.scm', and
'guix/scripts/gc.scm'.
* configure.ac (AC_CONFIG_FILES): Add 'scripts/guix'. Remove 'guix-build',
'guix-download', 'guix-import', 'guix-package', and 'guix-gc'.
* guix-build.in, guix-download.in, guix-gc.in, guix-import.in,
guix-package.in: Remove shell script boilerplate. Move to guix-COMMAND.in
to guix/scripts/COMMAND.scm. Rename module from (guix-COMMAND) to
(guix scripts COMMAND). Change "guix-COMMAND" to "guix COMMAND" in
usage help string.
* pre-inst-env.in: Add "@abs_top_builddir@/scripts" to the front of $PATH.
Export $GUIX_UNINSTALLED.
* tests/guix-build.sh, tests/guix-daemon.sh, tests/guix-download.sh,
tests/guix-gc.sh, tests/guix-package.sh: Use "guix COMMAND" instead of
"guix-COMMAND".
* doc/guix.texi: Replace all occurrences of "guix-COMMAND" with
"guix COMMAND".
* po/POTFILES.in: Update.
2013-02-14 10:15:25 +01:00
|
|
|
guix build --version
|
2012-10-31 23:27:51 +01:00
|
|
|
|
|
|
|
# Should fail.
|
Replace individual scripts with master 'guix' script.
* scripts/guix.in: New script.
* Makefile.am (bin_SCRIPTS): Add 'scripts/guix'. Remove 'guix-build',
'guix-download', 'guix-import', 'guix-package', and 'guix-gc'.
(MODULES): Add 'guix/scripts/build.scm', 'guix/scripts/download.scm',
'guix/scripts/import.scm', 'guix/scripts/package.scm', and
'guix/scripts/gc.scm'.
* configure.ac (AC_CONFIG_FILES): Add 'scripts/guix'. Remove 'guix-build',
'guix-download', 'guix-import', 'guix-package', and 'guix-gc'.
* guix-build.in, guix-download.in, guix-gc.in, guix-import.in,
guix-package.in: Remove shell script boilerplate. Move to guix-COMMAND.in
to guix/scripts/COMMAND.scm. Rename module from (guix-COMMAND) to
(guix scripts COMMAND). Change "guix-COMMAND" to "guix COMMAND" in
usage help string.
* pre-inst-env.in: Add "@abs_top_builddir@/scripts" to the front of $PATH.
Export $GUIX_UNINSTALLED.
* tests/guix-build.sh, tests/guix-daemon.sh, tests/guix-download.sh,
tests/guix-gc.sh, tests/guix-package.sh: Use "guix COMMAND" instead of
"guix-COMMAND".
* doc/guix.texi: Replace all occurrences of "guix-COMMAND" with
"guix COMMAND".
* po/POTFILES.in: Update.
2013-02-14 10:15:25 +01:00
|
|
|
if guix build -e +;
|
2012-11-07 23:41:59 +01:00
|
|
|
then false; else true; fi
|
|
|
|
|
|
|
|
# Should fail because this is a source-less package.
|
Replace individual scripts with master 'guix' script.
* scripts/guix.in: New script.
* Makefile.am (bin_SCRIPTS): Add 'scripts/guix'. Remove 'guix-build',
'guix-download', 'guix-import', 'guix-package', and 'guix-gc'.
(MODULES): Add 'guix/scripts/build.scm', 'guix/scripts/download.scm',
'guix/scripts/import.scm', 'guix/scripts/package.scm', and
'guix/scripts/gc.scm'.
* configure.ac (AC_CONFIG_FILES): Add 'scripts/guix'. Remove 'guix-build',
'guix-download', 'guix-import', 'guix-package', and 'guix-gc'.
* guix-build.in, guix-download.in, guix-gc.in, guix-import.in,
guix-package.in: Remove shell script boilerplate. Move to guix-COMMAND.in
to guix/scripts/COMMAND.scm. Rename module from (guix-COMMAND) to
(guix scripts COMMAND). Change "guix-COMMAND" to "guix COMMAND" in
usage help string.
* pre-inst-env.in: Add "@abs_top_builddir@/scripts" to the front of $PATH.
Export $GUIX_UNINSTALLED.
* tests/guix-build.sh, tests/guix-daemon.sh, tests/guix-download.sh,
tests/guix-gc.sh, tests/guix-package.sh: Use "guix COMMAND" instead of
"guix-COMMAND".
* doc/guix.texi: Replace all occurrences of "guix-COMMAND" with
"guix COMMAND".
* po/POTFILES.in: Update.
2013-02-14 10:15:25 +01:00
|
|
|
if guix build -e '(@ (gnu packages bootstrap) %bootstrap-glibc)' -S
|
2012-11-07 23:41:59 +01:00
|
|
|
then false; else true; fi
|
2012-10-31 23:27:51 +01:00
|
|
|
|
|
|
|
# Should pass.
|
2014-08-27 00:26:47 +02:00
|
|
|
guix build -e '(@@ (gnu packages bootstrap) %bootstrap-guile)' | \
|
2012-10-31 23:27:51 +01:00
|
|
|
grep -e '-guile-'
|
Replace individual scripts with master 'guix' script.
* scripts/guix.in: New script.
* Makefile.am (bin_SCRIPTS): Add 'scripts/guix'. Remove 'guix-build',
'guix-download', 'guix-import', 'guix-package', and 'guix-gc'.
(MODULES): Add 'guix/scripts/build.scm', 'guix/scripts/download.scm',
'guix/scripts/import.scm', 'guix/scripts/package.scm', and
'guix/scripts/gc.scm'.
* configure.ac (AC_CONFIG_FILES): Add 'scripts/guix'. Remove 'guix-build',
'guix-download', 'guix-import', 'guix-package', and 'guix-gc'.
* guix-build.in, guix-download.in, guix-gc.in, guix-import.in,
guix-package.in: Remove shell script boilerplate. Move to guix-COMMAND.in
to guix/scripts/COMMAND.scm. Rename module from (guix-COMMAND) to
(guix scripts COMMAND). Change "guix-COMMAND" to "guix COMMAND" in
usage help string.
* pre-inst-env.in: Add "@abs_top_builddir@/scripts" to the front of $PATH.
Export $GUIX_UNINSTALLED.
* tests/guix-build.sh, tests/guix-daemon.sh, tests/guix-download.sh,
tests/guix-gc.sh, tests/guix-package.sh: Use "guix COMMAND" instead of
"guix-COMMAND".
* doc/guix.texi: Replace all occurrences of "guix-COMMAND" with
"guix COMMAND".
* po/POTFILES.in: Update.
2013-02-14 10:15:25 +01:00
|
|
|
guix build hello -d | \
|
2012-10-31 23:27:51 +01:00
|
|
|
grep -e '-hello-[0-9\.]\+\.drv$'
|
|
|
|
|
2015-01-28 20:33:28 +01:00
|
|
|
# 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
|
|
|
|
|
2013-11-12 01:06:25 +01:00
|
|
|
# Should all return valid log files.
|
2014-08-27 00:26:47 +02:00
|
|
|
drv="`guix build -d -e '(@@ (gnu packages bootstrap) %bootstrap-guile)'`"
|
|
|
|
out="`guix build -e '(@@ (gnu packages bootstrap) %bootstrap-guile)'`"
|
2013-11-12 01:06:25 +01:00
|
|
|
log="`guix build --log-file $drv`"
|
|
|
|
echo "$log" | grep log/.*guile.*drv
|
|
|
|
test -f "$log"
|
2014-08-27 00:26:47 +02:00
|
|
|
test "`guix build -e '(@@ (gnu packages bootstrap) %bootstrap-guile)' --log-file`" \
|
2013-11-12 01:06:25 +01:00
|
|
|
= "$log"
|
|
|
|
test "`guix build --log-file guile-bootstrap`" = "$log"
|
|
|
|
test "`guix build --log-file $out`" = "$log"
|
|
|
|
|
2012-10-31 23:27:51 +01:00
|
|
|
# Should fail because the name/version combination could not be found.
|
Replace individual scripts with master 'guix' script.
* scripts/guix.in: New script.
* Makefile.am (bin_SCRIPTS): Add 'scripts/guix'. Remove 'guix-build',
'guix-download', 'guix-import', 'guix-package', and 'guix-gc'.
(MODULES): Add 'guix/scripts/build.scm', 'guix/scripts/download.scm',
'guix/scripts/import.scm', 'guix/scripts/package.scm', and
'guix/scripts/gc.scm'.
* configure.ac (AC_CONFIG_FILES): Add 'scripts/guix'. Remove 'guix-build',
'guix-download', 'guix-import', 'guix-package', and 'guix-gc'.
* guix-build.in, guix-download.in, guix-gc.in, guix-import.in,
guix-package.in: Remove shell script boilerplate. Move to guix-COMMAND.in
to guix/scripts/COMMAND.scm. Rename module from (guix-COMMAND) to
(guix scripts COMMAND). Change "guix-COMMAND" to "guix COMMAND" in
usage help string.
* pre-inst-env.in: Add "@abs_top_builddir@/scripts" to the front of $PATH.
Export $GUIX_UNINSTALLED.
* tests/guix-build.sh, tests/guix-daemon.sh, tests/guix-download.sh,
tests/guix-gc.sh, tests/guix-package.sh: Use "guix COMMAND" instead of
"guix-COMMAND".
* doc/guix.texi: Replace all occurrences of "guix-COMMAND" with
"guix COMMAND".
* po/POTFILES.in: Update.
2013-02-14 10:15:25 +01:00
|
|
|
if guix build hello-0.0.1 -n; then false; else true; fi
|
2012-10-31 23:27:51 +01:00
|
|
|
|
|
|
|
# Keep a symlink to the result, registered as a root.
|
|
|
|
result="t-result-$$"
|
Replace individual scripts with master 'guix' script.
* scripts/guix.in: New script.
* Makefile.am (bin_SCRIPTS): Add 'scripts/guix'. Remove 'guix-build',
'guix-download', 'guix-import', 'guix-package', and 'guix-gc'.
(MODULES): Add 'guix/scripts/build.scm', 'guix/scripts/download.scm',
'guix/scripts/import.scm', 'guix/scripts/package.scm', and
'guix/scripts/gc.scm'.
* configure.ac (AC_CONFIG_FILES): Add 'scripts/guix'. Remove 'guix-build',
'guix-download', 'guix-import', 'guix-package', and 'guix-gc'.
* guix-build.in, guix-download.in, guix-gc.in, guix-import.in,
guix-package.in: Remove shell script boilerplate. Move to guix-COMMAND.in
to guix/scripts/COMMAND.scm. Rename module from (guix-COMMAND) to
(guix scripts COMMAND). Change "guix-COMMAND" to "guix COMMAND" in
usage help string.
* pre-inst-env.in: Add "@abs_top_builddir@/scripts" to the front of $PATH.
Export $GUIX_UNINSTALLED.
* tests/guix-build.sh, tests/guix-daemon.sh, tests/guix-download.sh,
tests/guix-gc.sh, tests/guix-package.sh: Use "guix COMMAND" instead of
"guix-COMMAND".
* doc/guix.texi: Replace all occurrences of "guix-COMMAND" with
"guix COMMAND".
* po/POTFILES.in: Update.
2013-02-14 10:15:25 +01:00
|
|
|
guix build -r "$result" \
|
2014-08-27 00:26:47 +02:00
|
|
|
-e '(@@ (gnu packages bootstrap) %bootstrap-guile)'
|
2012-10-31 23:27:51 +01:00
|
|
|
test -x "$result/bin/guile"
|
|
|
|
|
|
|
|
# Should fail, because $result already exists.
|
2014-08-27 00:26:47 +02:00
|
|
|
if guix build -r "$result" -e '(@@ (gnu packages bootstrap) %bootstrap-guile)'
|
2012-10-31 23:27:51 +01:00
|
|
|
then false; else true; fi
|
|
|
|
|
|
|
|
rm -f "$result"
|
2013-01-22 22:13:10 +01:00
|
|
|
|
2013-05-24 22:52:52 +02:00
|
|
|
# Cross building.
|
|
|
|
guix build coreutils --target=mips64el-linux-gnu --dry-run --no-substitutes
|
|
|
|
|
2013-01-22 22:13:10 +01:00
|
|
|
# Parsing package names and versions.
|
Replace individual scripts with master 'guix' script.
* scripts/guix.in: New script.
* Makefile.am (bin_SCRIPTS): Add 'scripts/guix'. Remove 'guix-build',
'guix-download', 'guix-import', 'guix-package', and 'guix-gc'.
(MODULES): Add 'guix/scripts/build.scm', 'guix/scripts/download.scm',
'guix/scripts/import.scm', 'guix/scripts/package.scm', and
'guix/scripts/gc.scm'.
* configure.ac (AC_CONFIG_FILES): Add 'scripts/guix'. Remove 'guix-build',
'guix-download', 'guix-import', 'guix-package', and 'guix-gc'.
* guix-build.in, guix-download.in, guix-gc.in, guix-import.in,
guix-package.in: Remove shell script boilerplate. Move to guix-COMMAND.in
to guix/scripts/COMMAND.scm. Rename module from (guix-COMMAND) to
(guix scripts COMMAND). Change "guix-COMMAND" to "guix COMMAND" in
usage help string.
* pre-inst-env.in: Add "@abs_top_builddir@/scripts" to the front of $PATH.
Export $GUIX_UNINSTALLED.
* tests/guix-build.sh, tests/guix-daemon.sh, tests/guix-download.sh,
tests/guix-gc.sh, tests/guix-package.sh: Use "guix COMMAND" instead of
"guix-COMMAND".
* doc/guix.texi: Replace all occurrences of "guix-COMMAND" with
"guix COMMAND".
* po/POTFILES.in: Update.
2013-02-14 10:15:25 +01:00
|
|
|
guix build -n time # PASS
|
|
|
|
guix build -n time-1.7 # PASS, version found
|
|
|
|
if guix build -n time-3.2; # FAIL, version not found
|
2013-01-22 22:13:10 +01:00
|
|
|
then false; else true; fi
|
Replace individual scripts with master 'guix' script.
* scripts/guix.in: New script.
* Makefile.am (bin_SCRIPTS): Add 'scripts/guix'. Remove 'guix-build',
'guix-download', 'guix-import', 'guix-package', and 'guix-gc'.
(MODULES): Add 'guix/scripts/build.scm', 'guix/scripts/download.scm',
'guix/scripts/import.scm', 'guix/scripts/package.scm', and
'guix/scripts/gc.scm'.
* configure.ac (AC_CONFIG_FILES): Add 'scripts/guix'. Remove 'guix-build',
'guix-download', 'guix-import', 'guix-package', and 'guix-gc'.
* guix-build.in, guix-download.in, guix-gc.in, guix-import.in,
guix-package.in: Remove shell script boilerplate. Move to guix-COMMAND.in
to guix/scripts/COMMAND.scm. Rename module from (guix-COMMAND) to
(guix scripts COMMAND). Change "guix-COMMAND" to "guix COMMAND" in
usage help string.
* pre-inst-env.in: Add "@abs_top_builddir@/scripts" to the front of $PATH.
Export $GUIX_UNINSTALLED.
* tests/guix-build.sh, tests/guix-daemon.sh, tests/guix-download.sh,
tests/guix-gc.sh, tests/guix-package.sh: Use "guix COMMAND" instead of
"guix-COMMAND".
* doc/guix.texi: Replace all occurrences of "guix-COMMAND" with
"guix COMMAND".
* po/POTFILES.in: Update.
2013-02-14 10:15:25 +01:00
|
|
|
if guix build -n something-that-will-never-exist; # FAIL
|
2013-01-22 22:13:10 +01:00
|
|
|
then false; else true; fi
|
2013-11-18 23:08:20 +01:00
|
|
|
|
|
|
|
# Invoking a monadic procedure.
|
|
|
|
guix build -e "(begin
|
2014-04-27 23:19:11 +02:00
|
|
|
(use-modules (guix gexp))
|
2013-11-18 23:08:20 +01:00
|
|
|
(lambda ()
|
2014-04-27 23:19:11 +02:00
|
|
|
(gexp->derivation \"test\"
|
|
|
|
(gexp (mkdir (ungexp output))))))" \
|
2013-11-18 23:08:20 +01:00
|
|
|
--dry-run
|
2014-06-14 22:37:24 +02:00
|
|
|
|
|
|
|
# Running a gexp.
|
|
|
|
guix build -e '#~(mkdir #$output)' -d
|
|
|
|
guix build -e '#~(mkdir #$output)' -d | grep 'gexp\.drv'
|
2014-11-30 17:47:22 +01:00
|
|
|
|
|
|
|
# Using 'GUIX_BUILD_OPTIONS'.
|
|
|
|
GUIX_BUILD_OPTIONS="--dry-run"
|
|
|
|
export GUIX_BUILD_OPTIONS
|
|
|
|
|
|
|
|
guix build emacs
|
|
|
|
|
|
|
|
GUIX_BUILD_OPTIONS="--something-completely-crazy"
|
|
|
|
if guix build emacs;
|
|
|
|
then false; else true; fi
|