summaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-01-11 17:06:31 +0100
committerLudovic Courtès <ludo@gnu.org>2017-01-11 17:06:31 +0100
commit9b5364a3afb03414bd6e3ded2fbfdacabe4e8870 (patch)
tree82ff386c867e792cf8ca2d1cf3c1b68390d6d2de /guix
parentaa042770da2fe6411089a965ea8b2219a99d3448 (diff)
downloadgnu-guix-9b5364a3afb03414bd6e3ded2fbfdacabe4e8870.tar
gnu-guix-9b5364a3afb03414bd6e3ded2fbfdacabe4e8870.tar.gz
daemon: Allow check builds of 'builtin:download' derivations.
Fixes <http://bugs.gnu.org/25089>. Reported by Leo Famulari <leo@famulari.name>. * nix/libstore/build.cc (DerivationGoal::runChild): In the 'isBuiltin' case, check whether DRV's output is in 'redirectedOutputs', and pass an 'output' argument to the built-in builder. (DerivationGoal::addHashRewrite): Add 'printMsg' call. * nix/libstore/builtins.hh (derivationBuilder): Add 'output' parameter. * nix/libstore/builtins.cc (builtinDownload): Likewise. Add OUTPUT to ARGV. * guix/scripts/perform-download.scm (perform-download): Add 'output' parameter. (guix-perform-download): Adjust 'match' clauses accordingly. * tests/derivations.scm ("'download' built-in builder, check mode"): New test.
Diffstat (limited to 'guix')
-rw-r--r--guix/scripts/perform-download.scm21
1 files changed, 13 insertions, 8 deletions
diff --git a/guix/scripts/perform-download.scm b/guix/scripts/perform-download.scm
index 0d2e7089aa..58a7377141 100644
--- a/guix/scripts/perform-download.scm
+++ b/guix/scripts/perform-download.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2016 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2016, 2017 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -19,7 +19,7 @@
(define-module (guix scripts perform-download)
#:use-module (guix ui)
#:use-module (guix derivations)
- #:use-module ((guix store) #:select (derivation-path?))
+ #:use-module ((guix store) #:select (derivation-path? store-path?))
#:use-module (guix build download)
#:use-module (ice-9 match)
#:export (guix-perform-download))
@@ -41,10 +41,13 @@
(module-use! module (resolve-interface '(guix base32)))
module))
-(define (perform-download drv)
- "Perform the download described by DRV, a fixed-output derivation."
+(define (perform-download drv output)
+ "Perform the download described by DRV, a fixed-output derivation, to
+OUTPUT.
+
+Note: We don't read the value of 'out' in DRV since the actual output is
+different from that when we're doing a 'bmCheck' or 'bmRepair' build."
(derivation-let drv ((url "url")
- (output "out")
(executable "executable")
(mirrors "mirrors")
(content-addressed-mirrors "content-addressed-mirrors"))
@@ -93,18 +96,20 @@ of GnuTLS over HTTPS, before we have built GnuTLS. See
<http://bugs.gnu.org/22774>."
(with-error-handling
(match args
- (((? derivation-path? drv))
+ (((? derivation-path? drv) (? store-path? output))
;; This program must be invoked by guix-daemon under an unprivileged
;; UID to prevent things downloading from 'file:///etc/shadow' or
;; arbitrary code execution via the content-addressed mirror
;; procedures. (That means we exclude users who did not pass
;; '--build-users-group'.)
(assert-low-privileges)
- (perform-download (call-with-input-file drv read-derivation)))
+ (perform-download (call-with-input-file drv read-derivation)
+ output))
(("--version")
(show-version-and-exit))
(x
- (leave (_ "fixed-output derivation name expected~%"))))))
+ (leave
+ (_ "fixed-output derivation and output file name expected~%"))))))
;; Local Variables:
;; eval: (put 'derivation-let 'scheme-indent-function 2)