mirror of
https://github.com/NixOS/nix.git
synced 2025-11-16 15:32:43 +01:00
DerivationOutput::parseHashInfo: Return a tuple
This commit is contained in:
parent
c3b55a96a7
commit
76325ce5cd
4 changed files with 8 additions and 12 deletions
|
|
@ -3106,8 +3106,7 @@ void DerivationGoal::registerOutputs()
|
|||
hash). */
|
||||
if (fixedOutput) {
|
||||
|
||||
bool recursive; Hash h;
|
||||
i.second.parseHashInfo(recursive, h);
|
||||
auto [recursive, h] = i.second.parseHashInfo();
|
||||
|
||||
if (!recursive) {
|
||||
/* The output path should be a regular file without
|
||||
|
|
|
|||
|
|
@ -9,21 +9,19 @@
|
|||
namespace nix {
|
||||
|
||||
|
||||
void DerivationOutput::parseHashInfo(bool & recursive, Hash & hash) const
|
||||
std::pair<bool, Hash> DerivationOutput::parseHashInfo() const
|
||||
{
|
||||
recursive = false;
|
||||
bool recursive = false;
|
||||
string algo = hashAlgo;
|
||||
|
||||
if (string(algo, 0, 2) == "r:") {
|
||||
if (string(algo, 0, 2) == "r:")
|
||||
recursive = true;
|
||||
algo = string(algo, 2);
|
||||
}
|
||||
|
||||
HashType hashType = parseHashType(algo);
|
||||
HashType hashType = parseHashType(recursive ? string(algo, 2) : algo);
|
||||
if (hashType == htUnknown)
|
||||
throw Error(format("unknown hash algorithm '%1%'") % algo);
|
||||
|
||||
hash = Hash(this->hash, hashType);
|
||||
return {recursive, Hash(this->hash, hashType)};
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ struct DerivationOutput
|
|||
this->hashAlgo = hashAlgo;
|
||||
this->hash = hash;
|
||||
}
|
||||
void parseHashInfo(bool & recursive, Hash & hash) const;
|
||||
std::pair<bool, Hash> parseHashInfo() const;
|
||||
};
|
||||
|
||||
typedef std::map<string, DerivationOutput> DerivationOutputs;
|
||||
|
|
|
|||
|
|
@ -548,8 +548,7 @@ void LocalStore::checkDerivationOutputs(const Path & drvPath, const Derivation &
|
|||
if (out == drv.outputs.end())
|
||||
throw Error(format("derivation '%1%' does not have an output named 'out'") % drvPath);
|
||||
|
||||
bool recursive; Hash h;
|
||||
out->second.parseHashInfo(recursive, h);
|
||||
auto [recursive, h] = out->second.parseHashInfo();
|
||||
Path outPath = makeFixedOutputPath(recursive, h, drvName);
|
||||
|
||||
StringPairs::const_iterator j = drv.env.find("out");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue