diff options
Diffstat (limited to 'src/libexpr')
-rw-r--r-- | src/libexpr/get-drvs.cc | 9 | ||||
-rw-r--r-- | src/libexpr/get-drvs.hh | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/libexpr/get-drvs.cc b/src/libexpr/get-drvs.cc index bd0ec4781cfe..daa987fe713b 100644 --- a/src/libexpr/get-drvs.cc +++ b/src/libexpr/get-drvs.cc @@ -60,6 +60,15 @@ MetaInfo DrvInfo::queryMetaInfo(EvalState & state) const } +string DrvInfo::queryMetaInfo(EvalState & state, const string & name) const +{ + /* !!! evaluates all meta attributes => inefficient */ + MetaInfo meta = queryMetaInfo(state); + MetaInfo::iterator i = meta.find(name); + return i == meta.end() ? "" : i->second; +} + + void DrvInfo::setMetaInfo(const MetaInfo & meta) { ATermMap metaAttrs; diff --git a/src/libexpr/get-drvs.hh b/src/libexpr/get-drvs.hh index 920197d1fb37..46dc51a568af 100644 --- a/src/libexpr/get-drvs.hh +++ b/src/libexpr/get-drvs.hh @@ -34,6 +34,7 @@ public: string queryDrvPath(EvalState & state) const; string queryOutPath(EvalState & state) const; MetaInfo queryMetaInfo(EvalState & state) const; + string queryMetaInfo(EvalState & state, const string & name) const; void setDrvPath(const string & s) { |