* Use named pipes explicitly instead of through bash's process

substitution feature (which appears to be buggy - there's no way to
  wait for an output redirection, and bash sometimes appears to die
  due to subtle timing conditions).  This also removes the most
  egregious dependency on bash.

svn path=/nixpkgs/trunk/; revision=1258
This commit is contained in:
Eelco Dolstra 2004-08-11 15:26:09 +00:00
parent 2ec94563bc
commit f7035ee5ca
6 changed files with 21 additions and 54 deletions

View File

@ -1,19 +0,0 @@
{stdenv, genericStdenv, gccWrapper}:
genericStdenv {
name = "stdenv-darwin";
preHook = ./prehook.sh;
initialPath = "/usr/local /usr /";
inherit stdenv;
gcc = gccWrapper {
name = "gcc-darwin";
nativeTools = true;
nativeGlibc = true;
nativePrefix = "/usr";
inherit stdenv;
};
shell = "/bin/bash";
}

View File

@ -1,6 +0,0 @@
export NIX_ENFORCE_PURITY=
export NIX_DONT_SET_RPATH=1
export NIX_NO_SELF_RPATH=1
dontFixLibtool=1
NIX_STRIP_DEBUG=0
echo XXX $NIX_DONT_SET_RPATH

View File

@ -203,19 +203,24 @@ ensureDir() {
}
# 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.
# Redirect stdout/stderr to a named pipe connected to a `tee' process
# that writes the specified file (and also to our original stdout).
# 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
# Put this in an `eval' so that non-bash shells (or bash
# invoked as `sh') won't choke on parsing this file.
eval "exec > >(tee $logDir/$logFile) 2>&1"
# This required named pipes (fifos).
logFifo=$NIX_BUILD_TOP/log_fifo
test -p $logFifo || mkfifo $logFifo
tee $logDir/$logFile < $logFifo &
logTeePid=$!
exec > $logFifo 2>&1
else
exec > $logDir/$logFile 2>&1
fi
@ -232,6 +237,14 @@ logNr=0
stopLog() {
if test "$logPhases" = 1; then
exec >&3 2>&1
# Wait until the tee process has died. Otherwise output from
# different phases may be mixed up.
if test -n "$logTeePid"; then
wait $logTeePid
logTeePid=
rm $logFifo
fi
fi
}

View File

@ -1,20 +0,0 @@
{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;
}

View File

@ -1 +0,0 @@
export NIX_ENFORCE_PURITY=1

View File

@ -150,7 +150,7 @@
# Testing the new stdenv-linux (TODO: remove this eventually).
stdenvLinuxTest = (import ../stdenv/nix-linux-branch) {
stdenvLinuxTest = (import ../stdenv/nix-linux) {
stdenv = stdenvLinuxBoot2;
pkgs = stdenvLinuxBoot2Pkgs;
glibc = stdenvLinuxGlibc;
@ -158,7 +158,7 @@
inherit gccWrapper;
};
stdenvDarwinTest = (import ../stdenv/darwin-branch) {
stdenvDarwinTest = (import ../stdenv/darwin) {
stdenv = stdenvInitial;
genericStdenv = import ../stdenv/generic-branch;
inherit gccWrapper;