diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2010-01-25T16·04+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2010-01-25T16·04+0000 |
commit | 5388944e8d1ca61e23d42a6a0769b925f099f4e1 (patch) | |
tree | 9f6c90aeea01d8ad1cc99102a27751de7d409912 /src/libstore/store-api.cc | |
parent | f0c0277970f8283428b599d8da8089756583a26c (diff) |
* Make the garbage collector do the right thing when `gc-keep-outputs'
is enabled by not depending on the deriver.
Diffstat (limited to 'src/libstore/store-api.cc')
-rw-r--r-- | src/libstore/store-api.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc index 01dd51621625..f0abe61ad1e1 100644 --- a/src/libstore/store-api.cc +++ b/src/libstore/store-api.cc @@ -1,6 +1,7 @@ #include "store-api.hh" #include "globals.hh" #include "util.hh" +#include "derivations.hh" #include <limits.h> @@ -52,6 +53,18 @@ Path toStorePath(const Path & path) } +string getNameOfStorePath(const Path & path) +{ + Path::size_type slash = path.rfind('/'); + string p = slash == Path::npos ? path : string(path, slash + 1); + Path::size_type dash = p.find('-'); + assert(dash != Path::npos); + string p2 = string(p, dash + 1); + if (isDerivation(p2)) p2 = string(p2, 0, p2.size() - 4); + return p2; +} + + Path followLinksToStore(const Path & _path) { Path path = absPath(_path); |