aboutsummaryrefslogtreecommitdiff
path: root/nix/libstore
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-01-23 22:33:10 +0100
committerLudovic Courtès <ludo@gnu.org>2017-01-23 22:33:10 +0100
commit58ea4d407c2e4adbe51b2d7b71dc8bef095677c7 (patch)
tree0fd70c0cb82d7980a7ff82500dec7bfd0d535d3f /nix/libstore
parentfcd75bdbfa99d14363b905afbf914eec20e69df8 (diff)
parent84b60a7cdfca1421a478894e279104a0c18a7c6d (diff)
downloadpatches-58ea4d407c2e4adbe51b2d7b71dc8bef095677c7.tar
patches-58ea4d407c2e4adbe51b2d7b71dc8bef095677c7.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'nix/libstore')
-rw-r--r--nix/libstore/build.cc15
-rw-r--r--nix/libstore/builtins.cc10
-rw-r--r--nix/libstore/builtins.hh5
-rw-r--r--nix/libstore/worker-protocol.hh2
4 files changed, 24 insertions, 8 deletions
diff --git a/nix/libstore/build.cc b/nix/libstore/build.cc
index 38048ceebc..cebc404d1c 100644
--- a/nix/libstore/build.cc
+++ b/nix/libstore/build.cc
@@ -2271,8 +2271,17 @@ void DerivationGoal::runChild()
logType = ltFlat;
auto buildDrv = lookupBuiltinBuilder(drv.builder);
- if (buildDrv != NULL)
- buildDrv(drv, drvPath);
+ if (buildDrv != NULL) {
+ /* Check what the output file name is. When doing a
+ 'bmCheck' build, the output file name is different from
+ that specified in DRV due to hash rewriting. */
+ Path output = drv.outputs["out"].path;
+ auto redirected = redirectedOutputs.find(output);
+ if (redirected != redirectedOutputs.end())
+ output = redirected->second;
+
+ buildDrv(drv, drvPath, output);
+ }
else
throw Error(format("unsupported builtin function '%1%'") % string(drv.builder, 8));
_exit(0);
@@ -2742,6 +2751,8 @@ Path DerivationGoal::addHashRewrite(const Path & path)
rewritesToTmp[h1] = h2;
rewritesFromTmp[h2] = h1;
redirectedOutputs[path] = p;
+ printMsg(lvlChatty, format("output '%1%' redirected to '%2%'")
+ % path % p);
return p;
}
diff --git a/nix/libstore/builtins.cc b/nix/libstore/builtins.cc
index 32af767dc4..7ed75e5079 100644
--- a/nix/libstore/builtins.cc
+++ b/nix/libstore/builtins.cc
@@ -1,5 +1,5 @@
/* GNU Guix --- Functional package management for GNU
- Copyright (C) 2016 Ludovic Courtès <ludo@gnu.org>
+ Copyright (C) 2016, 2017 Ludovic Courtès <ludo@gnu.org>
This file is part of GNU Guix.
@@ -25,7 +25,8 @@
namespace nix {
static void builtinDownload(const Derivation &drv,
- const std::string &drvPath)
+ const std::string &drvPath,
+ const std::string &output)
{
/* Invoke 'guix perform-download'. */
Strings args;
@@ -35,7 +36,10 @@ static void builtinDownload(const Derivation &drv,
/* Close all other file descriptors. */
closeMostFDs(set<int>());
- const char *const argv[] = { "download", drvPath.c_str(), NULL };
+ const char *const argv[] =
+ {
+ "download", drvPath.c_str(), output.c_str(), NULL
+ };
/* XXX: Hack our way to use the 'download' script from 'LIBEXECDIR/guix'
or just 'LIBEXECDIR', depending on whether we're running uninstalled or
diff --git a/nix/libstore/builtins.hh b/nix/libstore/builtins.hh
index 79171fcb6c..396ea14ebc 100644
--- a/nix/libstore/builtins.hh
+++ b/nix/libstore/builtins.hh
@@ -1,5 +1,5 @@
/* GNU Guix --- Functional package management for GNU
- Copyright (C) 2016 Ludovic Courtès <ludo@gnu.org>
+ Copyright (C) 2016, 2017 Ludovic Courtès <ludo@gnu.org>
This file is part of GNU Guix.
@@ -33,7 +33,8 @@ namespace nix {
/* Build DRV, which lives at DRVPATH. */
typedef void (*derivationBuilder) (const Derivation &drv,
- const std::string &drvPath);
+ const std::string &drvPath,
+ const std::string &output);
/* Return the built-in builder called BUILDER, or NULL if none was
found. */
diff --git a/nix/libstore/worker-protocol.hh b/nix/libstore/worker-protocol.hh
index bdeaca2e3a..efe9eadf23 100644
--- a/nix/libstore/worker-protocol.hh
+++ b/nix/libstore/worker-protocol.hh
@@ -6,7 +6,7 @@ namespace nix {
#define WORKER_MAGIC_1 0x6e697863
#define WORKER_MAGIC_2 0x6478696f
-#define PROTOCOL_VERSION 0x160
+#define PROTOCOL_VERSION 0x161
#define GET_PROTOCOL_MAJOR(x) ((x) & 0xff00)
#define GET_PROTOCOL_MINOR(x) ((x) & 0x00ff)