* Log support in the generic builder. Just set $logPhases to 1 and
it will write the output of each phase to a separate log file in $out/log/. svn path=/nixpkgs/trunk/; revision=1152
This commit is contained in:
parent
331f913861
commit
93efdb400a
@ -168,6 +168,44 @@ closeNest() {
|
|||||||
trap "closeNest" EXIT
|
trap "closeNest" EXIT
|
||||||
|
|
||||||
|
|
||||||
|
# Ensure that the given directory exists.
|
||||||
|
ensureDir() {
|
||||||
|
local dir=$1
|
||||||
|
if ! test -x "$dir"; then mkdir -p "$dir"; fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Redirect stdout/stderr to a `tee' process that writes the specified
|
||||||
|
# file (and also to our original stdout). This requires bash. The
|
||||||
|
# original stdout is saved in descriptor 3.
|
||||||
|
startLog() {
|
||||||
|
local logFile=${logNr}_$1
|
||||||
|
logNr=$((logNr + 1))
|
||||||
|
if test "$logPhases" = 1; then
|
||||||
|
ensureDir $logDir
|
||||||
|
exec 3>&1
|
||||||
|
if test "$dontLogThroughTee" != 1; then
|
||||||
|
eval "exec > >(tee $logDir/$logFile) 2>&1"
|
||||||
|
else
|
||||||
|
exec > $logDir/$logFile 2>&1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
if test -z "$logDir"; then
|
||||||
|
logDir=$out/log
|
||||||
|
fi
|
||||||
|
|
||||||
|
logNr=0
|
||||||
|
|
||||||
|
# Restore the original stdout/stderr.
|
||||||
|
stopLog() {
|
||||||
|
if test "$logPhases" = 1; then
|
||||||
|
exec >&3 2>&1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# Utility function: return the base name of the given path, with the
|
# Utility function: return the base name of the given path, with the
|
||||||
# prefix `HASH-' removed, if present.
|
# prefix `HASH-' removed, if present.
|
||||||
stripHash() {
|
stripHash() {
|
||||||
@ -178,13 +216,6 @@ stripHash() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Ensure that the given directory exists.
|
|
||||||
ensureDir() {
|
|
||||||
local dir=$1
|
|
||||||
if ! test -x "$dir"; then mkdir "$dir"; fi
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
unpackFile() {
|
unpackFile() {
|
||||||
local file=$1
|
local file=$1
|
||||||
local cmd
|
local cmd
|
||||||
@ -287,7 +318,9 @@ unpackW() {
|
|||||||
|
|
||||||
unpackPhase() {
|
unpackPhase() {
|
||||||
header "unpacking sources"
|
header "unpacking sources"
|
||||||
|
startLog "unpack"
|
||||||
unpackW
|
unpackW
|
||||||
|
stopLog
|
||||||
stopNest
|
stopNest
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -309,7 +342,9 @@ patchW() {
|
|||||||
patchPhase() {
|
patchPhase() {
|
||||||
if test -z "$patchPhase" -a -z "$patches"; then return; fi
|
if test -z "$patchPhase" -a -z "$patches"; then return; fi
|
||||||
header "patching sources"
|
header "patching sources"
|
||||||
|
startLog "patch"
|
||||||
patchW
|
patchW
|
||||||
|
stopLog
|
||||||
stopNest
|
stopNest
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -368,7 +403,9 @@ configureW() {
|
|||||||
|
|
||||||
configurePhase() {
|
configurePhase() {
|
||||||
header "configuring"
|
header "configuring"
|
||||||
|
startLog "configure"
|
||||||
configureW
|
configureW
|
||||||
|
stopLog
|
||||||
stopNest
|
stopNest
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -389,7 +426,9 @@ buildPhase() {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
header "building"
|
header "building"
|
||||||
|
startLog "build"
|
||||||
buildW
|
buildW
|
||||||
|
stopLog
|
||||||
stopNest
|
stopNest
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -414,7 +453,9 @@ checkPhase() {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
header "checking"
|
header "checking"
|
||||||
|
startLog "check"
|
||||||
checkW
|
checkW
|
||||||
|
stopLog
|
||||||
stopNest
|
stopNest
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -457,7 +498,9 @@ installPhase() {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
header "installing"
|
header "installing"
|
||||||
|
startLog "install"
|
||||||
installW
|
installW
|
||||||
|
stopLog
|
||||||
stopNest
|
stopNest
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -495,7 +538,9 @@ distPhase() {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
header "creating distribution"
|
header "creating distribution"
|
||||||
|
startLog "dist"
|
||||||
distW
|
distW
|
||||||
|
stopLog
|
||||||
stopNest
|
stopNest
|
||||||
}
|
}
|
||||||
|
|
||||||
|
20
pkgs/stdenv/nix-linux-branch/default.nix
Normal file
20
pkgs/stdenv/nix-linux-branch/default.nix
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{stdenv, glibc, pkgs, genericStdenv, gccWrapper}:
|
||||||
|
|
||||||
|
genericStdenv {
|
||||||
|
name = "stdenv-nix-linux";
|
||||||
|
preHook = ./prehook.sh;
|
||||||
|
initialPath = (import ../nix/path.nix) {pkgs = pkgs;};
|
||||||
|
|
||||||
|
inherit stdenv;
|
||||||
|
|
||||||
|
gcc = gccWrapper {
|
||||||
|
name = pkgs.gcc.name;
|
||||||
|
nativeTools = false;
|
||||||
|
nativeGlibc = false;
|
||||||
|
inherit (pkgs) gcc binutils;
|
||||||
|
inherit stdenv glibc;
|
||||||
|
shell = pkgs.bash ~ /bin/sh;
|
||||||
|
};
|
||||||
|
|
||||||
|
shell = pkgs.bash ~ /bin/bash;
|
||||||
|
}
|
1
pkgs/stdenv/nix-linux-branch/prehook.sh
Normal file
1
pkgs/stdenv/nix-linux-branch/prehook.sh
Normal file
@ -0,0 +1 @@
|
|||||||
|
export NIX_ENFORCE_PURITY=1
|
@ -150,7 +150,7 @@
|
|||||||
|
|
||||||
|
|
||||||
# Testing the new stdenv-linux (TODO: remove this eventually).
|
# Testing the new stdenv-linux (TODO: remove this eventually).
|
||||||
stdenvLinuxTest = (import ../stdenv/nix-linux) {
|
stdenvLinuxTest = (import ../stdenv/nix-linux-branch) {
|
||||||
stdenv = stdenvLinuxBoot2;
|
stdenv = stdenvLinuxBoot2;
|
||||||
pkgs = stdenvLinuxBoot2Pkgs;
|
pkgs = stdenvLinuxBoot2Pkgs;
|
||||||
glibc = stdenvLinuxGlibc;
|
glibc = stdenvLinuxGlibc;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user