2013-01-06 00:47:50 +01:00
|
|
|
# GNU Guix --- Functional package management for GNU
|
2022-02-17 16:23:42 +01:00
|
|
|
# Copyright © 2012-2014, 2016-2022 Ludovic Courtès <ludo@gnu.org>
|
2020-02-05 18:47:31 +01:00
|
|
|
# Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
|
2021-02-21 02:29:58 +01:00
|
|
|
# Copyright © 2021 Chris Marusich <cmmarusich@gmail.com>
|
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.
|
tests: Simplify shell exit status negation;
* tests/guix-archive.sh, tests/guix-build-branch.sh, tests/guix-build.sh,
tests/guix-daemon.sh, tests/guix-download.sh, tests/guix-environment.sh,
tests/guix-gc.sh, tests/guix-git-authenticate.sh, tests/guix-graph.sh,
tests/guix-hash.sh, tests/guix-lint.sh, tests/guix-pack-relocatable.sh,
tests/guix-pack.sh, tests/guix-package-aliases.sh, tests/guix-package-net.sh,
tests/guix-package.sh: Use the shell '!' keyword to negate command exit status
in place of 'if ...; then false; else true; fi'
2020-09-25 18:00:11 +02:00
|
|
|
! guix build -e +
|
2012-11-07 23:41:59 +01:00
|
|
|
|
2016-10-03 15:24:21 +02:00
|
|
|
# Source-less packages are accepted; they just return nothing.
|
|
|
|
guix build -e '(@ (gnu packages bootstrap) %bootstrap-glibc)' -S
|
|
|
|
test "`guix build -e '(@ (gnu packages bootstrap) %bootstrap-glibc)' -S`" = ""
|
2012-10-31 23:27:51 +01:00
|
|
|
|
2022-02-17 16:23:42 +01:00
|
|
|
# Warn when attempting to build an unsupported package.
|
|
|
|
case "$(guix build intelmetool -s armhf-linux -v0 -n 2>&1)" in
|
|
|
|
*warning:*intelmetool*support*armhf*)
|
|
|
|
true
|
|
|
|
break;;
|
|
|
|
*)
|
|
|
|
false;
|
|
|
|
break;;
|
|
|
|
esac
|
|
|
|
|
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$'
|
|
|
|
|
2019-11-17 23:06:49 +01:00
|
|
|
# Passing a .drv.
|
|
|
|
drv="`guix build -e '(@@ (gnu packages bootstrap) %bootstrap-guile)' -d`"
|
|
|
|
out="`guix build "$drv"`"
|
|
|
|
out2="`guix build -e '(@@ (gnu packages bootstrap) %bootstrap-guile)'`"
|
|
|
|
test "$out" = "$out2"
|
|
|
|
|
2019-11-17 23:10:34 +01:00
|
|
|
# Passing the name of a .drv that doesn't exist. The daemon should try to
|
|
|
|
# substitute the .drv. Here we just look for the "cannot build missing
|
|
|
|
# derivation" error that indicates that the daemon did try to substitute the
|
|
|
|
# .drv.
|
|
|
|
guix build "$NIX_STORE_DIR/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-foo.drv" 2>&1 \
|
|
|
|
| grep "missing derivation"
|
|
|
|
|
2017-04-21 11:39:49 +02:00
|
|
|
# Passing a URI.
|
2019-02-03 22:10:06 +01:00
|
|
|
GUIX_DAEMON_SOCKET="file://$GUIX_STATE_DIRECTORY/daemon-socket/socket" \
|
2017-04-21 11:39:49 +02:00
|
|
|
guix build -e '(@@ (gnu packages bootstrap) %bootstrap-guile)'
|
|
|
|
|
|
|
|
( if GUIX_DAEMON_SOCKET="weird://uri" \
|
|
|
|
guix build -e '(@@ (gnu packages bootstrap) %bootstrap-guile)'; \
|
|
|
|
then exit 1; fi )
|
|
|
|
|
2019-04-19 15:18:20 +02:00
|
|
|
# Passing one '-s' flag.
|
|
|
|
test `guix build sed -s x86_64-linux -d | wc -l` = 1
|
|
|
|
|
|
|
|
# Passing multiple '-s' flags.
|
2021-02-21 02:29:58 +01:00
|
|
|
all_systems="-s x86_64-linux -s i686-linux -s armhf-linux -s aarch64-linux \
|
|
|
|
-s powerpc64le-linux"
|
|
|
|
test `guix build sed $all_systems -d | sort -u | wc -l` = 5
|
2019-04-19 15:18:20 +02:00
|
|
|
|
gnu: commencement: Memoize packages as a function of the system.
Previous, things like 'ld-wrapper-boot0' would be memoized with
(mlambda () …). However, the definition of 'ld-wrapper-boot0' depends
on the result of (%boot0-inputs), which is itself a function
of (%current-system). Thus, if one first calls:
(parameterize ((%current-system "x86_64-linux"))
(ld-wrapper-boot0))
then, in all subsequent calls to 'ld-wrapper-boot0', the value
of (%current-system) would be ignored because the result is already
memoized. Concretely, 'ld-wrapper-boot0' would always have the
dependencies it has on x86_64-linux, even though they are different than
those on armhf-linux, say ("bash-mesboot" vs. "bootstrap-binaries").
Fixes <https://bugs.gnu.org/40482>.
Reported by Marius Bakke <mbakke@fastmail.com>.
* gnu/packages/commencement.scm (define/system-dependent): New macro.
(linux-libre-headers-boot0, hurd-core-headers-boot0, ld-wrapper-boot0)
(gcc-boot0-intermediate-wrapped, gcc-boot0-wrapped, ld-wrapper-boot3):
Define using 'define/system-dependent' instead of 'define' + 'mlambda'.
Adjust users so they no longer look like procedure calls.
* tests/guix-build.sh: Add test.
2020-04-11 00:12:09 +02:00
|
|
|
# Check there's no weird memoization effect leading to erroneous results.
|
|
|
|
# See <https://bugs.gnu.org/40482>.
|
|
|
|
drv1="`guix build sed -s x86_64-linux -s armhf-linux -d | sort`"
|
|
|
|
drv2="`guix build sed -s armhf-linux -s x86_64-linux -d | sort`"
|
|
|
|
test "$drv1" = "$drv2"
|
|
|
|
|
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
|
|
|
|
|
2021-11-07 15:56:19 +01:00
|
|
|
# Check error reporting for '-f'.
|
|
|
|
cat > "$module_dir/foo.scm" <<EOF
|
|
|
|
(use-modules (guix))
|
|
|
|
) ;extra closing paren
|
|
|
|
EOF
|
|
|
|
! guix build -f "$module_dir/foo.scm" 2> "$module_dir/stderr"
|
|
|
|
grep "read error" "$module_dir/stderr"
|
|
|
|
rm "$module_dir/stderr" "$module_dir/foo.scm"
|
|
|
|
|
|
|
|
# Check 'GUIX_PACKAGE_PATH' & co.
|
2015-01-28 20:33:28 +01:00
|
|
|
cat > "$module_dir/foo.scm"<<EOF
|
|
|
|
(define-module (foo)
|
2016-03-02 23:57:23 +01:00
|
|
|
#:use-module (guix tests)
|
2015-01-28 20:33:28 +01:00
|
|
|
#: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)))
|
2016-03-02 23:57:23 +01:00
|
|
|
|
|
|
|
(define-public baz
|
|
|
|
(dummy-package "baz" (replacement foo)))
|
|
|
|
|
2016-09-06 23:14:07 +02:00
|
|
|
(define-public superseded
|
|
|
|
(deprecated-package "superseded" bar))
|
|
|
|
|
2015-01-28 20:33:28 +01:00
|
|
|
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'
|
|
|
|
|
2016-03-02 23:57:23 +01:00
|
|
|
# 'baz' has a replacement so we should be getting the replacement's source.
|
|
|
|
(unset GUIX_BUILD_OPTIONS;
|
|
|
|
test "`guix build -d -S baz`" = "`guix build -d -S foo`")
|
|
|
|
|
2015-01-28 20:33:28 +01:00
|
|
|
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
|
|
|
|
|
2018-05-04 15:05:05 +02:00
|
|
|
|
2019-07-20 00:33:50 +02:00
|
|
|
# Unbound variable in thunked field.
|
|
|
|
cat > "$module_dir/foo.scm" <<EOF
|
2018-05-04 15:05:05 +02:00
|
|
|
(define-module (foo)
|
|
|
|
#:use-module (guix tests)
|
|
|
|
#:use-module (guix build-system trivial))
|
|
|
|
|
|
|
|
(define-public foo
|
|
|
|
(dummy-package "package-with-something-wrong"
|
|
|
|
(build-system trivial-build-system)
|
|
|
|
(inputs (quasiquote (("sed" ,sed)))))) ;unbound variable
|
|
|
|
EOF
|
|
|
|
|
tests: Simplify shell exit status negation;
* tests/guix-archive.sh, tests/guix-build-branch.sh, tests/guix-build.sh,
tests/guix-daemon.sh, tests/guix-download.sh, tests/guix-environment.sh,
tests/guix-gc.sh, tests/guix-git-authenticate.sh, tests/guix-graph.sh,
tests/guix-hash.sh, tests/guix-lint.sh, tests/guix-pack-relocatable.sh,
tests/guix-pack.sh, tests/guix-package-aliases.sh, tests/guix-package-net.sh,
tests/guix-package.sh: Use the shell '!' keyword to negate command exit status
in place of 'if ...; then false; else true; fi'
2020-09-25 18:00:11 +02:00
|
|
|
! guix build package-with-something-wrong -n
|
2018-05-04 15:05:05 +02:00
|
|
|
guix build package-with-something-wrong -n 2> "$module_dir/err" || true
|
|
|
|
grep "unbound" "$module_dir/err" # actual error
|
|
|
|
grep "forget.*(gnu packages base)" "$module_dir/err" # hint
|
2019-07-20 00:33:50 +02:00
|
|
|
|
|
|
|
# Unbound variable at the top level.
|
|
|
|
cat > "$module_dir/foo.scm" <<EOF
|
|
|
|
(define-module (foo)
|
|
|
|
#:use-module (guix tests))
|
|
|
|
|
|
|
|
(define-public foo
|
|
|
|
(dummy-package "package-with-something-wrong"
|
|
|
|
(build-system gnu-build-system))) ;unbound variable
|
|
|
|
EOF
|
|
|
|
|
|
|
|
guix build sed -n 2> "$module_dir/err"
|
|
|
|
grep "unbound" "$module_dir/err" # actual error
|
|
|
|
grep "forget.*(guix build-system gnu)" "$module_dir/err" # hint
|
|
|
|
|
2018-05-04 15:05:05 +02:00
|
|
|
rm -f "$module_dir"/*
|
|
|
|
|
2020-10-15 16:41:14 +02:00
|
|
|
# Unbound variable: don't suggest modules that do not export the variable.
|
|
|
|
cat > "$module_dir/aa-private.scm" <<EOF
|
|
|
|
(define-module (aa-private))
|
|
|
|
(define make-thing #f)
|
|
|
|
(set! make-thing make-thing) ;don't inline
|
|
|
|
EOF
|
|
|
|
|
|
|
|
cat > "$module_dir/bb-public.scm" <<EOF
|
|
|
|
(define-module (bb-public) #:export (make-thing))
|
|
|
|
(define make-thing identity)
|
|
|
|
EOF
|
|
|
|
|
|
|
|
cat > "$module_dir/cc-user.scm" <<EOF
|
|
|
|
;; Make those module available in the global name space.
|
|
|
|
(load-from-path "aa-private.scm")
|
|
|
|
(load-from-path "bb-public.scm")
|
|
|
|
|
|
|
|
(define-module (cc-user))
|
|
|
|
(make-thing 42)
|
|
|
|
EOF
|
|
|
|
! guix build -f "$module_dir/cc-user.scm" -n 2> "$module_dir/err"
|
|
|
|
cat "$module_dir/err"
|
|
|
|
grep "make-thing.*unbound" "$module_dir/err" # actual error
|
|
|
|
grep "forget.*(bb-public)" "$module_dir/err" # hint
|
|
|
|
|
|
|
|
rm -f "$module_dir"/*
|
|
|
|
|
2019-07-19 23:48:09 +02:00
|
|
|
# Wrong 'define-module' clause reported by 'warn-about-load-error'.
|
|
|
|
cat > "$module_dir/foo.scm" <<EOF
|
|
|
|
(define-module (something foo)
|
|
|
|
#:use-module (guix)
|
|
|
|
#:use-module (gnu))
|
|
|
|
EOF
|
|
|
|
guix build guile-bootstrap -n 2> "$module_dir/err"
|
|
|
|
grep "does not match file name" "$module_dir/err"
|
|
|
|
|
|
|
|
rm "$module_dir"/*
|
|
|
|
|
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.
|
tests: Simplify shell exit status negation;
* tests/guix-archive.sh, tests/guix-build-branch.sh, tests/guix-build.sh,
tests/guix-daemon.sh, tests/guix-download.sh, tests/guix-environment.sh,
tests/guix-gc.sh, tests/guix-git-authenticate.sh, tests/guix-graph.sh,
tests/guix-hash.sh, tests/guix-lint.sh, tests/guix-pack-relocatable.sh,
tests/guix-pack.sh, tests/guix-package-aliases.sh, tests/guix-package-net.sh,
tests/guix-package.sh: Use the shell '!' keyword to negate command exit status
in place of 'if ...; then false; else true; fi'
2020-09-25 18:00:11 +02:00
|
|
|
! guix build hello-0.0.1 -n
|
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.
|
tests: Simplify shell exit status negation;
* tests/guix-archive.sh, tests/guix-build-branch.sh, tests/guix-build.sh,
tests/guix-daemon.sh, tests/guix-download.sh, tests/guix-environment.sh,
tests/guix-gc.sh, tests/guix-git-authenticate.sh, tests/guix-graph.sh,
tests/guix-hash.sh, tests/guix-lint.sh, tests/guix-pack-relocatable.sh,
tests/guix-pack.sh, tests/guix-package-aliases.sh, tests/guix-package-net.sh,
tests/guix-package.sh: Use the shell '!' keyword to negate command exit status
in place of 'if ...; then false; else true; fi'
2020-09-25 18:00:11 +02:00
|
|
|
! guix build -r "$result" -e '(@@ (gnu packages bootstrap) %bootstrap-guile)'
|
2012-10-31 23:27:51 +01:00
|
|
|
|
|
|
|
rm -f "$result"
|
2013-01-22 22:13:10 +01:00
|
|
|
|
2019-04-15 16:57:12 +02:00
|
|
|
# Check relative file name canonicalization: <https://bugs.gnu.org/35271>.
|
|
|
|
mkdir "$result"
|
|
|
|
guix build -r "$result/x" -e '(@@ (gnu packages bootstrap) %bootstrap-guile)'
|
|
|
|
test -x "$result/x/bin/guile"
|
|
|
|
rm "$result/x"
|
|
|
|
rmdir "$result"
|
|
|
|
|
2013-05-24 22:52:52 +02:00
|
|
|
# Cross building.
|
|
|
|
guix build coreutils --target=mips64el-linux-gnu --dry-run --no-substitutes
|
|
|
|
|
2019-11-07 10:22:24 +01:00
|
|
|
# Likewise, but with '-e' (see <https://bugs.gnu.org/38093>).
|
|
|
|
guix build --target=arm-linux-gnueabihf --dry-run \
|
|
|
|
-e '(@ (gnu packages base) coreutils)'
|
|
|
|
|
2016-01-31 23:22:18 +01:00
|
|
|
# Replacements.
|
2021-09-07 14:49:40 +02:00
|
|
|
drv1=`guix build guix --with-input=guile-zstd=idutils -d`
|
2016-01-31 23:22:18 +01:00
|
|
|
drv2=`guix build guix -d`
|
|
|
|
test "$drv1" != "$drv2"
|
|
|
|
|
|
|
|
drv1=`guix build guile -d`
|
|
|
|
drv2=`guix build guile --with-input=gimp=ruby -d`
|
|
|
|
test "$drv1" = "$drv2"
|
|
|
|
|
packages: 'package-input-rewriting/spec' can rewrite implicit dependencies.
With this change, '--with-input', '--with-graft', etc. also apply to
implicit dependencies. Thus, it's now possible to do:
guix build python-itsdangerous --with-input=python-wrapper=python@2
or:
guix build hello --with-graft=glibc=glibc@2.29
Additionally, before, implicit inputs were not rewritten, which could
lead to duplicates in the output of 'bag-transitive-inputs' (packages
that are not 'eq?' but lead to the same derivation). This in turn would
lead to unnecessary rebuilds when using '--with-input' & co. This
change fixes it by ensuring even implicit inputs are rewritten.
Fixes <https://bugs.gnu.org/42156>.
* guix/packages.scm (package-input-rewriting/spec): Add #:deep?
defaulting to #true, and pass it to 'package-mapping'.
[replacement-property]: New variable.
[rewrite]: Check that property and set it on the result of PROC.
[cut?]: New procedure.
* tests/packages.scm ("package-input-rewriting/spec"): Ensure implicit
inputs were unchanged.
("package-input-rewriting/spec, partial match"): Pass #:deep? #f.
("package-input-rewriting/spec, deep")
("package-input-rewriting/spec, no duplicates"): New tests.
(package/inherit): Move before use.
* tests/guix-build.sh: Add tests.
* tests/scripts-build.scm ("options->transformation, with-graft"):
Compare dependencies by package name or derivation file name.
* doc/guix.texi (Defining Packages): Adjust accordingly.
2020-09-23 10:29:09 +02:00
|
|
|
# See <https://bugs.gnu.org/42156>.
|
|
|
|
drv1=`guix build glib -d`
|
|
|
|
drv2=`guix build glib -d --with-input=libreoffice=inkscape`
|
|
|
|
test "$drv1" = "$drv2"
|
|
|
|
|
2020-10-20 09:18:07 +02:00
|
|
|
# '--with-graft' should have no effect when using '--no-grafts'.
|
|
|
|
# See <https://bugs.gnu.org/43890>.
|
|
|
|
drv1=`guix build inkscape -d --no-grafts`
|
|
|
|
drv2=`guix build inkscape -d --no-grafts --with-graft=glib=glib-networking`
|
|
|
|
test "$drv1" = "$drv2"
|
|
|
|
|
packages: 'package-input-rewriting/spec' can rewrite implicit dependencies.
With this change, '--with-input', '--with-graft', etc. also apply to
implicit dependencies. Thus, it's now possible to do:
guix build python-itsdangerous --with-input=python-wrapper=python@2
or:
guix build hello --with-graft=glibc=glibc@2.29
Additionally, before, implicit inputs were not rewritten, which could
lead to duplicates in the output of 'bag-transitive-inputs' (packages
that are not 'eq?' but lead to the same derivation). This in turn would
lead to unnecessary rebuilds when using '--with-input' & co. This
change fixes it by ensuring even implicit inputs are rewritten.
Fixes <https://bugs.gnu.org/42156>.
* guix/packages.scm (package-input-rewriting/spec): Add #:deep?
defaulting to #true, and pass it to 'package-mapping'.
[replacement-property]: New variable.
[rewrite]: Check that property and set it on the result of PROC.
[cut?]: New procedure.
* tests/packages.scm ("package-input-rewriting/spec"): Ensure implicit
inputs were unchanged.
("package-input-rewriting/spec, partial match"): Pass #:deep? #f.
("package-input-rewriting/spec, deep")
("package-input-rewriting/spec, no duplicates"): New tests.
(package/inherit): Move before use.
* tests/guix-build.sh: Add tests.
* tests/scripts-build.scm ("options->transformation, with-graft"):
Compare dependencies by package name or derivation file name.
* doc/guix.texi (Defining Packages): Adjust accordingly.
2020-09-23 10:29:09 +02:00
|
|
|
# Rewriting implicit inputs.
|
|
|
|
drv1=`guix build hello -d`
|
|
|
|
drv2=`guix build hello -d --with-input=gcc=gcc-toolchain`
|
|
|
|
test "$drv1" != "$drv2"
|
|
|
|
guix gc -R "$drv2" | grep `guix build -d gcc-toolchain`
|
|
|
|
|
tests: Simplify shell exit status negation;
* tests/guix-archive.sh, tests/guix-build-branch.sh, tests/guix-build.sh,
tests/guix-daemon.sh, tests/guix-download.sh, tests/guix-environment.sh,
tests/guix-gc.sh, tests/guix-git-authenticate.sh, tests/guix-graph.sh,
tests/guix-hash.sh, tests/guix-lint.sh, tests/guix-pack-relocatable.sh,
tests/guix-pack.sh, tests/guix-package-aliases.sh, tests/guix-package-net.sh,
tests/guix-package.sh: Use the shell '!' keyword to negate command exit status
in place of 'if ...; then false; else true; fi'
2020-09-25 18:00:11 +02:00
|
|
|
! guix build guile --with-input=libunistring=something-really-silly
|
2016-01-31 23:22:18 +01:00
|
|
|
|
2016-09-06 23:14:07 +02:00
|
|
|
# Deprecated/superseded packages.
|
|
|
|
test "`guix build superseded -d`" = "`guix build bar -d`"
|
|
|
|
|
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
|
2018-03-13 18:47:32 +01:00
|
|
|
guix build -n time@1.9 # PASS, version found
|
tests: Simplify shell exit status negation;
* tests/guix-archive.sh, tests/guix-build-branch.sh, tests/guix-build.sh,
tests/guix-daemon.sh, tests/guix-download.sh, tests/guix-environment.sh,
tests/guix-gc.sh, tests/guix-git-authenticate.sh, tests/guix-graph.sh,
tests/guix-hash.sh, tests/guix-lint.sh, tests/guix-pack-relocatable.sh,
tests/guix-pack.sh, tests/guix-package-aliases.sh, tests/guix-package-net.sh,
tests/guix-package.sh: Use the shell '!' keyword to negate command exit status
in place of 'if ...; then false; else true; fi'
2020-09-25 18:00:11 +02:00
|
|
|
! guix build -n time@3.2 # FAIL, version not found
|
|
|
|
! guix build -n something-that-will-never-exist # FAIL
|
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
|
|
|
|
2018-10-09 18:52:37 +02:00
|
|
|
# Same with a file-like object.
|
|
|
|
guix build -e '(computed-file "foo" #~(mkdir #$output))' -d
|
|
|
|
guix build -e '(computed-file "foo" #~(mkdir #$output))' -d | grep 'foo\.drv'
|
|
|
|
|
2015-10-26 23:09:28 +01:00
|
|
|
# Building from a package file.
|
|
|
|
cat > "$module_dir/package.scm"<<EOF
|
|
|
|
(use-modules (gnu))
|
|
|
|
(use-package-modules bootstrap)
|
|
|
|
|
|
|
|
%bootstrap-guile
|
|
|
|
EOF
|
|
|
|
guix build --file="$module_dir/package.scm"
|
|
|
|
|
|
|
|
# Building from a monadic procedure file.
|
|
|
|
cat > "$module_dir/proc.scm"<<EOF
|
|
|
|
(use-modules (guix gexp))
|
|
|
|
(lambda ()
|
|
|
|
(gexp->derivation "test"
|
|
|
|
(gexp (mkdir (ungexp output)))))
|
|
|
|
EOF
|
|
|
|
guix build --file="$module_dir/proc.scm" --dry-run
|
|
|
|
|
|
|
|
# Building from a gexp file.
|
|
|
|
cat > "$module_dir/gexp.scm"<<EOF
|
|
|
|
(use-modules (guix gexp))
|
|
|
|
|
|
|
|
(gexp (mkdir (ungexp output)))
|
|
|
|
EOF
|
|
|
|
guix build --file="$module_dir/gexp.scm" -d
|
|
|
|
guix build --file="$module_dir/gexp.scm" -d | grep 'gexp\.drv'
|
2020-02-05 18:47:31 +01:00
|
|
|
|
|
|
|
# Building from a manifest file.
|
|
|
|
cat > "$module_dir/manifest.scm"<<EOF
|
|
|
|
(specifications->manifest '("hello" "guix"))
|
|
|
|
EOF
|
|
|
|
test `guix build -d --manifest="$module_dir/manifest.scm" \
|
|
|
|
| grep -e '-hello-' -e '-guix-' \
|
|
|
|
| wc -l` -eq 2
|
2020-03-03 10:34:35 +01:00
|
|
|
|
|
|
|
# Building from a manifest that contains a non-package object.
|
|
|
|
cat > "$module_dir/manifest.scm"<<EOF
|
|
|
|
(manifest
|
|
|
|
(list (manifest-entry (name "foo") (version "0")
|
|
|
|
(item (computed-file "computed-thingie"
|
|
|
|
#~(mkdir (ungexp output)))))))
|
|
|
|
EOF
|
|
|
|
guix build -d -m "$module_dir/manifest.scm" \
|
|
|
|
| grep 'computed-thingie\.drv$'
|
|
|
|
|
2019-07-19 23:48:09 +02:00
|
|
|
rm "$module_dir"/*.scm
|
2015-10-26 23:09:28 +01:00
|
|
|
|
2014-11-30 17:47:22 +01:00
|
|
|
# Using 'GUIX_BUILD_OPTIONS'.
|
2016-03-02 14:44:18 +01:00
|
|
|
GUIX_BUILD_OPTIONS="--dry-run --no-grafts"
|
2014-11-30 17:47:22 +01:00
|
|
|
export GUIX_BUILD_OPTIONS
|
|
|
|
|
|
|
|
guix build emacs
|
|
|
|
|
|
|
|
GUIX_BUILD_OPTIONS="--something-completely-crazy"
|
tests: Simplify shell exit status negation;
* tests/guix-archive.sh, tests/guix-build-branch.sh, tests/guix-build.sh,
tests/guix-daemon.sh, tests/guix-download.sh, tests/guix-environment.sh,
tests/guix-gc.sh, tests/guix-git-authenticate.sh, tests/guix-graph.sh,
tests/guix-hash.sh, tests/guix-lint.sh, tests/guix-pack-relocatable.sh,
tests/guix-pack.sh, tests/guix-package-aliases.sh, tests/guix-package-net.sh,
tests/guix-package.sh: Use the shell '!' keyword to negate command exit status
in place of 'if ...; then false; else true; fi'
2020-09-25 18:00:11 +02:00
|
|
|
! guix build emacs
|