From 9c9982dc0c8c38ce3821b154b7e92509c1564317 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 17 Nov 2019 23:10:34 +0100 Subject: guix build: Handle "guix build /….drv" correctly for non-existent derivations. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This lets the daemon substitute missing derivations, as in the example at , instead of failing with ENOENT. * guix/scripts/build.scm (options->things-to-build): In the 'derivation-path?' case, don't fail when 'read-derivation-from-file' raises to ENOENT; return the empty list in that case. (guix-build): Add non-existent '.drv' files to ITEMS. Pass ITEMS in addition to DRV to 'build-derivations'. * tests/guix-build.sh: Add test. --- tests/guix-build.sh | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests') diff --git a/tests/guix-build.sh b/tests/guix-build.sh index 62cdd5fe14..21b6af4395 100644 --- a/tests/guix-build.sh +++ b/tests/guix-build.sh @@ -42,6 +42,13 @@ out="`guix build "$drv"`" out2="`guix build -e '(@@ (gnu packages bootstrap) %bootstrap-guile)'`" test "$out" = "$out2" +# 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" + # Passing a URI. GUIX_DAEMON_SOCKET="file://$GUIX_STATE_DIRECTORY/daemon-socket/socket" \ guix build -e '(@@ (gnu packages bootstrap) %bootstrap-guile)' -- cgit v1.2.3