mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-10 03:23:29 +03:00
lib/strings: allow CA paths in isStorePath
This commit is contained in:
parent
46c7edcc07
commit
7a07cc0da9
2 changed files with 17 additions and 1 deletions
|
@ -2434,7 +2434,13 @@ rec {
|
||||||
if isStringLike x then
|
if isStringLike x then
|
||||||
let str = toString x; in
|
let str = toString x; in
|
||||||
substring 0 1 str == "/"
|
substring 0 1 str == "/"
|
||||||
&& dirOf str == storeDir
|
&& (dirOf str == storeDir
|
||||||
|
# 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.
|
||||||
|
|| builtins.match "/[0-9a-z]{52}" str != null)
|
||||||
else
|
else
|
||||||
false;
|
false;
|
||||||
|
|
||||||
|
|
|
@ -537,6 +537,7 @@ runTests {
|
||||||
expr =
|
expr =
|
||||||
let goodPath =
|
let goodPath =
|
||||||
"${builtins.storeDir}/d945ibfx9x185xf04b890y4f9g3cbb63-python-2.7.11";
|
"${builtins.storeDir}/d945ibfx9x185xf04b890y4f9g3cbb63-python-2.7.11";
|
||||||
|
goodCAPath = "/1121rp0gvr1qya7hvy925g5kjwg66acz6sn1ra1hca09f1z5dsab";
|
||||||
in {
|
in {
|
||||||
storePath = isStorePath goodPath;
|
storePath = isStorePath goodPath;
|
||||||
storePathDerivation = isStorePath (import ../.. { system = "x86_64-linux"; }).hello;
|
storePathDerivation = isStorePath (import ../.. { system = "x86_64-linux"; }).hello;
|
||||||
|
@ -545,6 +546,12 @@ runTests {
|
||||||
nonAbsolute = isStorePath (concatStrings (tail (stringToCharacters goodPath)));
|
nonAbsolute = isStorePath (concatStrings (tail (stringToCharacters goodPath)));
|
||||||
asPath = isStorePath (/. + goodPath);
|
asPath = isStorePath (/. + goodPath);
|
||||||
otherPath = isStorePath "/something/else";
|
otherPath = isStorePath "/something/else";
|
||||||
|
|
||||||
|
caPath = isStorePath goodCAPath;
|
||||||
|
caPathAppendix = isStorePath
|
||||||
|
"${goodCAPath}/bin/python";
|
||||||
|
caAsPath = isStorePath (/. + goodCAPath);
|
||||||
|
|
||||||
otherVals = {
|
otherVals = {
|
||||||
attrset = isStorePath {};
|
attrset = isStorePath {};
|
||||||
list = isStorePath [];
|
list = isStorePath [];
|
||||||
|
@ -557,6 +564,9 @@ runTests {
|
||||||
storePathAppendix = false;
|
storePathAppendix = false;
|
||||||
nonAbsolute = false;
|
nonAbsolute = false;
|
||||||
asPath = true;
|
asPath = true;
|
||||||
|
caPath = true;
|
||||||
|
caPathAppendix = false;
|
||||||
|
caAsPath = true;
|
||||||
otherPath = false;
|
otherPath = false;
|
||||||
otherVals = {
|
otherVals = {
|
||||||
attrset = false;
|
attrset = false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue