Debug when storePath changes
these rewrites should be transparent, but they are important to know about when debugging
This commit is contained in:
parent
e3cb536f19
commit
88120442d2
|
@ -661,6 +661,8 @@ void copyPaths(ref<Store> srcStore, ref<Store> dstStore, const StorePathSet & st
|
||||||
FileIngestionMethod ingestionMethod { info->ca.compare(6, 2, "r:") == 0 };
|
FileIngestionMethod ingestionMethod { info->ca.compare(6, 2, "r:") == 0 };
|
||||||
Hash hash(std::string(info->ca, ingestionMethod == FileIngestionMethod::Recursive ? 8 : 6));
|
Hash hash(std::string(info->ca, ingestionMethod == FileIngestionMethod::Recursive ? 8 : 6));
|
||||||
storePathForDst = dstStore->makeFixedOutputPath(ingestionMethod, hash, storePath.name());
|
storePathForDst = dstStore->makeFixedOutputPath(ingestionMethod, hash, storePath.name());
|
||||||
|
if (storePathForDst != storePath)
|
||||||
|
debug("rewriting path '%s' to '%s' for substituter '%s'", srcStore->printStorePath(storePath), dstStore->printStorePath(storePathForDst), dstStore->getUri());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dstStore->isValidPath(storePathForDst)) {
|
if (dstStore->isValidPath(storePathForDst)) {
|
||||||
|
@ -687,6 +689,8 @@ void copyPaths(ref<Store> srcStore, ref<Store> dstStore, const StorePathSet & st
|
||||||
FileIngestionMethod ingestionMethod { info->ca.compare(6, 2, "r:") == 0 };
|
FileIngestionMethod ingestionMethod { info->ca.compare(6, 2, "r:") == 0 };
|
||||||
Hash hash(std::string(info->ca, ingestionMethod == FileIngestionMethod::Recursive ? 8 : 6));
|
Hash hash(std::string(info->ca, ingestionMethod == FileIngestionMethod::Recursive ? 8 : 6));
|
||||||
storePathForDst = dstStore->makeFixedOutputPath(ingestionMethod, hash, storePath.name());
|
storePathForDst = dstStore->makeFixedOutputPath(ingestionMethod, hash, storePath.name());
|
||||||
|
if (storePathForDst != storePath)
|
||||||
|
debug("rewriting path '%s' to '%s' for substituter '%s'", srcStore->printStorePath(storePath), dstStore->printStorePath(storePathForDst), dstStore->getUri());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dstStore->isValidPath(storePathForDst)) {
|
if (!dstStore->isValidPath(storePathForDst)) {
|
||||||
|
|
|
@ -35,12 +35,13 @@ clearStore
|
||||||
other_store=file://$TEST_ROOT/other_store
|
other_store=file://$TEST_ROOT/other_store
|
||||||
|
|
||||||
hash=$(nix hash-file --type sha256 --base16 ./fetchurl.sh)
|
hash=$(nix hash-file --type sha256 --base16 ./fetchurl.sh)
|
||||||
storePath=$(nix add-to-store --store $other_store ./fetchurl.sh)
|
|
||||||
|
|
||||||
outPath=$(nix-build -vvvvvv '<nix/fetchurl.nix>' --argstr url file:///no-such-dir/fetchurl.sh --argstr sha256 $hash --no-out-link --substituters $other_store)
|
storePath=$(nix --store $other_store add-to-store --flat ./fetchurl.sh)
|
||||||
|
|
||||||
|
outPath=$(nix-build '<nix/fetchurl.nix>' --argstr url file:///no-such-dir/fetchurl.sh --argstr sha256 $hash --no-out-link --substituters $other_store)
|
||||||
|
|
||||||
# Test hashed mirrors with an SRI hash.
|
# Test hashed mirrors with an SRI hash.
|
||||||
nix-build '<nix/fetchurl.nix>' --argstr url file:///no-such-dir/fetchurl.sh --argstr hash $(nix to-sri --type sha512 $hash) \
|
nix-build '<nix/fetchurl.nix>' --argstr url file:///no-such-dir/fetchurl.sh --argstr hash $(nix to-sri --type sha256 $hash) \
|
||||||
--argstr name bla --no-out-link --substituters $other_store
|
--argstr name bla --no-out-link --substituters $other_store
|
||||||
|
|
||||||
# Test unpacking a NAR.
|
# Test unpacking a NAR.
|
||||||
|
|
Loading…
Reference in a new issue