In repair mode, update the hash of rebuilt paths

Otherwise subsequent invocations of "--repair" will keep rebuilding
the path.  This only happens if the path content differs between
builds (e.g. due to timestamps).
This commit is contained in:
Eelco Dolstra 2013-06-13 14:46:07 +02:00
parent 6b05f688ee
commit f9ff67e948
2 changed files with 5 additions and 4 deletions

View file

@ -1673,7 +1673,7 @@ void DerivationGoal::startBuilder()
{ {
PathSet missing = outputPaths(drv.outputs); PathSet missing = outputPaths(drv.outputs);
foreach (PathSet::iterator, i, validPaths) missing.erase(*i); foreach (PathSet::iterator, i, validPaths) missing.erase(*i);
startNest(nest, lvlInfo, format("building path(s) %1%") % showPaths(missing)); startNest(nest, lvlInfo, format(repair ? "repairing path(s) %1%" : "building path(s) %1%") % showPaths(missing));
/* Right platform? */ /* Right platform? */
if (!canBuildLocally(drv.platform)) if (!canBuildLocally(drv.platform))

View file

@ -1202,9 +1202,10 @@ void LocalStore::registerValidPaths(const ValidPathInfos & infos)
foreach (ValidPathInfos::const_iterator, i, infos) { foreach (ValidPathInfos::const_iterator, i, infos) {
assert(i->hash.type == htSHA256); assert(i->hash.type == htSHA256);
/* !!! Maybe the registration info should be updated if the if (isValidPath(i->path))
path is already valid. */ updatePathInfo(*i);
if (!isValidPath(i->path)) addValidPath(*i); else
addValidPath(*i);
paths.insert(i->path); paths.insert(i->path);
} }