Skip to content

Commit 3a53e87

Browse files
committed
registerOutputs: Hoist up optimizePath call and comment rationale
1 parent 646d1f5 commit 3a53e87

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/libstore/unix/build/derivation-builder.cc

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1783,16 +1783,23 @@ SingleDrvOutputs DerivationBuilderImpl::registerOutputs()
17831783
if (buildMode == bmRepair) {
17841784
/* Path already exists, need to replace it */
17851785
replaceValidPath(store.toRealPath(finalDestPath), actualPath);
1786+
/* Optimize newly-installed store object */
1787+
store.optimisePath(
1788+
store.toRealPath(finalDestPath), NoRepair); // FIXME: combine with scanForReferences()
17861789
} else if (store.isValidPath(newInfo.path)) {
17871790
/* Path already exists because CA path produced by something
17881791
else. No moving needed. */
17891792
assert(newInfo.ca);
17901793
/* Can delete our scratch copy now. */
17911794
deletePath(actualPath);
1795+
/* Presume already-existing store object is already optimized. */
17921796
} else {
17931797
auto destPath = store.toRealPath(finalDestPath);
17941798
deletePath(destPath);
17951799
movePath(actualPath, destPath);
1800+
/* Optimize newly-installed store object */
1801+
store.optimisePath(
1802+
store.toRealPath(finalDestPath), NoRepair); // FIXME: combine with scanForReferences()
17961803
}
17971804
}
17981805

@@ -1804,10 +1811,6 @@ SingleDrvOutputs DerivationBuilderImpl::registerOutputs()
18041811
debug("unreferenced input: '%1%'", store.printStorePath(i));
18051812
}
18061813

1807-
if (!store.isValidPath(newInfo.path))
1808-
store.optimisePath(
1809-
store.toRealPath(finalDestPath), NoRepair); // FIXME: combine with scanForReferences()
1810-
18111814
newInfo.deriver = drvPath;
18121815
newInfo.ultimate = true;
18131816
store.signPathInfo(newInfo);

0 commit comments

Comments
 (0)