1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-25 19:51:00 +01:00

* Bug fixes.

This commit is contained in:
Eelco Dolstra 2008-03-08 22:48:08 +00:00
parent a7154c5b14
commit 4df6dc28c3
4 changed files with 13 additions and 11 deletions

View file

@ -275,7 +275,7 @@ void LocalStore::registerValidPath(const Path & path,
} }
void LocalStore::registerValidPath(const ValidPathInfo & info) void LocalStore::registerValidPath(const ValidPathInfo & info, bool ignoreValidity)
{ {
Path infoFile = infoFileFor(info.path); Path infoFile = infoFileFor(info.path);
@ -300,7 +300,7 @@ void LocalStore::registerValidPath(const ValidPathInfo & info)
if (!refs.empty()) refs += " "; if (!refs.empty()) refs += " ";
refs += *i; refs += *i;
if (*i != info.path && !isValidPath(*i)) if (!ignoreValidity && *i != info.path && !isValidPath(*i))
throw Error(format("cannot register `%1%' as valid, because its reference `%2%' isn't valid") throw Error(format("cannot register `%1%' as valid, because its reference `%2%' isn't valid")
% info.path % *i); % info.path % *i);

View file

@ -121,7 +121,7 @@ private:
/* Store paths for which the referrers file must be purged. */ /* Store paths for which the referrers file must be purged. */
PathSet delayedUpdates; PathSet delayedUpdates;
void registerValidPath(const ValidPathInfo & info); void registerValidPath(const ValidPathInfo & info, bool ignoreValidity = false);
ValidPathInfo queryPathInfo(const Path & path); ValidPathInfo queryPathInfo(const Path & path);

View file

@ -267,6 +267,7 @@ struct ValidPathInfo
Hash hash; Hash hash;
PathSet references; PathSet references;
time_t registrationTime; time_t registrationTime;
ValidPathInfo() : registrationTime(0) { }
}; };
typedef list<ValidPathInfo> ValidPathInfos; typedef list<ValidPathInfo> ValidPathInfos;

View file

@ -58,19 +58,20 @@ void LocalStore::upgradeStore12()
nixDB.enumTable(noTxn, dbValidPaths, paths); nixDB.enumTable(noTxn, dbValidPaths, paths);
for (Paths::iterator i = paths.begin(); i != paths.end(); ++i) { for (Paths::iterator i = paths.begin(); i != paths.end(); ++i) {
PathSet references; ValidPathInfo info;
Paths references2; info.path = *i;
nixDB.queryStrings(noTxn, dbReferences, *i, references2);
references.insert(references2.begin(), references2.end()); Paths references;
nixDB.queryStrings(noTxn, dbReferences, *i, references);
info.references.insert(references.begin(), references.end());
string s; string s;
nixDB.queryString(noTxn, dbValidPaths, *i, s); nixDB.queryString(noTxn, dbValidPaths, *i, s);
Hash hash =parseHashField(*i, s); info.hash = parseHashField(*i, s);
Path deriver; nixDB.queryString(noTxn, dbDerivers, *i, info.deriver);
nixDB.queryString(noTxn, dbDerivers, *i, deriver);
registerValidPath(*i, hash, references, deriver); registerValidPath(info, true);
std::cerr << "."; std::cerr << ".";
} }