fix(3p/nix): passAsFile: hash the attribute name instead of numbering sequentially
This makes the paths consistent without relying on ordering. Co-authored-by: edef <edef@edef.eu> (cherry picked from commit 515c0a263e137a00e82f7d981284dbe54db23247)
This commit is contained in:
parent
976b49f2ed
commit
7cc7fdacbe
1 changed files with 2 additions and 2 deletions
4
third_party/nix/src/libstore/build.cc
vendored
4
third_party/nix/src/libstore/build.cc
vendored
|
@ -2485,12 +2485,12 @@ void DerivationGoal::initTmpDir() {
|
|||
if (!parsedDrv->getStructuredAttrs()) {
|
||||
std::set<std::string> passAsFile =
|
||||
absl::StrSplit(get(drv->env, "passAsFile"), absl::ByAnyChar(" \t\n\r"));
|
||||
int fileNr = 0;
|
||||
for (auto& i : drv->env) {
|
||||
if (passAsFile.find(i.first) == passAsFile.end()) {
|
||||
env[i.first] = i.second;
|
||||
} else {
|
||||
std::string fn = ".attr-" + std::to_string(fileNr++);
|
||||
auto hash = hashString(htSHA256, i.first);
|
||||
std::string fn = ".attr-" + hash.to_string();
|
||||
Path p = tmpDir + "/" + fn;
|
||||
writeFile(p, rewriteStrings(i.second, inputRewrites));
|
||||
chownToBuilder(p);
|
||||
|
|
Loading…
Reference in a new issue