mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-12 05:16:25 +03:00
lib/path: allow CA paths in hasStorePathPrefix
This commit is contained in:
parent
0974a837a2
commit
6e2e984af0
2 changed files with 17 additions and 1 deletions
|
@ -159,7 +159,13 @@ let
|
||||||
# but this is not fully specified, so let's tie this too much to the currently implemented concept of store paths.
|
# but this is not fully specified, so let's tie this too much to the currently implemented concept of store paths.
|
||||||
# Similar reasoning applies to the validity of the name part.
|
# Similar reasoning applies to the validity of the name part.
|
||||||
# We care more about discerning store path-ness on realistic values. Making it airtight would be fragile and slow.
|
# We care more about discerning store path-ness on realistic values. Making it airtight would be fragile and slow.
|
||||||
&& match ".{32}-.+" (elemAt components storeDirLength) != null;
|
&& match ".{32}-.+" (elemAt components storeDirLength) != null
|
||||||
|
# alternatively match content‐addressed derivations, which _currently_ do
|
||||||
|
# not have a store directory prefix.
|
||||||
|
# This is a workaround for https://github.com/NixOS/nix/issues/12361 which
|
||||||
|
# was needed during the experimental phase of ca-derivations and should be
|
||||||
|
# removed once the issue has been resolved.
|
||||||
|
|| match "[0-9a-z]{52}" (head components) != null;
|
||||||
|
|
||||||
in
|
in
|
||||||
# No rec! Add dependencies on this file at the top.
|
# No rec! Add dependencies on this file at the top.
|
||||||
|
|
|
@ -137,6 +137,16 @@ let
|
||||||
expected = true;
|
expected = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Test paths for content‐addressed derivations
|
||||||
|
testHasStorePathPrefixExample7 = {
|
||||||
|
expr = hasStorePathPrefix (/. + "/1121rp0gvr1qya7hvy925g5kjwg66acz6sn1ra1hca09f1z5dsab");
|
||||||
|
expected = true;
|
||||||
|
};
|
||||||
|
testHasStorePathPrefixExample8 = {
|
||||||
|
expr = hasStorePathPrefix (/. + "/1121rp0gvr1qya7hvy925g5kjwg66acz6sn1ra1hca09f1z5dsab/foo/bar");
|
||||||
|
expected = true;
|
||||||
|
};
|
||||||
|
|
||||||
# Test examples from the lib.path.subpath.isValid documentation
|
# Test examples from the lib.path.subpath.isValid documentation
|
||||||
testSubpathIsValidExample1 = {
|
testSubpathIsValidExample1 = {
|
||||||
expr = subpath.isValid null;
|
expr = subpath.isValid null;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue