about summary refs log tree commit diff
path: root/nixpkgs/pkgs/build-support/fetchurl/builder.sh
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2020-05-12 14:45:39 +0000
committerAlyssa Ross <hi@alyssa.is>2020-05-12 14:56:01 +0000
commiteb7dadee9c0f903f1152f8dd4165453bfa48ccf4 (patch)
treea6bd66dcbec895aae167465672af08a1ca70f089 /nixpkgs/pkgs/build-support/fetchurl/builder.sh
parent3879b925f5dae3a0eb5c98b10c1ac5a0e4d729a3 (diff)
parent683c68232e91f76386db979c461d8fbe2a018782 (diff)
downloadnixlib-eb7dadee9c0f903f1152f8dd4165453bfa48ccf4.tar
nixlib-eb7dadee9c0f903f1152f8dd4165453bfa48ccf4.tar.gz
nixlib-eb7dadee9c0f903f1152f8dd4165453bfa48ccf4.tar.bz2
nixlib-eb7dadee9c0f903f1152f8dd4165453bfa48ccf4.tar.lz
nixlib-eb7dadee9c0f903f1152f8dd4165453bfa48ccf4.tar.xz
nixlib-eb7dadee9c0f903f1152f8dd4165453bfa48ccf4.tar.zst
nixlib-eb7dadee9c0f903f1152f8dd4165453bfa48ccf4.zip
Merge commit '683c68232e91f76386db979c461d8fbe2a018782'
Diffstat (limited to 'nixpkgs/pkgs/build-support/fetchurl/builder.sh')
-rw-r--r--nixpkgs/pkgs/build-support/fetchurl/builder.sh15
1 files changed, 13 insertions, 2 deletions
diff --git a/nixpkgs/pkgs/build-support/fetchurl/builder.sh b/nixpkgs/pkgs/build-support/fetchurl/builder.sh
index 74fdc320835f..e93c98419a67 100644
--- a/nixpkgs/pkgs/build-support/fetchurl/builder.sh
+++ b/nixpkgs/pkgs/build-support/fetchurl/builder.sh
@@ -47,13 +47,18 @@ tryDownload() {
 
 
 finish() {
+    local skipPostFetch="$1"
+
     set +o noglob
 
     if [[ $executable == "1" ]]; then
       chmod +x $downloadedFile
     fi
 
-    runHook postFetch
+    if [ -z "$skipPostFetch" ]; then
+        runHook postFetch
+    fi
+
     exit 0
 }
 
@@ -69,7 +74,13 @@ tryHashedMirrors() {
             --fail --silent --show-error --head "$url" \
             --write-out "%{http_code}" --output /dev/null > code 2> log; then
             tryDownload "$url"
-            if test -n "$success"; then finish; fi
+
+            # We skip postFetch here, because hashed-mirrors are
+            # already content addressed. So if $outputHash is in the
+            # hashed-mirror, changes from ‘postFetch’ would already be
+            # made. So, running postFetch will end up applying the
+            # change /again/, which we don’t want.
+            if test -n "$success"; then finish skipPostFetch; fi
         else
             # Be quiet about 404 errors, which we interpret as the file
             # not being present on this particular mirror.