aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/get-drvs.hh
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2022-03-10 15:48:14 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2022-03-10 15:48:14 +0000
commit8ba089597fa19bfd49ba5f22a5e821740ca4eb5d (patch)
treeb4f2299b9c973ef7636f8ce1bab0299dee4cc389 /src/libexpr/get-drvs.hh
parent13b6b645897fd2edaa0f09fa48d6fe8dd6287b55 (diff)
parent4d98143914120d0163f5c50f30ce8a5289433f8f (diff)
Merge remote-tracking branch 'upstream/master' into path-info
Diffstat (limited to 'src/libexpr/get-drvs.hh')
-rw-r--r--src/libexpr/get-drvs.hh52
1 files changed, 27 insertions, 25 deletions
diff --git a/src/libexpr/get-drvs.hh b/src/libexpr/get-drvs.hh
index 29bb6a660..3ca6f1fca 100644
--- a/src/libexpr/get-drvs.hh
+++ b/src/libexpr/get-drvs.hh
@@ -1,6 +1,7 @@
#pragma once
#include "eval.hh"
+#include "path.hh"
#include <string>
#include <map>
@@ -12,16 +13,16 @@ namespace nix {
struct DrvInfo
{
public:
- typedef std::map<string, Path> Outputs;
+ typedef std::map<std::string, StorePath> Outputs;
private:
EvalState * state;
- mutable string name;
- mutable string system;
- mutable string drvPath;
- mutable std::optional<string> outPath;
- mutable string outputName;
+ mutable std::string name;
+ mutable std::string system;
+ mutable std::optional<std::optional<StorePath>> drvPath;
+ mutable std::optional<StorePath> outPath;
+ mutable std::string outputName;
Outputs outputs;
bool failed = false; // set if we get an AssertionError
@@ -33,36 +34,37 @@ private:
bool checkMeta(Value & v);
public:
- string attrPath; /* path towards the derivation */
+ std::string attrPath; /* path towards the derivation */
DrvInfo(EvalState & state) : state(&state) { };
- DrvInfo(EvalState & state, const string & attrPath, Bindings * attrs);
+ DrvInfo(EvalState & state, std::string attrPath, Bindings * attrs);
DrvInfo(EvalState & state, ref<Store> store, const std::string & drvPathWithOutputs);
- string queryName() const;
- string querySystem() const;
- string queryDrvPath() const;
- string queryOutPath() const;
- string queryOutputName() const;
+ std::string queryName() const;
+ std::string querySystem() const;
+ std::optional<StorePath> queryDrvPath() const;
+ StorePath requireDrvPath() const;
+ StorePath queryOutPath() const;
+ std::string queryOutputName() const;
/** Return the list of outputs. The "outputs to install" are determined by `meta.outputsToInstall`. */
Outputs queryOutputs(bool onlyOutputsToInstall = false);
StringSet queryMetaNames();
- Value * queryMeta(const string & name);
- string queryMetaString(const string & name);
- NixInt queryMetaInt(const string & name, NixInt def);
- NixFloat queryMetaFloat(const string & name, NixFloat def);
- bool queryMetaBool(const string & name, bool def);
- void setMeta(const string & name, Value * v);
+ Value * queryMeta(const std::string & name);
+ std::string queryMetaString(const std::string & name);
+ NixInt queryMetaInt(const std::string & name, NixInt def);
+ NixFloat queryMetaFloat(const std::string & name, NixFloat def);
+ bool queryMetaBool(const std::string & name, bool def);
+ void setMeta(const std::string & name, Value * v);
/*
MetaInfo queryMetaInfo(EvalState & state) const;
MetaValue queryMetaInfo(EvalState & state, const string & name) const;
*/
- void setName(const string & s) { name = s; }
- void setDrvPath(const string & s) { drvPath = s; }
- void setOutPath(const string & s) { outPath = s; }
+ void setName(const std::string & s) { name = s; }
+ void setDrvPath(StorePath path) { drvPath = {{std::move(path)}}; }
+ void setOutPath(StorePath path) { outPath = {{std::move(path)}}; }
void setFailed() { failed = true; };
bool hasFailed() { return failed; };
@@ -70,9 +72,9 @@ public:
#if HAVE_BOEHMGC
-typedef list<DrvInfo, traceable_allocator<DrvInfo> > DrvInfos;
+typedef std::list<DrvInfo, traceable_allocator<DrvInfo> > DrvInfos;
#else
-typedef list<DrvInfo> DrvInfos;
+typedef std::list<DrvInfo> DrvInfos;
#endif
@@ -81,7 +83,7 @@ typedef list<DrvInfo> DrvInfos;
std::optional<DrvInfo> getDerivation(EvalState & state,
Value & v, bool ignoreAssertionFailures);
-void getDerivations(EvalState & state, Value & v, const string & pathPrefix,
+void getDerivations(EvalState & state, Value & v, const std::string & pathPrefix,
Bindings & autoArgs, DrvInfos & drvs,
bool ignoreAssertionFailures);