diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2019-12-16 19:11:47 +0100 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2019-12-16 19:11:47 +0100 |
commit | 54bf5ba4227a234f8cd5102634b9a3b535e6fbdb (patch) | |
tree | 39878e4f41297705b5a8b637ed094c0998e8eca1 /src/libstore/path.cc | |
parent | 14d82baba4ebb82df28c2d4e9517f8c3a81d8f6c (diff) |
nix-store -r: Handle symlinks to store paths
Fixes #3270.
Diffstat (limited to 'src/libstore/path.cc')
-rw-r--r-- | src/libstore/path.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libstore/path.cc b/src/libstore/path.cc index 81ae495a1..cda5f9968 100644 --- a/src/libstore/path.cc +++ b/src/libstore/path.cc @@ -96,4 +96,19 @@ StorePathSet singleton(const StorePath & path) return res; } +std::pair<std::string_view, StringSet> parsePathWithOutputs(std::string_view s) +{ + size_t n = s.find("!"); + return n == s.npos + ? std::make_pair(s, std::set<string>()) + : std::make_pair(((std::string_view) s).substr(0, n), + tokenizeString<std::set<string>>(((std::string_view) s).substr(n + 1), ",")); +} + +StorePathWithOutputs Store::parsePathWithOutputs(const std::string & s) +{ + auto [path, outputs] = nix::parsePathWithOutputs(s); + return {parseStorePath(path), std::move(outputs)}; +} + } |