* Delete the output paths before invoking the build hook.
This commit is contained in:
parent
df0283ae86
commit
917e06bf63
|
@ -1262,6 +1262,20 @@ bool DerivationGoal::prepareBuild()
|
||||||
% drvPath);
|
% drvPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If any of the outputs already exist but are not registered,
|
||||||
|
delete them. */
|
||||||
|
for (DerivationOutputs::iterator i = drv.outputs.begin();
|
||||||
|
i != drv.outputs.end(); ++i)
|
||||||
|
{
|
||||||
|
Path path = i->second.path;
|
||||||
|
if (store->isValidPath(path))
|
||||||
|
throw BuildError(format("obstructed build: path `%1%' exists") % path);
|
||||||
|
if (pathExists(path)) {
|
||||||
|
debug(format("removing unregistered path `%1%'") % path);
|
||||||
|
deletePathWrapped(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Gather information necessary for computing the closure and/or
|
/* Gather information necessary for computing the closure and/or
|
||||||
running the build hook. */
|
running the build hook. */
|
||||||
|
|
||||||
|
@ -1318,20 +1332,6 @@ void DerivationGoal::startBuilder()
|
||||||
format("a `%1%' is required to build `%3%', but I am a `%2%'")
|
format("a `%1%' is required to build `%3%', but I am a `%2%'")
|
||||||
% drv.platform % thisSystem % drvPath);
|
% drv.platform % thisSystem % drvPath);
|
||||||
|
|
||||||
/* If any of the outputs already exist but are not registered,
|
|
||||||
delete them. */
|
|
||||||
for (DerivationOutputs::iterator i = drv.outputs.begin();
|
|
||||||
i != drv.outputs.end(); ++i)
|
|
||||||
{
|
|
||||||
Path path = i->second.path;
|
|
||||||
if (store->isValidPath(path))
|
|
||||||
throw BuildError(format("obstructed build: path `%1%' exists") % path);
|
|
||||||
if (pathExists(path)) {
|
|
||||||
debug(format("removing unregistered path `%1%'") % path);
|
|
||||||
deletePathWrapped(path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Construct the environment passed to the builder. */
|
/* Construct the environment passed to the builder. */
|
||||||
typedef map<string, string> Environment;
|
typedef map<string, string> Environment;
|
||||||
Environment env;
|
Environment env;
|
||||||
|
|
Loading…
Reference in a new issue