diff options
author | Qyriad <qyriad@qyriad.me> | 2024-07-07 05:47:41 -0600 |
---|---|---|
committer | Qyriad <qyriad@qyriad.me> | 2024-07-08 17:52:02 +0000 |
commit | accfd8aa9d786831e6e08e92162891e99e11c08a (patch) | |
tree | 6204766bdc72f73c87d454f30a106c012259c2e0 /src/libexpr/get-drvs.hh | |
parent | d461cc1d7b2f489c3886f147166ba5b5e0e37541 (diff) |
libexpr: stop lying about DrvInfo's constness
DrvInfo's query methods all use mutable fields to cache, but like.
that's basically the entire interface for DrvInfo. Not only that, but
these formerly-const-marked functions can even throw due to eval errors!
Changing this only required removing some `const` markers in nix-env,
and changing a single inline `queryInstalled()` call to be an lvalue
instead.
Change-Id: I796807118f3b35b0e93668b5e28210d9e521b2ae
Diffstat (limited to 'src/libexpr/get-drvs.hh')
-rw-r--r-- | src/libexpr/get-drvs.hh | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/libexpr/get-drvs.hh b/src/libexpr/get-drvs.hh index 584d64ac1..d620eca63 100644 --- a/src/libexpr/get-drvs.hh +++ b/src/libexpr/get-drvs.hh @@ -19,11 +19,11 @@ public: private: EvalState * state; - mutable std::string name; - mutable std::string system; - mutable std::optional<std::optional<StorePath>> drvPath; - mutable std::optional<StorePath> outPath; - mutable std::string outputName; + std::string name; + std::string system; + std::optional<std::optional<StorePath>> drvPath; + std::optional<StorePath> outPath; + std::string outputName; Outputs outputs; /** @@ -47,12 +47,12 @@ public: DrvInfo(EvalState & state, std::string attrPath, Bindings * attrs); DrvInfo(EvalState & state, ref<Store> store, const std::string & drvPathWithOutputs); - std::string queryName() const; - std::string querySystem() const; - std::optional<StorePath> queryDrvPath() const; - StorePath requireDrvPath() const; - StorePath queryOutPath() const; - std::string queryOutputName() const; + std::string queryName(); + std::string querySystem(); + std::optional<StorePath> queryDrvPath(); + StorePath requireDrvPath(); + StorePath queryOutPath(); + std::string queryOutputName(); /** * Return the unordered map of output names to (optional) output paths. * The "outputs to install" are determined by `meta.outputsToInstall`. |