1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-03 06:11:46 +02:00

* In nix-store: added query `--referers-closure' that returns the

closure of the referers relation rather than the references
  relation, i.e., the set of all paths that directly or indirectly
  refer to the given path.  Note that contrary to the references
  closure this set is not fixed; it can change as paths are added to
  or removed from the store.
This commit is contained in:
Eelco Dolstra 2005-01-25 11:18:03 +00:00
parent 80faa2f98a
commit 52bf9b86bb
5 changed files with 31 additions and 10 deletions

View file

@ -4,7 +4,8 @@ nix-store [OPTIONS...] [ARGUMENTS...]
Operations:
--realise / -r: build a Nix derivation
--realise / -r: ensure path validity; if a derivation, ensure that
validity of the outputs
--add / -A: copy a path to the Nix store
--query / -q: query information
@ -27,9 +28,16 @@ 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 refering to 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
--graph: print a dot graph rooted at given ids
Query switches (not applicable to all queries):
--use-output: perform query on output of derivation, not derivation itself
--force-realise: realise the path before performing the query
--include-outputs: in `-R' on a derivation, include requisites of outputs
Options:
--verbose / -v: verbose operation (may be repeated)

View file

@ -96,7 +96,8 @@ static void printPathSet(const PathSet & paths)
/* Perform various sorts of queries. */
static void opQuery(Strings opFlags, Strings opArgs)
{
enum { qOutputs, qRequisites, qReferences, qReferers, qGraph } query = qOutputs;
enum { qOutputs, qRequisites, qReferences, qReferers,
qReferersClosure, qGraph } query = qOutputs;
bool useOutput = false;
bool includeOutputs = false;
bool forceRealise = false;
@ -107,6 +108,7 @@ static void opQuery(Strings opFlags, Strings opArgs)
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 == "--graph") query = qGraph;
else if (*i == "--use-output" || *i == "-u") useOutput = true;
else if (*i == "--force-realise" || *i == "-f") forceRealise = true;
@ -128,7 +130,8 @@ static void opQuery(Strings opFlags, Strings opArgs)
case qRequisites:
case qReferences:
case qReferers: {
case qReferers:
case qReferersClosure: {
PathSet paths;
for (Strings::iterator i = opArgs.begin();
i != opArgs.end(); i++)
@ -138,6 +141,7 @@ static void opQuery(Strings opFlags, Strings opArgs)
storePathRequisites(path, includeOutputs, paths);
else if (query == qReferences) queryReferences(path, paths);
else if (query == qReferers) queryReferers(path, paths);
else if (query == qReferersClosure) computeFSClosure(path, paths, true);
}
printPathSet(paths);
break;