diff options
Diffstat (limited to 'src/libexpr')
-rw-r--r-- | src/libexpr/get-drvs.cc | 10 | ||||
-rw-r--r-- | src/libexpr/get-drvs.hh | 5 | ||||
-rw-r--r-- | src/libexpr/nixexpr.cc | 2 | ||||
-rw-r--r-- | src/libexpr/nixexpr.hh | 2 |
4 files changed, 17 insertions, 2 deletions
diff --git a/src/libexpr/get-drvs.cc b/src/libexpr/get-drvs.cc index ba9fbcd6dfac..bd0ec4781cfe 100644 --- a/src/libexpr/get-drvs.cc +++ b/src/libexpr/get-drvs.cc @@ -60,6 +60,16 @@ MetaInfo DrvInfo::queryMetaInfo(EvalState & state) const } +void DrvInfo::setMetaInfo(const MetaInfo & meta) +{ + ATermMap metaAttrs; + for (MetaInfo::const_iterator i = meta.begin(); i != meta.end(); ++i) + metaAttrs.set(toATerm(i->first), + makeAttrRHS(makeStr(i->second), makeNoPos())); + attrs->set(toATerm("meta"), makeAttrs(metaAttrs)); +} + + /* Cache for already evaluated derivations. Usually putting ATerms in a STL container is unsafe (they're not scanning for GC roots), but here it doesn't matter; everything in this set is reachable from diff --git a/src/libexpr/get-drvs.hh b/src/libexpr/get-drvs.hh index 3dac56a4f301..920197d1fb37 100644 --- a/src/libexpr/get-drvs.hh +++ b/src/libexpr/get-drvs.hh @@ -26,6 +26,9 @@ public: string attrPath; /* path towards the derivation */ string system; + /* !!! these should really be hidden, and setMetaInfo() should + make a copy since the ATermMap can be shared between multiple + DrvInfos. */ boost::shared_ptr<ATermMap> attrs; string queryDrvPath(EvalState & state) const; @@ -41,6 +44,8 @@ public: { outPath = s; } + + void setMetaInfo(const MetaInfo & meta); }; diff --git a/src/libexpr/nixexpr.cc b/src/libexpr/nixexpr.cc index 7502fd1663f5..123513594512 100644 --- a/src/libexpr/nixexpr.cc +++ b/src/libexpr/nixexpr.cc @@ -319,7 +319,7 @@ struct Canonicalise : TermFun }; -Expr canonicaliseExpr(Expr & e) +Expr canonicaliseExpr(Expr e) { Canonicalise canonicalise; return bottomupRewrite(canonicalise, e); diff --git a/src/libexpr/nixexpr.hh b/src/libexpr/nixexpr.hh index d76bc1060d33..420911a8769b 100644 --- a/src/libexpr/nixexpr.hh +++ b/src/libexpr/nixexpr.hh @@ -96,7 +96,7 @@ void checkVarDefs(const ATermMap & def, Expr e); /* Canonicalise a Nix expression by sorting attributes and removing location information. */ -Expr canonicaliseExpr(Expr & e); +Expr canonicaliseExpr(Expr e); /* Create an expression representing a boolean. */ |