2013-01-05 23:47:50 +00:00
|
|
|
# GNU Guix --- Functional package management for GNU
|
2014-03-27 22:53:00 +00:00
|
|
|
# Copyright © 2012, 2014 Ludovic Courtès <ludo@gnu.org>
|
2012-12-04 22:16:11 +00:00
|
|
|
#
|
2013-01-05 23:47:50 +00:00
|
|
|
# This file is part of GNU Guix.
|
2012-12-04 22:16:11 +00:00
|
|
|
#
|
2013-01-05 23:47:50 +00:00
|
|
|
# GNU Guix is free software; you can redistribute it and/or modify it
|
2012-12-04 22:16:11 +00: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-05 23:47:50 +00:00
|
|
|
# GNU Guix is distributed in the hope that it will be useful, but
|
2012-12-04 22:16:11 +00: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-05 23:47:50 +00:00
|
|
|
# along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
|
2012-12-04 22:16:11 +00:00
|
|
|
|
|
|
|
#
|
2014-03-27 22:53:00 +00:00
|
|
|
# Test the daemon and its interaction with 'guix substitute-binary'.
|
2012-12-04 22:16:11 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
guix-daemon --version
|
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 09:15:25 +00:00
|
|
|
guix build --version
|
2012-12-04 22:16:11 +00:00
|
|
|
|
2014-03-27 22:53:00 +00:00
|
|
|
drv="`guix build emacs -d`"
|
|
|
|
out="`guile -c ' \
|
|
|
|
(use-modules (guix) (gnu packages emacs)) \
|
|
|
|
(define store (open-connection)) \
|
|
|
|
(display (derivation->output-path (package-derivation store emacs)))'`"
|
|
|
|
|
|
|
|
hash_part="`basename $out | cut -c 1-32`"
|
|
|
|
narinfo="$hash_part.narinfo"
|
|
|
|
substitute_dir="`echo $GUIX_BINARY_SUBSTITUTE_URL | sed -'es,file://,,g'`"
|
|
|
|
|
|
|
|
cat > "$substitute_dir/nix-cache-info"<<EOF
|
|
|
|
StoreDir: `dirname $drv`
|
|
|
|
WantMassQuery: 0
|
|
|
|
EOF
|
|
|
|
|
|
|
|
cat > "$substitute_dir/$narinfo"<<EOF
|
|
|
|
StorePath: $out
|
|
|
|
URL: /nowhere/example.nar
|
|
|
|
Compression: none
|
|
|
|
NarSize: 1234
|
|
|
|
References:
|
|
|
|
System: `guile -c '(use-modules (guix)) (display (%current-system))'`
|
|
|
|
Deriver: $drv
|
|
|
|
EOF
|
|
|
|
|
|
|
|
# Remove the cached narinfo.
|
|
|
|
rm -f "$XDG_CACHE_HOME/guix/substitute-binary/$hash_part"
|
|
|
|
|
|
|
|
# Make sure we see the substitute.
|
|
|
|
guile -c '
|
|
|
|
(use-modules (guix))
|
|
|
|
(define store (open-connection))
|
|
|
|
(set-build-options store #:use-substitutes? #t)
|
|
|
|
(exit (has-substitutes? store "'"$out"'"))'
|
|
|
|
|
|
|
|
# Now, run guix-daemon --no-substitutes.
|
|
|
|
socket="$NIX_STATE_DIR/alternate-socket"
|
|
|
|
guix-daemon --no-substitutes --listen="$socket" --disable-chroot &
|
|
|
|
daemon_pid=$!
|
|
|
|
trap "kill $daemon_pid" EXIT
|
|
|
|
|
|
|
|
# Make sure we DON'T see the substitute.
|
|
|
|
guile -c "
|
|
|
|
(use-modules (guix))
|
|
|
|
(define store (open-connection \"$socket\"))
|
|
|
|
|
|
|
|
;; This setting MUST NOT override the daemon's --no-substitutes.
|
|
|
|
(set-build-options store #:use-substitutes? #t)
|
|
|
|
|
|
|
|
(exit (not (has-substitutes? store \"$out\")))"
|