1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-10-18 00:16:11 -04:00

Compare commits

..

No commits in common. "ed1f9dd13f23450aad86f7687dd1b596d06ceed4" and "188d97e1f1a6ce41f1eaed813adf878cfa6acdeb" have entirely different histories.

View file

@ -185,14 +185,6 @@ std::pair<StorePath, Input> Input::fetchToStore(ref<Store> store) const
auto narHash = store->queryPathInfo(storePath)->narHash; auto narHash = store->queryPathInfo(storePath)->narHash;
final.attrs.insert_or_assign("narHash", narHash.to_string(HashFormat::SRI, true)); final.attrs.insert_or_assign("narHash", narHash.to_string(HashFormat::SRI, true));
// FIXME: we would like to mark inputs as final in
// getAccessorUnchecked(), but then we can't add
// narHash. Or maybe narHash should be excluded from the
// concept of "final" inputs?
final.attrs.insert_or_assign("final", Explicit<bool>(true));
assert(final.isFinal());
scheme->checkLocks(*this, final); scheme->checkLocks(*this, final);
return {storePath, final}; return {storePath, final};
@ -236,6 +228,8 @@ void InputScheme::checkLocks(const Input & specified, const Input & final) const
final.to_string(), *prevRevCount); final.to_string(), *prevRevCount);
} }
assert(final.isFinal());
if (specified.isFinal() && specified.attrs != final.attrs) if (specified.isFinal() && specified.attrs != final.attrs)
throw Error("fetching final input '%s' resulted in different input '%s'", throw Error("fetching final input '%s' resulted in different input '%s'",
attrsToJSON(specified.attrs), attrsToJSON(final.attrs)); attrsToJSON(specified.attrs), attrsToJSON(final.attrs));
@ -271,7 +265,7 @@ std::pair<ref<SourceAccessor>, Input> Input::getAccessorUnchecked(ref<Store> sto
FIXME: add a setting to disable this. FIXME: add a setting to disable this.
FIXME: substituting may be slower than fetching normally, FIXME: substituting may be slower than fetching normally,
e.g. for fetchers like Git that are incremental! e.g. for fetchers like that Git that are incremental!
*/ */
if (isFinal() && getNarHash()) { if (isFinal() && getNarHash()) {
try { try {
@ -297,6 +291,8 @@ std::pair<ref<SourceAccessor>, Input> Input::getAccessorUnchecked(ref<Store> sto
assert(!accessor->fingerprint); assert(!accessor->fingerprint);
accessor->fingerprint = scheme->getFingerprint(store, final); accessor->fingerprint = scheme->getFingerprint(store, final);
final.attrs.insert_or_assign("final", Explicit<bool>(true));
return {accessor, std::move(final)}; return {accessor, std::move(final)};
} }