# GNU Guix --- Functional package management for GNU
-# Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org>
+# Copyright © 2012, 2013, 2014, 2016 Ludovic Courtès <ludo@gnu.org>
#
# This file is part of GNU Guix.
#
if guix build -e +;
then false; else true; fi
-# Should fail because this is a source-less package.
-if guix build -e '(@ (gnu packages bootstrap) %bootstrap-glibc)' -S
-then false; else true; fi
+# 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`" = ""
# Should pass.
guix build -e '(@@ (gnu packages bootstrap) %bootstrap-guile)' | \
cat > "$module_dir/foo.scm"<<EOF
(define-module (foo)
+ #:use-module (guix tests)
#:use-module (guix packages)
#:use-module (guix download)
#:use-module (guix build-system trivial))
(synopsis "Dummy package")
(description "bar is a dummy package for testing.")
(license #f)))
+
+(define-public baz
+ (dummy-package "baz" (replacement foo)))
+
+(define-public superseded
+ (deprecated-package "superseded" bar))
+
EOF
GUIX_PACKAGE_PATH="$module_dir"
guix build -d -S foo
guix build -d -S foo | grep -e 'foo\.tar\.gz'
+# '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`")
+
guix build -d --sources=package foo
guix build -d --sources=package foo | grep -e 'foo\.tar\.gz'
# Cross building.
guix build coreutils --target=mips64el-linux-gnu --dry-run --no-substitutes
+# Replacements.
+drv1=`guix build guix --with-input=guile=guile-next -d`
+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"
+
+if guix build guile --with-input=libunistring=something-really-silly
+then false; else true; fi
+
+# Deprecated/superseded packages.
+test "`guix build superseded -d`" = "`guix build bar -d`"
+
# Parsing package names and versions.
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
+guix build -n time@1.7 # PASS, version found
+guix build -n time-1.7 # PASS, deprecated version syntax
+if guix build -n time@3.2; # FAIL, version not found
then false; else true; fi
if guix build -n something-that-will-never-exist; # FAIL
then false; else true; fi
guix build -e '#~(mkdir #$output)' -d
guix build -e '#~(mkdir #$output)' -d | grep 'gexp\.drv'
+# 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'
+
# Using 'GUIX_BUILD_OPTIONS'.
-GUIX_BUILD_OPTIONS="--dry-run"
+GUIX_BUILD_OPTIONS="--dry-run --no-grafts"
export GUIX_BUILD_OPTIONS
guix build emacs