From 12a888894bc528fbfa9d4c1ef2dbeb5909550894 Mon Sep 17 00:00:00 2001 From: Christian Theune Date: Wed, 20 May 2015 17:29:52 +0200 Subject: Mis-read Eelko's request to not make this an option: now, let's not make it an option. :) --- src/nix-env/nix-env.cc | 15 +++++---------- src/nix-env/profiles.cc | 8 ++++---- src/nix-env/profiles.hh | 2 +- src/nix-env/user-env.cc | 4 ++-- src/nix-env/user-env.hh | 2 +- 5 files changed, 13 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/nix-env/nix-env.cc b/src/nix-env/nix-env.cc index 8a7f5f0596b8..10b95dad168c 100644 --- a/src/nix-env/nix-env.cc +++ b/src/nix-env/nix-env.cc @@ -58,7 +58,6 @@ struct Globals bool removeAll; string forceName; bool prebuiltOnly; - bool lazyGeneration; }; @@ -511,7 +510,7 @@ static void installDerivations(Globals & globals, if (globals.dryRun) return; if (createUserEnv(*globals.state, allElems, - profile, settings.envKeepDerivations, lockToken, globals.lazyGeneration)) break; + profile, settings.envKeepDerivations, lockToken)) break; } } @@ -525,8 +524,6 @@ static void opInstall(Globals & globals, Strings opFlags, Strings opArgs) globals.preserveInstalled = true; else if (arg == "--remove-all" || arg == "-r") globals.removeAll = true; - else if (arg == "--lazy-generation") - globals.lazyGeneration = true; else throw UsageError(format("unknown flag ‘%1%’") % arg); } @@ -620,7 +617,7 @@ static void upgradeDerivations(Globals & globals, if (globals.dryRun) return; if (createUserEnv(*globals.state, newElems, - globals.profile, settings.envKeepDerivations, lockToken, globals.lazyGeneration)) break; + globals.profile, settings.envKeepDerivations, lockToken)) break; } } @@ -684,7 +681,7 @@ static void opSetFlag(Globals & globals, Strings opFlags, Strings opArgs) /* Write the new user environment. */ if (createUserEnv(*globals.state, installedElems, - globals.profile, settings.envKeepDerivations, lockToken, globals.lazyGeneration)) break; + globals.profile, settings.envKeepDerivations, lockToken)) break; } } @@ -721,8 +718,7 @@ static void opSet(Globals & globals, Strings opFlags, Strings opArgs) } debug(format("switching to new user environment")); - Path generation = createGeneration(globals.profile, drv.queryOutPath(), - globals.lazyGeneration); + Path generation = createGeneration(globals.profile, drv.queryOutPath()); switchLink(globals.profile, generation); } @@ -755,7 +751,7 @@ static void uninstallDerivations(Globals & globals, Strings & selectors, if (globals.dryRun) return; if (createUserEnv(*globals.state, newElems, - profile, settings.envKeepDerivations, lockToken, globals.lazyGeneration)) break; + profile, settings.envKeepDerivations, lockToken)) break; } } @@ -1359,7 +1355,6 @@ int main(int argc, char * * argv) globals.preserveInstalled = false; globals.removeAll = false; globals.prebuiltOnly = false; - globals.lazyGeneration = false; parseCmdLine(argc, argv, [&](Strings::iterator & arg, const Strings::iterator & end) { Operation oldOp = op; diff --git a/src/nix-env/profiles.cc b/src/nix-env/profiles.cc index f2caa9868209..cedefb157a4b 100644 --- a/src/nix-env/profiles.cc +++ b/src/nix-env/profiles.cc @@ -74,7 +74,7 @@ static void makeName(const Path & profile, unsigned int num, } -Path createGeneration(Path profile, Path outPath, bool lazy) +Path createGeneration(Path profile, Path outPath) { /* The new generation number should be higher than old the previous ones. */ @@ -85,9 +85,9 @@ Path createGeneration(Path profile, Path outPath, bool lazy) if (gens.size() > 0) { Generation last = gens.back(); - if (lazy && readLink(last.path) == outPath) { - /* If lazy generations are enabled then we only create a - new generation symlink if it differs from the last one. + if (readLink(last.path) == outPath) { + /* We only create a new generation symlink if it differs + from the last one. This helps keeping gratuitous installs/rebuilds from piling up uncontrolled numbers of generations, cluttering up the diff --git a/src/nix-env/profiles.hh b/src/nix-env/profiles.hh index 64c98e0d6888..30d2376d998c 100644 --- a/src/nix-env/profiles.hh +++ b/src/nix-env/profiles.hh @@ -31,7 +31,7 @@ typedef list Generations; profile, sorted by generation number. */ Generations findGenerations(Path profile, int & curGen); -Path createGeneration(Path profile, Path outPath, bool lazy); +Path createGeneration(Path profile, Path outPath); void deleteGeneration(const Path & profile, unsigned int gen); diff --git a/src/nix-env/user-env.cc b/src/nix-env/user-env.cc index 43db6b513e1d..3bc31b9eafeb 100644 --- a/src/nix-env/user-env.cc +++ b/src/nix-env/user-env.cc @@ -28,7 +28,7 @@ DrvInfos queryInstalled(EvalState & state, const Path & userEnv) bool createUserEnv(EvalState & state, DrvInfos & elems, const Path & profile, bool keepDerivations, - const string & lockToken, bool lazyGeneration) + const string & lockToken) { /* Build the components in the user environment, if they don't exist already. */ @@ -141,7 +141,7 @@ bool createUserEnv(EvalState & state, DrvInfos & elems, } debug(format("switching to new user environment")); - Path generation = createGeneration(profile, topLevelOut, lazyGeneration); + Path generation = createGeneration(profile, topLevelOut); switchLink(profile, generation); return true; diff --git a/src/nix-env/user-env.hh b/src/nix-env/user-env.hh index 4fedd19aa7c6..f188efe9b4a9 100644 --- a/src/nix-env/user-env.hh +++ b/src/nix-env/user-env.hh @@ -8,6 +8,6 @@ DrvInfos queryInstalled(EvalState & state, const Path & userEnv); bool createUserEnv(EvalState & state, DrvInfos & elems, const Path & profile, bool keepDerivations, - const string & lockToken, bool lazyGeneration); + const string & lockToken); } -- cgit 1.4.1