mirror of
https://github.com/NixOS/nix.git
synced 2025-11-11 04:56:01 +01:00
fetchToStore(): Don't require a valid path in dry run mode
This commit is contained in:
parent
af5815fd54
commit
e3fa4faff9
2 changed files with 3 additions and 4 deletions
|
|
@ -46,12 +46,11 @@ std::pair<StorePath, Hash> fetchToStore2(
|
||||||
if (fingerprint) {
|
if (fingerprint) {
|
||||||
cacheKey = makeSourcePathToHashCacheKey(*fingerprint, method, subpath.abs());
|
cacheKey = makeSourcePathToHashCacheKey(*fingerprint, method, subpath.abs());
|
||||||
if (auto res = fetchers::getCache()->lookup(*cacheKey)) {
|
if (auto res = fetchers::getCache()->lookup(*cacheKey)) {
|
||||||
debug("source path hash cache hit for '%s'", path);
|
|
||||||
auto hash = Hash::parseSRI(fetchers::getStrAttr(*res, "hash"));
|
auto hash = Hash::parseSRI(fetchers::getStrAttr(*res, "hash"));
|
||||||
auto storePath = store.makeFixedOutputPathFromCA(name,
|
auto storePath = store.makeFixedOutputPathFromCA(name,
|
||||||
ContentAddressWithReferences::fromParts(method, hash, {}));
|
ContentAddressWithReferences::fromParts(method, hash, {}));
|
||||||
if (store.isValidPath(storePath)) {
|
if (mode == FetchMode::DryRun || store.isValidPath(storePath)) {
|
||||||
debug("source path '%s' has valid store path '%s'", path, store.printStorePath(storePath));
|
debug("source path '%s' cache hit in '%s' (hash '%s')", path, store.printStorePath(storePath), hash.to_string(HashFormat::SRI, true));
|
||||||
return {storePath, hash};
|
return {storePath, hash};
|
||||||
}
|
}
|
||||||
debug("source path '%s' not in store", path);
|
debug("source path '%s' not in store", path);
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,7 @@ nix build -o "$TEST_ROOT/result" "git+file://$flake1Dir?ref=HEAD#default"
|
||||||
# Check that the fetcher cache works.
|
# Check that the fetcher cache works.
|
||||||
if [[ $(nix config show lazy-trees) = false ]]; then
|
if [[ $(nix config show lazy-trees) = false ]]; then
|
||||||
nix build -o "$TEST_ROOT/result" "git+file://$flake1Dir?ref=HEAD#default" -vvvvv 2>&1 | grepQuietInverse "source path.*is uncacheable"
|
nix build -o "$TEST_ROOT/result" "git+file://$flake1Dir?ref=HEAD#default" -vvvvv 2>&1 | grepQuietInverse "source path.*is uncacheable"
|
||||||
nix build -o "$TEST_ROOT/result" "git+file://$flake1Dir?ref=HEAD#default" -vvvvv 2>&1 | grepQuiet "source path hash cache hit"
|
nix build -o "$TEST_ROOT/result" "git+file://$flake1Dir?ref=HEAD#default" -vvvvv 2>&1 | grepQuiet "source path.*cache hit"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check that relative paths are allowed for git flakes.
|
# Check that relative paths are allowed for git flakes.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue