From 06c77bf7a861221d41b5db9fad3002f13a14ed0e Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 19 Jan 2005 14:36:00 +0000 Subject: * Change extension `.store' to `.drv'. * Re-enable `nix-store --query --requisites'. --- src/libstore/storeexpr.cc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/libstore/storeexpr.cc') diff --git a/src/libstore/storeexpr.cc b/src/libstore/storeexpr.cc index d7c87bfa151c..a9240130e755 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; +} -- cgit 1.4.1