* Allow a build to finish "succesfully" as far as Nix is concerned
even if some build phase failed if the variable `$succeedOnFailure' is set to 1. If that happens, the file `$out/nix-support/failed' is created to mark the build result as bad. This is useful for release management systems that might want to publish failed releases. svn path=/nixpkgs/trunk/; revision=1163
This commit is contained in:
parent
8b0e40b3d4
commit
0c7969f9c8
@ -37,6 +37,29 @@ if test -f $NIX_GCC/nix-support/setup-hook; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Called when some build action fails. If $succeedOnFailure is set,
|
||||||
|
# create the file `$out/nix-support/failed' to signal failure, and
|
||||||
|
# exit normally. Otherwise, exit with failure.
|
||||||
|
fail() {
|
||||||
|
exitCode=$?
|
||||||
|
if test "$succeedOnFailure" = 1; then
|
||||||
|
ensureDir "$out/nix-support"
|
||||||
|
touch "$out/nix-support/failed"
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
exit $?
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Allow the caller to augment buildInputs (it's not always possible to
|
||||||
|
# do this before the call to setup.sh, since the PATH is empty at that
|
||||||
|
# point; here we have a basic Unix environment).
|
||||||
|
if test -n "$addInputsHook"; then
|
||||||
|
$addInputsHook
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Recursively find all build inputs.
|
# Recursively find all build inputs.
|
||||||
findInputs()
|
findInputs()
|
||||||
{
|
{
|
||||||
@ -76,6 +99,11 @@ addToEnv()
|
|||||||
{
|
{
|
||||||
local pkg=$1
|
local pkg=$1
|
||||||
|
|
||||||
|
if test "$ignoreFailedInputs" != "1" -a -e $1/nix-support/failed; then
|
||||||
|
echo "failed input $1" >&2
|
||||||
|
fail
|
||||||
|
fi
|
||||||
|
|
||||||
if test -d $1/bin; then
|
if test -d $1/bin; then
|
||||||
export _PATH=$_PATH${_PATH:+:}$1/bin
|
export _PATH=$_PATH${_PATH:+:}$1/bin
|
||||||
fi
|
fi
|
||||||
@ -245,7 +273,7 @@ unpackFile() {
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
header "unpacking source archive $file (using $cmd)" 3
|
header "unpacking source archive $file (using $cmd)" 3
|
||||||
$cmd
|
$cmd || fail
|
||||||
stopNest
|
stopNest
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -339,7 +367,7 @@ patchW() {
|
|||||||
|
|
||||||
for i in $patches; do
|
for i in $patches; do
|
||||||
header "applying patch $i" 3
|
header "applying patch $i" 3
|
||||||
patch -p1 < $i
|
patch -p1 < $i || fail
|
||||||
stopNest
|
stopNest
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@ -399,7 +427,7 @@ configureW() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "configure flags: $configureFlags"
|
echo "configure flags: $configureFlags"
|
||||||
$configureScript $configureFlags
|
$configureScript $configureFlags || fail
|
||||||
|
|
||||||
if test -n "$postConfigure"; then
|
if test -n "$postConfigure"; then
|
||||||
$postConfigure
|
$postConfigure
|
||||||
@ -423,7 +451,7 @@ buildW() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "make flags: $makeFlags"
|
echo "make flags: $makeFlags"
|
||||||
make $makeFlags
|
make $makeFlags || fail
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -450,7 +478,7 @@ checkW() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "check flags: $checkFlags"
|
echo "check flags: $checkFlags"
|
||||||
make $checkFlags $checkTarget
|
make $checkFlags $checkTarget || fail
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -480,16 +508,16 @@ installW() {
|
|||||||
|
|
||||||
if test -z "$dontMakeInstall"; then
|
if test -z "$dontMakeInstall"; then
|
||||||
echo "install flags: $installFlags"
|
echo "install flags: $installFlags"
|
||||||
make install $installFlags
|
make install $installFlags || fail
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -z "$dontStrip" -a "$NIX_STRIP_DEBUG" = 1; then
|
if test -z "$dontStrip" -a "$NIX_STRIP_DEBUG" = 1; then
|
||||||
find "$prefix" -name "*.a" -exec echo stripping {} \; -exec strip -S {} \;
|
find "$prefix" -name "*.a" -exec echo stripping {} \; \
|
||||||
|
-exec strip -S {} \; || fail
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -n "$propagatedBuildInputs"; then
|
if test -n "$propagatedBuildInputs"; then
|
||||||
ensureDir "$out"
|
ensureDir "$out/nix-support"
|
||||||
if ! test -x "$/nix-support"; then mkdir "$out/nix-support"; fi
|
|
||||||
echo "$propagatedBuildInputs" > "$out/nix-support/propagated-build-inputs"
|
echo "$propagatedBuildInputs" > "$out/nix-support/propagated-build-inputs"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -522,10 +550,9 @@ distW() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "dist flags: $distFlags"
|
echo "dist flags: $distFlags"
|
||||||
make $distFlags $distTarget
|
make $distFlags $distTarget || fail
|
||||||
|
|
||||||
if test "$dontCopyDist" != 1; then
|
if test "$dontCopyDist" != 1; then
|
||||||
ensureDir "$out"
|
|
||||||
ensureDir "$out/tarballs"
|
ensureDir "$out/tarballs"
|
||||||
|
|
||||||
if test -z "$tarballs"; then
|
if test -z "$tarballs"; then
|
||||||
|
Loading…
Reference in New Issue
Block a user