diff --git a/src/libstore/profiles.cc b/src/libstore/profiles.cc index 6862b42f0..e91dd781e 100644 --- a/src/libstore/profiles.cc +++ b/src/libstore/profiles.cc @@ -72,7 +72,7 @@ static void makeName(const Path & profile, GenerationNumber num, } -Path createGeneration(ref store, Path profile, Path outPath) +Path createGeneration(ref store, Path profile, StorePath outPath) { /* The new generation number should be higher than old the previous ones. */ @@ -82,7 +82,7 @@ Path createGeneration(ref store, Path profile, Path outPath) if (gens.size() > 0) { Generation last = gens.back(); - if (readLink(last.path) == outPath) { + if (readLink(last.path) == store->printStorePath(outPath)) { /* We only create a new generation symlink if it differs from the last one. @@ -105,7 +105,7 @@ Path createGeneration(ref store, Path profile, Path outPath) user environment etc. we've just built. */ Path generation; makeName(profile, num + 1, generation); - store->addPermRoot(store->parseStorePath(outPath), generation, false, true); + store->addPermRoot(outPath, generation, false, true); return generation; } diff --git a/src/libstore/profiles.hh b/src/libstore/profiles.hh index abe507f0e..be55a65d4 100644 --- a/src/libstore/profiles.hh +++ b/src/libstore/profiles.hh @@ -8,6 +8,8 @@ namespace nix { +class StorePath; + typedef unsigned int GenerationNumber; @@ -28,7 +30,7 @@ std::pair> findGenerations(Path pro class LocalFSStore; -Path createGeneration(ref store, Path profile, Path outPath); +Path createGeneration(ref store, Path profile, StorePath outPath); void deleteGeneration(const Path & profile, GenerationNumber gen); diff --git a/src/nix-env/nix-env.cc b/src/nix-env/nix-env.cc index ddd036070..e5a433ac0 100644 --- a/src/nix-env/nix-env.cc +++ b/src/nix-env/nix-env.cc @@ -708,7 +708,9 @@ static void opSet(Globals & globals, Strings opFlags, Strings opArgs) } debug(format("switching to new user environment")); - Path generation = createGeneration(ref(store2), globals.profile, drv.queryOutPath()); + Path generation = createGeneration( + ref(store2), globals.profile, + store2->parseStorePath(drv.queryOutPath())); switchLink(globals.profile, generation); } diff --git a/src/nix-env/user-env.cc b/src/nix-env/user-env.cc index 8e7f09e12..8c6c8af05 100644 --- a/src/nix-env/user-env.cc +++ b/src/nix-env/user-env.cc @@ -151,7 +151,8 @@ bool createUserEnv(EvalState & state, DrvInfos & elems, } debug(format("switching to new user environment")); - Path generation = createGeneration(ref(store2), profile, topLevelOut); + Path generation = createGeneration(ref(store2), profile, + store2->parseStorePath(topLevelOut)); switchLink(profile, generation); } diff --git a/src/nix/command.cc b/src/nix/command.cc index 2f1fbded1..efac230bd 100644 --- a/src/nix/command.cc +++ b/src/nix/command.cc @@ -134,7 +134,7 @@ void MixProfile::updateProfile(const StorePath & storePath) switchLink(profile2, createGeneration( ref(store), - profile2, store->printStorePath(storePath))); + profile2, storePath)); } void MixProfile::updateProfile(const Buildables & buildables)