diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2010-04-19 12:10:04 +0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2010-04-19 12:10:04 +0000 |
commit | 55b5ddd3ca1ff4dfe4cfbfab92a4025d88ef6443 (patch) | |
tree | d9377895a711709f73ceabb10b511b91b0d3b4e5 /src/libexpr | |
parent | b7ff69eb7c3f97c33ec18c51ab87b7f3dd967052 (diff) | |
download | guix-55b5ddd3ca1ff4dfe4cfbfab92a4025d88ef6443.tar.gz |
* Added parsing of manifests in ATerm format.
Diffstat (limited to 'src/libexpr')
-rw-r--r-- | src/libexpr/get-drvs.cc | 16 | ||||
-rw-r--r-- | src/libexpr/get-drvs.hh | 5 |
2 files changed, 15 insertions, 6 deletions
diff --git a/src/libexpr/get-drvs.cc b/src/libexpr/get-drvs.cc index 8af011d549..e9f1063d95 100644 --- a/src/libexpr/get-drvs.cc +++ b/src/libexpr/get-drvs.cc @@ -7,7 +7,7 @@ namespace nix { string DrvInfo::queryDrvPath(EvalState & state) const { - if (drvPath == "") { + if (drvPath == "" && attrs) { Bindings::iterator i = attrs->find(state.sDrvPath); PathSet context; (string &) drvPath = i != attrs->end() ? state.coerceToPath(i->second, context) : ""; @@ -18,7 +18,7 @@ string DrvInfo::queryDrvPath(EvalState & state) const string DrvInfo::queryOutPath(EvalState & state) const { - if (outPath == "") { + if (outPath == "" && attrs) { Bindings::iterator i = attrs->find(state.sOutPath); PathSet context; (string &) outPath = i != attrs->end() ? state.coerceToPath(i->second, context) : ""; @@ -29,7 +29,9 @@ string DrvInfo::queryOutPath(EvalState & state) const MetaInfo DrvInfo::queryMetaInfo(EvalState & state) const { - MetaInfo meta; + if (metaInfoRead) return meta; + + (bool &) metaInfoRead = true; Bindings::iterator a = attrs->find(state.sMeta); if (a == attrs->end()) return meta; /* fine, empty meta information */ @@ -50,7 +52,7 @@ MetaInfo DrvInfo::queryMetaInfo(EvalState & state) const for (unsigned int j = 0; j < i->second.list.length; ++j) value.stringValues.push_back(state.forceStringNoCtx(*i->second.list.elems[j])); } else continue; - meta[i->first] = value; + ((MetaInfo &) meta)[i->first] = value; } return meta; @@ -66,9 +68,11 @@ MetaValue DrvInfo::queryMetaInfo(EvalState & state, const string & name) const void DrvInfo::setMetaInfo(const MetaInfo & meta) { - throw Error("not implemented"); + metaInfoRead = true; + this->meta = meta; + #if 0 - ATermMap metaAttrs; + Value * metaAttrs = state.allocValues(1); foreach (MetaInfo::const_iterator, i, meta) { Expr e; switch (i->second.type) { diff --git a/src/libexpr/get-drvs.hh b/src/libexpr/get-drvs.hh index f7d1987ea3..6f3c381f8e 100644 --- a/src/libexpr/get-drvs.hh +++ b/src/libexpr/get-drvs.hh @@ -29,6 +29,9 @@ struct DrvInfo private: string drvPath; string outPath; + + bool metaInfoRead; + MetaInfo meta; public: string name; @@ -38,6 +41,8 @@ public: /* !!! make this private */ Bindings * attrs; + DrvInfo() : metaInfoRead(false) { }; + string queryDrvPath(EvalState & state) const; string queryOutPath(EvalState & state) const; MetaInfo queryMetaInfo(EvalState & state) const; |