about summary refs log tree commit diff
path: root/pkgs/common-updater/scripts/update-source-version
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/common-updater/scripts/update-source-version')
-rwxr-xr-xpkgs/common-updater/scripts/update-source-version25
1 files changed, 11 insertions, 14 deletions
diff --git a/pkgs/common-updater/scripts/update-source-version b/pkgs/common-updater/scripts/update-source-version
index fbeb375fa8918..a3a7bde17f853 100755
--- a/pkgs/common-updater/scripts/update-source-version
+++ b/pkgs/common-updater/scripts/update-source-version
@@ -206,30 +206,28 @@ oldHashEscaped=$(echo "$oldHash" | sed -re 's|[+]|\\&|g')
 tempHashEscaped=$(echo "$tempHash" | sed -re 's|[+]|\\&|g')
 
 # Replace new version
-sed -i.bak "$nixFile" -re "$pattern"
-if cmp -s "$nixFile" "$nixFile.bak"; then
+sed -i.cmp "$nixFile" -re "$pattern"
+if cmp -s "$nixFile" "$nixFile.cmp"; then
     die "Failed to replace version '$oldVersion' to '$newVersion' in '$attr'!"
 fi
 
 # Replace new URL
 if [[ -n "$newUrl" ]]; then
-    sed -i "$nixFile" -re "s|\"$oldUrlEscaped\"|\"$newUrl\"|"
-
-    if cmp -s "$nixFile" "$nixFile.bak"; then
+    sed -i.cmp "$nixFile" -re "s|\"$oldUrlEscaped\"|\"$newUrl\"|"
+    if cmp -s "$nixFile" "$nixFile.cmp"; then
         die "Failed to replace source URL '$oldUrl' to '$newUrl' in '$attr'!"
     fi
 fi
 
-sed -i "$nixFile" -re "s|\"$oldHashEscaped\"|\"$tempHash\"|"
-if cmp -s "$nixFile" "$nixFile.bak"; then
+sed -i.cmp "$nixFile" -re "s|\"$oldHashEscaped\"|\"$tempHash\"|"
+if cmp -s "$nixFile" "$nixFile.cmp"; then
     die "Failed to replace source hash of '$attr' to a temporary hash!"
 fi
 
 # Replace new revision, if given
 if [[ -n "$newRevision" ]]; then
-    sed -i "$nixFile" -re "s|\"$oldRevision\"|\"$newRevision\"|"
-
-    if cmp -s "$nixFile" "$nixFile.bak"; then
+    sed -i.cmp "$nixFile" -re "s|\"$oldRevision\"|\"$newRevision\"|"
+    if cmp -s "$nixFile" "$nixFile.cmp"; then
         die "Failed to replace source revision '$oldRevision' to '$newRevision' in '$attr'!"
     fi
 fi
@@ -254,16 +252,15 @@ if [[ -z "$newHash" ]]; then
 fi
 
 if [[ -z "${ignoreSameHash}" && "$oldVersion" != "$newVersion" && "$oldHash" = "$newHash" ]]; then
-    mv "$nixFile.bak" "$nixFile"
     die "Both the old and new source hashes of '$attr.$sourceKey' were equivalent. Please fix the package's source URL to be dependent on '\${version}'!"
 fi
 
-sed -i "$nixFile" -re "s|\"$tempHashEscaped\"|\"$newHash\"|"
-if cmp -s "$nixFile" "$nixFile.bak"; then
+sed -i.cmp "$nixFile" -re "s|\"$tempHashEscaped\"|\"$newHash\"|"
+if cmp -s "$nixFile" "$nixFile.cmp"; then
     die "Failed to replace temporary source hash of '$attr' to the final source hash!"
 fi
 
-rm -f "$nixFile.bak"
+rm -f "$nixFile.cmp"
 rm -f "$attr.fetchlog"
 
 if [ -n "$printChanges" ]; then