diff options
author | Matthew Bauer <mjbauer95@gmail.com> | 2020-04-16 16:32:35 -0500 |
---|---|---|
committer | Matthew Bauer <mjbauer95@gmail.com> | 2020-04-16 16:36:56 -0500 |
commit | 6367a55312f42e3d321bab1fb2c69342b36eedee (patch) | |
tree | c6961363938538decd22f9d786bbf78cfefa3165 /pkgs/build-support | |
parent | 8262ecd369c40be522ba31d9da6306006010fbf1 (diff) | |
download | nixlib-6367a55312f42e3d321bab1fb2c69342b36eedee.tar nixlib-6367a55312f42e3d321bab1fb2c69342b36eedee.tar.gz nixlib-6367a55312f42e3d321bab1fb2c69342b36eedee.tar.bz2 nixlib-6367a55312f42e3d321bab1fb2c69342b36eedee.tar.lz nixlib-6367a55312f42e3d321bab1fb2c69342b36eedee.tar.xz nixlib-6367a55312f42e3d321bab1fb2c69342b36eedee.tar.zst nixlib-6367a55312f42e3d321bab1fb2c69342b36eedee.zip |
fetchurl: don’t run ‘postFetch’ on hashed-mirrors
hashed-mirrors are 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.
Diffstat (limited to 'pkgs/build-support')
-rw-r--r-- | pkgs/build-support/fetchurl/builder.sh | 15 |
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. |