aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/storeexpr.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2005-01-19 14:36:00 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2005-01-19 14:36:00 +0000
commit06c77bf7a861221d41b5db9fad3002f13a14ed0e (patch)
tree8ddd8857f0364297bb8ffce1cf6a89b7cf0d396e /src/libstore/storeexpr.cc
parent863dcff6c5ffc163010ec1f9e6819bb9aaaadc29 (diff)
* Change extension `.store' to `.drv'.
* Re-enable `nix-store --query --requisites'.
Diffstat (limited to 'src/libstore/storeexpr.cc')
-rw-r--r--src/libstore/storeexpr.cc15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/libstore/storeexpr.cc b/src/libstore/storeexpr.cc
index d7c87bfa1..a9240130e 100644
--- a/src/libstore/storeexpr.cc
+++ b/src/libstore/storeexpr.cc
@@ -12,11 +12,10 @@ Hash hashTerm(ATerm t)
}
-Path writeTerm(ATerm t, const string & suffix)
+Path writeDerivation(const Derivation & drv, const string & name)
{
- char * s = ATwriteToString(t);
- if (!s) throw Error("cannot print aterm");
- return addTextToStore(suffix + ".store", string(s));
+ return addTextToStore(name + drvExtension,
+ atPrint(unparseDerivation(drv)));
}
@@ -133,3 +132,11 @@ ATerm unparseDerivation(const Derivation & drv)
ATreverse(args),
ATreverse(env));
}
+
+
+bool isDerivation(const string & fileName)
+{
+ return
+ fileName.size() >= drvExtension.size() &&
+ string(fileName, fileName.size() - drvExtension.size()) == drvExtension;
+}