[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
84/118: Remove ugly hack for detecting build environment setup errors
From: |
Ludovic Courtès |
Subject: |
84/118: Remove ugly hack for detecting build environment setup errors |
Date: |
Tue, 19 May 2015 14:45:51 +0000 |
civodul pushed a commit to branch nix
in repository guix.
commit 42c6246f674ca2d5ea166d1ae676b7087ea1b0d8
Author: Eelco Dolstra <address@hidden>
Date: Fri Aug 1 19:38:21 2014 +0200
Remove ugly hack for detecting build environment setup errors
---
nix/libstore/build.cc | 23 ++++++++++-------------
1 files changed, 10 insertions(+), 13 deletions(-)
diff --git a/nix/libstore/build.cc b/nix/libstore/build.cc
index 348b3bd..e6f7c56 100644
--- a/nix/libstore/build.cc
+++ b/nix/libstore/build.cc
@@ -771,11 +771,6 @@ private:
outputs to allow hard links between outputs. */
InodesSeen inodesSeen;
- /* Magic exit code denoting that setting up the child environment
- failed. (It's possible that the child actually returns the
- exit code, but ah well.) */
- const static int childSetupFailed = 189;
-
public:
DerivationGoal(const Path & drvPath, const StringSet & wantedOutputs,
Worker & worker, BuildMode buildMode = bmNormal);
~DerivationGoal();
@@ -1420,9 +1415,6 @@ void DerivationGoal::buildDone()
if (pathExists(chrootRootDir + *i))
rename((chrootRootDir + *i).c_str(), i->c_str());
- if (WIFEXITED(status) && WEXITSTATUS(status) == childSetupFailed)
- throw Error(format("failed to set up the build environment for
`%1%'") % drvPath);
-
if (diskFull)
printMsg(lvlError, "note: build failure may have been caused
by lack of free disk space");
@@ -1956,10 +1948,15 @@ void DerivationGoal::startBuilder()
worker.childStarted(shared_from_this(), pid,
singleton<set<int> >(builderOut.readSide), true, true);
+ /* Check if setting up the build environment failed. */
+ string msg = readLine(builderOut.readSide);
+ if (!msg.empty()) throw Error(msg);
+
if (settings.printBuildTrace) {
printMsg(lvlError, format("@ build-started %1% - %2% %3%")
% drvPath % drv.platform % logFile);
}
+
}
@@ -1968,8 +1965,6 @@ void DerivationGoal::initChild()
/* Warning: in the child we should absolutely not make any SQLite
calls! */
- bool inSetup = true;
-
try { /* child */
_writeToStderr = 0;
@@ -2164,15 +2159,17 @@ void DerivationGoal::initChild()
restoreSIGPIPE();
+ /* Indicate that we managed to set up the build environment. */
+ writeToStderr("\n");
+
/* Execute the program. This should not return. */
- inSetup = false;
execve(program.c_str(), (char * *) &args[0], (char * *) envArr);
throw SysError(format("executing `%1%'") % drv.builder);
} catch (std::exception & e) {
- writeToStderr("build error: " + string(e.what()) + "\n");
- _exit(inSetup ? childSetupFailed : 1);
+ writeToStderr("while setting up the build environment: " +
string(e.what()) + "\n");
+ _exit(1);
}
abort(); /* never reached */
- 75/118: Merge commit 'fdee1ced43fb495d612a29e955141cdf6b9a95ba' into nix, (continued)
- 75/118: Merge commit 'fdee1ced43fb495d612a29e955141cdf6b9a95ba' into nix, Ludovic Courtès, 2015/05/19
- 74/118: Merge commit '8e9140cfdef9dbd1eb61e4c75c91d452ab5e4a74' into nix, Ludovic Courtès, 2015/05/19
- 73/118: startProcess: Make writing error messages from the child more robust, Ludovic Courtès, 2015/05/19
- 69/118: Bump, Ludovic Courtès, 2015/05/19
- 86/118: Add option ‘build-extra-chroot-dirs’, Ludovic Courtès, 2015/05/19
- 76/118: nix-daemon: Simplify stderr handling, Ludovic Courtès, 2015/05/19
- 77/118: nix-daemon: Less verbosity, Ludovic Courtès, 2015/05/19
- 90/118: Remove unnecessary call to addTempRoot(), Ludovic Courtès, 2015/05/19
- 88/118: Move some options out of globals, Ludovic Courtès, 2015/05/19
- 83/118: Call commonChildInit() before doing chroot init, Ludovic Courtès, 2015/05/19
- 84/118: Remove ugly hack for detecting build environment setup errors,
Ludovic Courtès <=
- 85/118: Get rid of "killing <pid>" message for unused build hooks, Ludovic Courtès, 2015/05/19
- 93/118: Reduce verbosity, Ludovic Courtès, 2015/05/19
- 92/118: Propagate remote timeouts properly, Ludovic Courtès, 2015/05/19
- 87/118: Refactor, Ludovic Courtès, 2015/05/19
- 79/118: Allow regular files as GC roots, Ludovic Courtès, 2015/05/19
- 89/118: Doh, Ludovic Courtès, 2015/05/19
- 78/118: Remove some dead code, Ludovic Courtès, 2015/05/19
- 82/118: Eliminate redundant copy, Ludovic Courtès, 2015/05/19
- 95/118: Make hook shutdown more reliable, Ludovic Courtès, 2015/05/19
- 81/118: findRoots(): Prevent a call to lstat(), Ludovic Courtès, 2015/05/19