From c96407720010658b44dcd2a8801b05879105b9ff Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 5 Nov 2014 18:21:44 +0100 Subject: [PATCH] findTarball: Handle pipefail It was failing because the bash subshell died with SIGPIPE, which is no longer ignored. http://hydra.nixos.org/build/16766452 --- pkgs/build-support/release/ant-build.nix | 2 +- pkgs/build-support/release/binary-tarball.nix | 2 +- pkgs/build-support/release/debian-build.nix | 2 +- pkgs/build-support/release/functions.sh | 17 +++++++++++------ pkgs/build-support/release/nix-build.nix | 2 +- pkgs/build-support/release/rpm-build.nix | 2 +- 6 files changed, 16 insertions(+), 11 deletions(-) diff --git a/pkgs/build-support/release/ant-build.nix b/pkgs/build-support/release/ant-build.nix index 409c98d8d3a3..346e139d35de 100644 --- a/pkgs/build-support/release/ant-build.nix +++ b/pkgs/build-support/release/ant-build.nix @@ -108,7 +108,7 @@ stdenv.mkDerivation ( . ${./functions.sh} origSrc=$src - src=$(findTarballs $src | head -1) + src=$(findTarball $src) ''; } ) diff --git a/pkgs/build-support/release/binary-tarball.nix b/pkgs/build-support/release/binary-tarball.nix index 41fab231ee34..f691b1bf7356 100644 --- a/pkgs/build-support/release/binary-tarball.nix +++ b/pkgs/build-support/release/binary-tarball.nix @@ -38,7 +38,7 @@ stdenv.mkDerivation ( . ${./functions.sh} origSrc=$src - src=$(findTarballs $src | head -1) + src=$(findTarball $src) if test -e $origSrc/nix-support/hydra-release-name; then releaseName=$(cat $origSrc/nix-support/hydra-release-name) diff --git a/pkgs/build-support/release/debian-build.nix b/pkgs/build-support/release/debian-build.nix index 3adfe41031da..7dcc9b9552a4 100644 --- a/pkgs/build-support/release/debian-build.nix +++ b/pkgs/build-support/release/debian-build.nix @@ -32,7 +32,7 @@ vmTools.runInLinuxImage (stdenv.mkDerivation ( postHook = '' . ${./functions.sh} propagateImageName - src=$(findTarballs $src | head -1) # Find a tarball. + src=$(findTarball $src) ''; installExtraDebsPhase = '' diff --git a/pkgs/build-support/release/functions.sh b/pkgs/build-support/release/functions.sh index 0e730ffb250e..40bb32fab4e0 100644 --- a/pkgs/build-support/release/functions.sh +++ b/pkgs/build-support/release/functions.sh @@ -1,11 +1,16 @@ -findTarballs() { +findTarball() { local suffix i - test -d "$1/tarballs/" && { + if [ -f "$1" ]; then + echo "$1" + return + fi + if [ -d "$1/tarballs/" ]; then for suffix in tar.gz tgz tar.bz2 tbz2 tar.xz tar.lzma; do - for i in $1/tarballs/*.$suffix; do echo $i; done - done | sort - } - echo "$1" + for i in $1/tarballs/*.$suffix; do echo $i; return; done + done | sort | head -1 + return + fi + return 1 } canonicalizeJarManifest() { diff --git a/pkgs/build-support/release/nix-build.nix b/pkgs/build-support/release/nix-build.nix index b80c9242ed23..cb83b9db498e 100644 --- a/pkgs/build-support/release/nix-build.nix +++ b/pkgs/build-support/release/nix-build.nix @@ -89,7 +89,7 @@ stdenv.mkDerivation ( postHook = '' . ${./functions.sh} origSrc=$src - src=$(findTarballs $src | head -1) + src=$(findTarball $src) ''; preHook = '' diff --git a/pkgs/build-support/release/rpm-build.nix b/pkgs/build-support/release/rpm-build.nix index 9a1c7eeee626..194bbc60534e 100644 --- a/pkgs/build-support/release/rpm-build.nix +++ b/pkgs/build-support/release/rpm-build.nix @@ -16,7 +16,7 @@ vmTools.buildRPM ( preBuild = '' . ${./functions.sh} propagateImageName - src=$(findTarballs $src | head -1) # Pick the first tarball. + src=$(findTarball $src) ''; postInstall = ''