1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 04:21:16 +02:00

* Make the garbage collector do the right thing when `gc-keep-outputs'

is enabled by not depending on the deriver.
This commit is contained in:
Eelco Dolstra 2010-01-25 16:04:32 +00:00
parent f0c0277970
commit 5388944e8d
4 changed files with 90 additions and 18 deletions

View file

@ -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);