aboutsummaryrefslogtreecommitdiff
path: root/src/nix-store
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2005-02-07 13:40:40 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2005-02-07 13:40:40 +0000
commit450c358e2055488897349bf50951cce16ad9bc90 (patch)
treef669cc7b444fc753b8964b8de68d9571a83cc08b /src/nix-store
parenta37338815de6affd44f927712143f626c8e6d79d (diff)
* Maintain a database table (`derivers') that maps output paths to the
derivation that produced them. * `nix-store -qd PATH' prints out the derivation that produced a path.
Diffstat (limited to 'src/nix-store')
-rw-r--r--src/nix-store/main.cc17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/nix-store/main.cc b/src/nix-store/main.cc
index d473475b8..4b8d2cf3f 100644
--- a/src/nix-store/main.cc
+++ b/src/nix-store/main.cc
@@ -162,7 +162,7 @@ static void printPathSet(const PathSet & paths)
static void opQuery(Strings opFlags, Strings opArgs)
{
enum { qOutputs, qRequisites, qReferences, qReferers,
- qReferersClosure, qGraph } query = qOutputs;
+ qReferersClosure, qDeriver, qGraph } query = qOutputs;
bool useOutput = false;
bool includeOutputs = false;
bool forceRealise = false;
@@ -174,6 +174,7 @@ static void opQuery(Strings opFlags, Strings opArgs)
else if (*i == "--references") query = qReferences;
else if (*i == "--referers") query = qReferers;
else if (*i == "--referers-closure") query = qReferersClosure;
+ else if (*i == "--deriver" || *i == "-d") query = qDeriver;
else if (*i == "--graph") query = qGraph;
else if (*i == "--use-output" || *i == "-u") useOutput = true;
else if (*i == "--force-realise" || *i == "-f") forceRealise = true;
@@ -214,6 +215,18 @@ static void opQuery(Strings opFlags, Strings opArgs)
break;
}
+ case qDeriver:
+ for (Strings::iterator i = opArgs.begin();
+ i != opArgs.end(); i++)
+ {
+ *i = followSymlinks(*i);
+ Path deriver = queryDeriver(noTxn, *i);
+ cout << format("%1%\n") %
+ (deriver == "" ? "unknown-deriver" : deriver);
+ }
+ break;
+
+
#if 0
case qGraph: {
PathSet roots;
@@ -288,7 +301,7 @@ static void opValidPath(Strings opFlags, Strings opArgs)
createStoreTransaction(txn);
for (Strings::iterator i = opArgs.begin();
i != opArgs.end(); ++i)
- registerValidPath(txn, *i, hashPath(htSHA256, *i), PathSet());
+ registerValidPath(txn, *i, hashPath(htSHA256, *i), PathSet(), "");
txn.commit();
}