diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2020-08-28 19:59:14 +0000 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2020-08-28 19:59:14 +0000 |
commit | 8017fe7487ff545ac7be68bd7b339fffffa12b8f (patch) | |
tree | f9e5f5fec9acc96ae66d7369d42803344866facd /src/libstore/derivations.cc | |
parent | 3a7b330b64c6ea77e18a0a96aad7fb14947382d9 (diff) | |
parent | f15651303f8596bf34c67fc8d536b1e9e7843a87 (diff) |
Merge remote-tracking branch 'upstream/master' into single-ca-drv-build
Diffstat (limited to 'src/libstore/derivations.cc')
-rw-r--r-- | src/libstore/derivations.cc | 38 |
1 files changed, 5 insertions, 33 deletions
diff --git a/src/libstore/derivations.cc b/src/libstore/derivations.cc index 5319c1a38..e5ec60811 100644 --- a/src/libstore/derivations.cc +++ b/src/libstore/derivations.cc @@ -68,7 +68,7 @@ bool BasicDerivation::isBuiltin() const } -StorePath writeDerivation(ref<Store> store, +StorePath writeDerivation(Store & store, const Derivation & drv, RepairFlag repair) { auto references = drv.inputSrcs; @@ -78,10 +78,10 @@ StorePath writeDerivation(ref<Store> store, (that can be missing (of course) and should not necessarily be held during a garbage collection). */ auto suffix = std::string(drv.name) + drvExtension; - auto contents = drv.unparse(*store, false); + auto contents = drv.unparse(store, false); return settings.readOnlyMode - ? store->computeStorePathForText(suffix, contents, references) - : store->addTextToStore(suffix, contents, references, repair); + ? store.computeStorePathForText(suffix, contents, references) + : store.addTextToStore(suffix, contents, references, repair); } @@ -200,7 +200,7 @@ static DerivationOutput parseDerivationOutput(const Store & store, std::istrings } -static Derivation parseDerivation(const Store & store, std::string && s, std::string_view name) +Derivation parseDerivation(const Store & store, std::string && s, std::string_view name) { Derivation drv; drv.name = name; @@ -248,34 +248,6 @@ static Derivation parseDerivation(const Store & store, std::string && s, std::st } -Derivation readDerivation(const Store & store, const Path & drvPath, std::string_view name) -{ - try { - return parseDerivation(store, readFile(drvPath), name); - } catch (FormatError & e) { - throw Error("error parsing derivation '%1%': %2%", drvPath, e.msg()); - } -} - - -Derivation Store::derivationFromPath(const StorePath & drvPath) -{ - ensurePath(drvPath); - return readDerivation(drvPath); -} - - -Derivation Store::readDerivation(const StorePath & drvPath) -{ - auto accessor = getFSAccessor(); - try { - return parseDerivation(*this, accessor->readFile(printStorePath(drvPath)), Derivation::nameFromPath(drvPath)); - } catch (FormatError & e) { - throw Error("error parsing derivation '%s': %s", printStorePath(drvPath), e.msg()); - } -} - - static void printString(string & res, std::string_view s) { char buf[s.size() * 2 + 2]; |