aboutsummaryrefslogtreecommitdiff
path: root/pkgs/build-support/fetchurl
diff options
context:
space:
mode:
authorBenjamin Hipple <bhipple@protonmail.com>2020-05-04 22:45:19 -0400
committerGitHub <noreply@github.com>2020-05-04 22:45:19 -0400
commitba160ab7412e16bff2914535fc20c5630b26040c (patch)
treebce6aec19abca1410c8d581591907b1567a3b540 /pkgs/build-support/fetchurl
parent4eeddd4c637c931caaa548db9c4992733581b4ad (diff)
parent6367a55312f42e3d321bab1fb2c69342b36eedee (diff)
Merge pull request #85410 from matthewbauer/skip-post-fetch-in-hashed-mirrors
fetchurl: don’t run ‘postFetch’ on hashed-mirrors
Diffstat (limited to 'pkgs/build-support/fetchurl')
-rw-r--r--pkgs/build-support/fetchurl/builder.sh15
1 files changed, 13 insertions, 2 deletions
diff --git a/pkgs/build-support/fetchurl/builder.sh b/pkgs/build-support/fetchurl/builder.sh
index 74fdc320835f..e93c98419a67 100644
--- a/pkgs/build-support/fetchurl/builder.sh
+++ b/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.