forked from lix-project/lix
Merge pull request #4906 from NixOS/collect-garbage-ca
Make `computeFSClosure` ca-aware
This commit is contained in:
commit
26d2c62225
|
@ -29,9 +29,9 @@ void Store::computeFSClosure(const StorePathSet & startPaths,
|
||||||
res.insert(i);
|
res.insert(i);
|
||||||
|
|
||||||
if (includeDerivers && path.isDerivation())
|
if (includeDerivers && path.isDerivation())
|
||||||
for (auto& i : queryDerivationOutputs(path))
|
for (auto& [_, maybeOutPath] : queryPartialDerivationOutputMap(path))
|
||||||
if (isValidPath(i) && queryPathInfo(i)->deriver == path)
|
if (maybeOutPath && isValidPath(*maybeOutPath))
|
||||||
res.insert(i);
|
res.insert(*maybeOutPath);
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
else
|
else
|
||||||
|
@ -44,9 +44,9 @@ void Store::computeFSClosure(const StorePathSet & startPaths,
|
||||||
res.insert(ref);
|
res.insert(ref);
|
||||||
|
|
||||||
if (includeOutputs && path.isDerivation())
|
if (includeOutputs && path.isDerivation())
|
||||||
for (auto& i : queryDerivationOutputs(path))
|
for (auto& [_, maybeOutPath] : queryPartialDerivationOutputMap(path))
|
||||||
if (isValidPath(i))
|
if (maybeOutPath && isValidPath(*maybeOutPath))
|
||||||
res.insert(i);
|
res.insert(*maybeOutPath);
|
||||||
|
|
||||||
if (includeDerivers && info->deriver && isValidPath(*info->deriver))
|
if (includeDerivers && info->deriver && isValidPath(*info->deriver))
|
||||||
res.insert(*info->deriver);
|
res.insert(*info->deriver);
|
||||||
|
|
12
tests/ca/gc.sh
Executable file
12
tests/ca/gc.sh
Executable file
|
@ -0,0 +1,12 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Ensure that garbage collection works properly with ca derivations
|
||||||
|
|
||||||
|
source common.sh
|
||||||
|
|
||||||
|
sed -i 's/experimental-features .*/& ca-derivations ca-references/' "$NIX_CONF_DIR"/nix.conf
|
||||||
|
|
||||||
|
export NIX_TESTS_CA_BY_DEFAULT=1
|
||||||
|
|
||||||
|
cd ..
|
||||||
|
source gc.sh
|
|
@ -1,3 +1,12 @@
|
||||||
|
let
|
||||||
|
contentAddressedByDefault = builtins.getEnv "NIX_TESTS_CA_BY_DEFAULT" == "1";
|
||||||
|
caArgs = if contentAddressedByDefault then {
|
||||||
|
__contentAddressed = true;
|
||||||
|
outputHashMode = "recursive";
|
||||||
|
outputHashAlgo = "sha256";
|
||||||
|
} else {};
|
||||||
|
in
|
||||||
|
|
||||||
rec {
|
rec {
|
||||||
shell = "@bash@";
|
shell = "@bash@";
|
||||||
|
|
||||||
|
@ -15,4 +24,4 @@ rec {
|
||||||
PATH = path;
|
PATH = path;
|
||||||
} // removeAttrs args ["builder" "meta"])
|
} // removeAttrs args ["builder" "meta"])
|
||||||
// { meta = args.meta or {}; };
|
// { meta = args.meta or {}; };
|
||||||
}
|
} // caArgs
|
||||||
|
|
|
@ -2,6 +2,7 @@ nix_tests = \
|
||||||
hash.sh lang.sh add.sh simple.sh dependencies.sh \
|
hash.sh lang.sh add.sh simple.sh dependencies.sh \
|
||||||
config.sh \
|
config.sh \
|
||||||
gc.sh \
|
gc.sh \
|
||||||
|
ca/gc.sh \
|
||||||
gc-concurrent.sh \
|
gc-concurrent.sh \
|
||||||
gc-auto.sh \
|
gc-auto.sh \
|
||||||
referrers.sh user-envs.sh logging.sh nix-build.sh misc.sh fixed.sh \
|
referrers.sh user-envs.sh logging.sh nix-build.sh misc.sh fixed.sh \
|
||||||
|
|
Loading…
Reference in a new issue