about summary refs log tree commit diff
path: root/scripts/generate-patches.pl
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/generate-patches.pl')
-rwxr-xr-xscripts/generate-patches.pl12
1 files changed, 10 insertions, 2 deletions
diff --git a/scripts/generate-patches.pl b/scripts/generate-patches.pl
index e084b994db9b..7d957839bb24 100755
--- a/scripts/generate-patches.pl
+++ b/scripts/generate-patches.pl
@@ -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,