mirror of
https://github.com/NixOS/nix
synced 2025-06-26 15:51:15 +02:00
* Atomic file replacement is good.
This commit is contained in:
parent
e1e9c036f9
commit
2fdb27e7f2
2 changed files with 14 additions and 3 deletions
|
@ -198,9 +198,17 @@ foreach my $p (keys %dstOutPaths) {
|
|||
|
||||
my $finalName =
|
||||
"$narBz2Hash-$name-$closestVersion-to-$version.nar-diff";
|
||||
|
||||
system("cp '$tmpdir/DIFF' '$patchesDir/$finalName'") == 0
|
||||
|
||||
if (-e "$patchesDir/$finalName") {
|
||||
print " not copying, already exists\n";
|
||||
next;
|
||||
}
|
||||
|
||||
system("cp '$tmpdir/DIFF' '$patchesDir/$finalName.tmp'") == 0
|
||||
or die "cannot copy diff";
|
||||
|
||||
rename("$patchesDir/$finalName.tmp", "$patchesDir/$finalName")
|
||||
or die "cannot rename $patchesDir/$finalName.tmp";
|
||||
|
||||
# Add the patch to the manifest.
|
||||
addPatch \%dstPatches, $p,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue