Skip to content
Snippets Groups Projects
Commit b0aba6ec authored by Eelco Dolstra's avatar Eelco Dolstra
Browse files

* Don't keep the derivation symlink when creating profile generations.

parent 32429142
No related branches found
No related tags found
No related merge requests found
...@@ -61,12 +61,11 @@ Generations findGenerations(Path profile, int & curGen) ...@@ -61,12 +61,11 @@ Generations findGenerations(Path profile, int & curGen)
} }
static void makeNames(const Path & profile, unsigned int num, static void makeName(const Path & profile, unsigned int num,
Path & outLink, Path & drvLink) Path & outLink)
{ {
Path prefix = (format("%1%-%2%") % profile % num).str(); Path prefix = (format("%1%-%2%") % profile % num).str();
outLink = prefix + "-link"; outLink = prefix + "-link";
drvLink = prefix + "-drv";
} }
...@@ -79,10 +78,10 @@ Path createGeneration(Path profile, Path outPath, Path drvPath) ...@@ -79,10 +78,10 @@ Path createGeneration(Path profile, Path outPath, Path drvPath)
unsigned int num = gens.size() > 0 ? gens.front().number : 0; unsigned int num = gens.size() > 0 ? gens.front().number : 0;
/* Create the new generation. */ /* Create the new generation. */
Path outLink, drvLink; Path outLink;
while (1) { while (1) {
makeNames(profile, num, outLink, drvLink); makeName(profile, num, outLink);
if (symlink(outPath.c_str(), outLink.c_str()) == 0) break; if (symlink(outPath.c_str(), outLink.c_str()) == 0) break;
if (errno != EEXIST) if (errno != EEXIST)
throw SysError(format("creating symlink `%1%'") % outLink); throw SysError(format("creating symlink `%1%'") % outLink);
...@@ -90,9 +89,6 @@ Path createGeneration(Path profile, Path outPath, Path drvPath) ...@@ -90,9 +89,6 @@ Path createGeneration(Path profile, Path outPath, Path drvPath)
num++; num++;
} }
if (symlink(drvPath.c_str(), drvLink.c_str()) != 0)
throw SysError(format("creating symlink `%1%'") % drvLink);
return outLink; return outLink;
} }
...@@ -106,10 +102,9 @@ static void removeFile(const Path & path) ...@@ -106,10 +102,9 @@ static void removeFile(const Path & path)
void deleteGeneration(const Path & profile, unsigned int gen) void deleteGeneration(const Path & profile, unsigned int gen)
{ {
Path generation, gcrootDrv; Path generation;
makeNames(profile, gen, generation, gcrootDrv); makeName(profile, gen, generation);
removeFile(generation); removeFile(generation);
if (pathExists(gcrootDrv)) removeFile(gcrootDrv);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment