diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2020-08-27 16:39:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-27 16:39:28 +0200 |
commit | eb75282b8dc855983368c79cc4c2943c298518f7 (patch) | |
tree | 96210a96129b8e53a3119de9ad99e742468678c2 /src/libstore/derivations.cc | |
parent | e915fd6d2afb0299bcb77069503698faabe5f233 (diff) | |
parent | 950ddfdb823891136043ae22dce0c66424c57b9d (diff) |
Merge pull request #3434 from Ericson2314/derivation-header-include-order
Revise division of labor in deserialization of derivations
Diffstat (limited to 'src/libstore/derivations.cc')
-rw-r--r-- | src/libstore/derivations.cc | 30 |
1 files changed, 1 insertions, 29 deletions
diff --git a/src/libstore/derivations.cc b/src/libstore/derivations.cc index 43bc61e55..d263cf0c5 100644 --- a/src/libstore/derivations.cc +++ b/src/libstore/derivations.cc @@ -185,7 +185,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; @@ -233,34 +233,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]; |