From ab5c6bb3a3deef29c6fe0a86017d35bc4f3de506 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 13 Dec 2005 21:04:48 +0000 Subject: * Change `referer' to `referrer' throughout. In particular, the nix-store query options `--referer' and `--referer-closure' have been changed to `--referrer' and `--referrer-closure' (but the old ones are still accepted for compatibility). --- src/libstore/build.hh | 5 ++-- src/libstore/gc.cc | 4 ++-- src/libstore/misc.cc | 2 +- src/libstore/store.cc | 64 +++++++++++++++++++++++++------------------------- src/libstore/store.hh | 4 ++-- src/nix-store/help.txt | 4 ++-- src/nix-store/main.cc | 16 ++++++------- 7 files changed, 50 insertions(+), 49 deletions(-) (limited to 'src') diff --git a/src/libstore/build.hh b/src/libstore/build.hh index 45997ebb24d0..9e3d365e989a 100644 --- a/src/libstore/build.hh +++ b/src/libstore/build.hh @@ -23,8 +23,9 @@ Derivation derivationFromPath(const Path & drvPath); closure of `storePath'; that is, all paths than can be directly or indirectly reached from it. `paths' is not cleared. If `flipDirection' is true, the set of paths that can reach - `storePath' is returned; that is, the closures under the `referers' - relation instead of the `references' relation is returned. */ + `storePath' is returned; that is, the closures under the + `referrers' relation instead of the `references' relation is + returned. */ void computeFSClosure(const Path & storePath, PathSet & paths, bool flipDirection = false); diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc index 634c610263b0..bdaf2946ca58 100644 --- a/src/libstore/gc.cc +++ b/src/libstore/gc.cc @@ -401,8 +401,8 @@ void collectGarbage(GCAction action, PathSet & result) for (Paths::iterator i = storePaths.begin(); i != storePaths.end(); ++i) storePaths2.insert(canonPath(nixStore + "/" + *i)); - /* Topologically sort them under the `referers' relation. That - is, a < b iff a is in referers(b). This gives us the order in + /* Topologically sort them under the `referrers' relation. That + is, a < b iff a is in referrers(b). This gives us the order in which things can be deleted safely. */ /* !!! when we have multiple output paths per derivation, this will not work anymore because we get cycles. */ diff --git a/src/libstore/misc.cc b/src/libstore/misc.cc index f3cc98bf4e2a..33efe8bebc98 100644 --- a/src/libstore/misc.cc +++ b/src/libstore/misc.cc @@ -19,7 +19,7 @@ void computeFSClosure(const Path & storePath, PathSet references; if (flipDirection) - queryReferers(noTxn, storePath, references); + queryReferrers(noTxn, storePath, references); else queryReferences(noTxn, storePath, references); diff --git a/src/libstore/store.cc b/src/libstore/store.cc index db12ba2d537b..48f09fefe144 100644 --- a/src/libstore/store.cc +++ b/src/libstore/store.cc @@ -309,7 +309,7 @@ static string stripPrefix(const string & prefix, const string & s) } -static PathSet getReferers(const Transaction & txn, const Path & storePath) +static PathSet getReferrers(const Transaction & txn, const Path & storePath) { PathSet referrers; Strings keys; @@ -338,13 +338,13 @@ void setReferences(const Transaction & txn, const Path & storePath, nixDB.setStrings(txn, dbReferences, storePath, Paths(references.begin(), references.end())); - /* Update the referers mappings of all new referenced paths. */ + /* Update the referrers mappings of all new referenced paths. */ for (PathSet::const_iterator i = references.begin(); i != references.end(); ++i) if (oldReferences2.find(*i) == oldReferences2.end()) nixDB.setString(txn, dbReferrers, addPrefix(*i, storePath), ""); - /* Remove referer mappings from paths that are no longer + /* Remove referrer mappings from paths that are no longer references. */ for (Paths::iterator i = oldReferences.begin(); i != oldReferences.end(); ++i) @@ -364,13 +364,13 @@ void queryReferences(const Transaction & txn, } -void queryReferers(const Transaction & txn, - const Path & storePath, PathSet & referers) +void queryReferrers(const Transaction & txn, + const Path & storePath, PathSet & referrers) { if (!isRealisablePath(txn, storePath)) throw Error(format("path `%1%' is not valid") % storePath); - PathSet referers2 = getReferers(txn, storePath); - referers.insert(referers2.begin(), referers2.end()); + PathSet referrers2 = getReferrers(txn, storePath); + referrers.insert(referrers2.begin(), referrers2.end()); } @@ -499,9 +499,9 @@ void clearSubstitutes() invalidatePath(txn, *i); } - /* !!! there should be no referers to any of the invalid + /* !!! there should be no referrers to any of the invalid substitutable paths. This should be the case by construction - (the only referers can be other invalid substitutable paths, + (the only referrers can be other invalid substitutable paths, which have all been removed now). */ txn.commit(); @@ -587,13 +587,13 @@ void registerValidPaths(const Transaction & txn, /* Invalidate a path. The caller is responsible for checking that - there are no referers. */ + there are no referrers. */ static void invalidatePath(Transaction & txn, const Path & path) { debug(format("unregistering path `%1%'") % path); /* Clear the `references' entry for this path, as well as the - inverse `referers' entries, and the `derivers' entry; but only + inverse `referrers' entries, and the `derivers' entry; but only if there are no substitutes for this path. This maintains the cleanup invariant. */ if (querySubstitutes(txn, path).size() == 0) { @@ -754,9 +754,9 @@ void deleteFromStore(const Path & _path) Transaction txn(nixDB); if (isValidPathTxn(txn, path)) { - PathSet referers = getReferers(txn, path); - for (PathSet::iterator i = referers.begin(); - i != referers.end(); ++i) + PathSet referrers = getReferrers(txn, path); + for (PathSet::iterator i = referrers.begin(); + i != referrers.end(); ++i) if (*i != path && isValidPathTxn(txn, *i)) throw Error(format("cannot delete path `%1%' because it is in use by path `%2%'") % path % *i); invalidatePath(txn, path); @@ -817,7 +817,7 @@ void verifyStore(bool checkContents) } /* Check the cleanup invariant: only usable paths can have - `references', `referers', or `derivers' entries. */ + `references', `referrers', or `derivers' entries. */ /* Check the `derivers' table. */ Paths deriversKeys; @@ -860,7 +860,7 @@ void verifyStore(bool checkContents) { string dummy; if (!nixDB.queryString(txn, dbReferrers, addPrefix(*j, *i), dummy)) { - printMsg(lvlError, format("missing referer mapping from `%1%' to `%2%'") + printMsg(lvlError, format("missing referrer mapping from `%1%' to `%2%'") % *j % *i); nixDB.setString(txn, dbReferrers, addPrefix(*j, *i), ""); } @@ -873,26 +873,26 @@ void verifyStore(bool checkContents) } #if 0 // !!! - /* Check the `referers' table. */ - Paths referersKeys; - nixDB.enumTable(txn, dbReferers, referersKeys); - for (Paths::iterator i = referersKeys.begin(); - i != referersKeys.end(); ++i) + /* Check the `referrers' table. */ + Paths referrersKeys; + nixDB.enumTable(txn, dbReferrers, referrersKeys); + for (Paths::iterator i = referrersKeys.begin(); + i != referrersKeys.end(); ++i) { if (usablePaths.find(*i) == usablePaths.end()) { - printMsg(lvlError, format("found referers entry for unusable path `%1%'") + printMsg(lvlError, format("found referrers entry for unusable path `%1%'") % *i); - nixDB.delPair(txn, dbReferers, *i); + nixDB.delPair(txn, dbReferrers, *i); } else { - PathSet referers, newReferers; - queryReferers(txn, *i, referers); - for (PathSet::iterator j = referers.begin(); - j != referers.end(); ++j) + PathSet referrers, newReferrers; + queryReferrers(txn, *i, referrers); + for (PathSet::iterator j = referrers.begin(); + j != referrers.end(); ++j) { Paths references; if (usablePaths.find(*j) == usablePaths.end()) { - printMsg(lvlError, format("referer mapping from `%1%' to unusable `%2%'") + printMsg(lvlError, format("referrer mapping from `%1%' to unusable `%2%'") % *i % *j); } else { nixDB.queryStrings(txn, dbReferences, *j, references); @@ -901,12 +901,12 @@ void verifyStore(bool checkContents) % *j % *i); /* !!! repair by inserting *i into references */ } - else newReferers.insert(*j); + else newReferrers.insert(*j); } } - if (referers != newReferers) - nixDB.setStrings(txn, dbReferers, *i, - Paths(newReferers.begin(), newReferers.end())); + if (referrers != newReferrers) + nixDB.setStrings(txn, dbReferrers, *i, + Paths(newReferrers.begin(), newReferrers.end())); } } #endif diff --git a/src/libstore/store.hh b/src/libstore/store.hh index 2b83bd7fef04..0f35ff0c626c 100644 --- a/src/libstore/store.hh +++ b/src/libstore/store.hh @@ -123,8 +123,8 @@ void queryReferences(const Transaction & txn, /* Queries the set of incoming FS references for a store path. The result is not cleared. */ -void queryReferers(const Transaction & txn, - const Path & storePath, PathSet & referers); +void queryReferrers(const Transaction & txn, + const Path & storePath, PathSet & referrers); /* Sets the deriver of a store path. Use with care! */ void setDeriver(const Transaction & txn, const Path & storePath, diff --git a/src/nix-store/help.txt b/src/nix-store/help.txt index 643c6bff581f..62880583573f 100644 --- a/src/nix-store/help.txt +++ b/src/nix-store/help.txt @@ -28,8 +28,8 @@ Query flags: --outputs: query the output paths of a Nix derivation (default) --requisites / -R: print all paths necessary to realise a path --references: print all paths referenced by the given path - --referers: print all paths directly refering to the given path - --referers-closure: print all paths (in)directly refering to the given path + --referrers: print all paths directly refering to the given path + --referrers-closure: print all paths (in)directly refering to the given path --tree: print a tree showing the dependency graph of the given paths --graph: print a dot graph rooted at given paths diff --git a/src/nix-store/main.cc b/src/nix-store/main.cc index a6ff117cb47b..d1a96aa3a9ef 100644 --- a/src/nix-store/main.cc +++ b/src/nix-store/main.cc @@ -273,8 +273,8 @@ static void printTree(const Path & path, /* Perform various sorts of queries. */ static void opQuery(Strings opFlags, Strings opArgs) { - enum { qOutputs, qRequisites, qReferences, qReferers - , qReferersClosure, qDeriver, qBinding, qHash + enum { qOutputs, qRequisites, qReferences, qReferrers + , qReferrersClosure, qDeriver, qBinding, qHash , qTree, qGraph } query = qOutputs; bool useOutput = false; bool includeOutputs = false; @@ -286,8 +286,8 @@ static void opQuery(Strings opFlags, Strings opArgs) if (*i == "--outputs") query = qOutputs; else if (*i == "--requisites" || *i == "-R") query = qRequisites; else if (*i == "--references") query = qReferences; - else if (*i == "--referers") query = qReferers; - else if (*i == "--referers-closure") query = qReferersClosure; + else if (*i == "--referrers" || *i == "--referers") query = qReferrers; + else if (*i == "--referrers-closure" || *i == "--referers-closure") query = qReferrersClosure; else if (*i == "--deriver" || *i == "-d") query = qDeriver; else if (*i == "--binding" || *i == "-b") { if (opArgs.size() == 0) @@ -320,8 +320,8 @@ static void opQuery(Strings opFlags, Strings opArgs) case qRequisites: case qReferences: - case qReferers: - case qReferersClosure: { + case qReferrers: + case qReferrersClosure: { PathSet paths; for (Strings::iterator i = opArgs.begin(); i != opArgs.end(); ++i) @@ -330,8 +330,8 @@ static void opQuery(Strings opFlags, Strings opArgs) if (query == qRequisites) storePathRequisites(path, includeOutputs, paths); else if (query == qReferences) queryReferences(noTxn, path, paths); - else if (query == qReferers) queryReferers(noTxn, path, paths); - else if (query == qReferersClosure) computeFSClosure(path, paths, true); + else if (query == qReferrers) queryReferrers(noTxn, path, paths); + else if (query == qReferrersClosure) computeFSClosure(path, paths, true); } printPathSet(paths); break; -- cgit 1.4.1