forked from lix-project/lix
nix-env: Support ‘--repair’ flag
This commit is contained in:
parent
2e90a5a2a7
commit
2bbc4a214e
|
@ -1105,8 +1105,10 @@ void DerivationGoal::repairClosure()
|
||||||
if (worker.store.pathContentsGood(*i)) continue;
|
if (worker.store.pathContentsGood(*i)) continue;
|
||||||
printMsg(lvlError, format("found corrupted or missing path `%1%' in the output closure of `%2%'") % *i % drvPath);
|
printMsg(lvlError, format("found corrupted or missing path `%1%' in the output closure of `%2%'") % *i % drvPath);
|
||||||
Path drvPath2 = outputsToDrv[*i];
|
Path drvPath2 = outputsToDrv[*i];
|
||||||
if (drvPath2 == "") throw Error(format("don't know how to repair corrupted or missing path `%1%'") % *i);
|
if (drvPath2 == "")
|
||||||
addWaitee(worker.makeDerivationGoal(drvPath2, true));
|
addWaitee(worker.makeSubstitutionGoal(*i, true));
|
||||||
|
else
|
||||||
|
addWaitee(worker.makeDerivationGoal(drvPath2, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (waitees.empty()) {
|
if (waitees.empty()) {
|
||||||
|
|
|
@ -702,7 +702,7 @@ static void opSet(Globals & globals,
|
||||||
PathSet paths = singleton<PathSet>(drv.queryDrvPath(globals.state));
|
PathSet paths = singleton<PathSet>(drv.queryDrvPath(globals.state));
|
||||||
printMissing(*store, paths);
|
printMissing(*store, paths);
|
||||||
if (globals.dryRun) return;
|
if (globals.dryRun) return;
|
||||||
store->buildPaths(paths);
|
store->buildPaths(paths, globals.state.repair);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printMissing(*store, singleton<PathSet>(drv.queryOutPath(globals.state)));
|
printMissing(*store, singleton<PathSet>(drv.queryOutPath(globals.state)));
|
||||||
|
@ -1317,6 +1317,8 @@ void run(Strings args)
|
||||||
globals.instSource.systemFilter = needArg(i, args, arg);
|
globals.instSource.systemFilter = needArg(i, args, arg);
|
||||||
else if (arg == "--prebuilt-only" || arg == "-b")
|
else if (arg == "--prebuilt-only" || arg == "-b")
|
||||||
globals.prebuiltOnly = true;
|
globals.prebuiltOnly = true;
|
||||||
|
else if (arg == "--repair")
|
||||||
|
globals.state.repair = true;
|
||||||
else {
|
else {
|
||||||
remaining.push_back(arg);
|
remaining.push_back(arg);
|
||||||
if (arg[0] == '-') {
|
if (arg[0] == '-') {
|
||||||
|
|
|
@ -45,7 +45,7 @@ bool createUserEnv(EvalState & state, DrvInfos & elems,
|
||||||
drvsToBuild.insert(i->queryDrvPath(state));
|
drvsToBuild.insert(i->queryDrvPath(state));
|
||||||
|
|
||||||
debug(format("building user environment dependencies"));
|
debug(format("building user environment dependencies"));
|
||||||
store->buildPaths(drvsToBuild);
|
store->buildPaths(drvsToBuild, state.repair);
|
||||||
|
|
||||||
/* Construct the whole top level derivation. */
|
/* Construct the whole top level derivation. */
|
||||||
PathSet references;
|
PathSet references;
|
||||||
|
@ -132,7 +132,7 @@ bool createUserEnv(EvalState & state, DrvInfos & elems,
|
||||||
|
|
||||||
/* Realise the resulting store expression. */
|
/* Realise the resulting store expression. */
|
||||||
debug("building user environment");
|
debug("building user environment");
|
||||||
store->buildPaths(singleton<PathSet>(topLevelDrv.queryDrvPath(state)));
|
store->buildPaths(singleton<PathSet>(topLevelDrv.queryDrvPath(state)), state.repair);
|
||||||
|
|
||||||
/* Switch the current user environment to the output path. */
|
/* Switch the current user environment to the output path. */
|
||||||
PathLocks lock;
|
PathLocks lock;
|
||||||
|
|
Loading…
Reference in a new issue