1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-26 15:51:15 +02:00

nix-store -r: Handle symlinks to store paths

Fixes #3270.
This commit is contained in:
Eelco Dolstra 2019-12-16 19:11:47 +01:00
parent 14d82baba4
commit 54bf5ba422
11 changed files with 67 additions and 43 deletions

View file

@ -39,9 +39,9 @@ Path Store::toStorePath(const Path & path) const
}
Path Store::followLinksToStore(const Path & _path) const
Path Store::followLinksToStore(std::string_view _path) const
{
Path path = absPath(_path);
Path path = absPath(std::string(_path));
while (!isInStore(path)) {
if (!isLink(path)) break;
string target = readLink(path);
@ -53,12 +53,19 @@ Path Store::followLinksToStore(const Path & _path) const
}
StorePath Store::followLinksToStorePath(const Path & path) const
StorePath Store::followLinksToStorePath(std::string_view path) const
{
return parseStorePath(toStorePath(followLinksToStore(path)));
}
StorePathWithOutputs Store::followLinksToStorePathWithOutputs(std::string_view path) const
{
auto [path2, outputs] = nix::parsePathWithOutputs(path);
return StorePathWithOutputs(followLinksToStorePath(path2), std::move(outputs));
}
string storePathToHash(const Path & path)
{
auto base = baseNameOf(path);