reproduce.tt: Use color

This commit is contained in:
Eelco Dolstra 2013-05-02 16:24:30 +02:00
parent a468a28840
commit edaeb892e7

View file

@ -9,6 +9,11 @@ tmpDir=${TMPDIR:-/tmp}/build-[% build.id +%]
declare -a args extraArgs declare -a args extraArgs
info() {
echo "$1" >&2
}
# Process the command line. # Process the command line.
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
arg="$1" arg="$1"
@ -59,7 +64,7 @@ export NIX_PATH=
mkdir -p "$tmpDir" mkdir -p "$tmpDir"
cd "$tmpDir" cd "$tmpDir"
echo "storing inputs and results in $tmpDir" >&2 info "storing inputs and results in $tmpDir..."
requireCommand() { requireCommand() {
@ -82,8 +87,7 @@ inputDir=
inputDir="$tmpDir/[% input.name %]/git-export" inputDir="$tmpDir/[% input.name %]/git-export"
if ! [ -d "$inputDir" ]; then if ! [ -d "$inputDir" ]; then
echo info "fetching Git input [% input.name %] from [% input.uri %] (commit [% input.revision %])..."
echo "fetching Git input [% input.name %] from [% input.uri %] (commit [% input.revision %])..." >&2
requireCommand git requireCommand git
inputDirTmp="$inputDir.tmp" inputDirTmp="$inputDir.tmp"
rm -rf "$inputDirTmp" rm -rf "$inputDirTmp"
@ -102,8 +106,7 @@ args+=(--arg '[% input.name %]' "{ outPath = $inputDir; rev = \"[% input.revisio
inputDir="$tmpDir/[% input.name %]/hg-archive" inputDir="$tmpDir/[% input.name %]/hg-archive"
if ! [ -d "$inputDir" ]; then if ! [ -d "$inputDir" ]; then
echo info "fetching Mercurial input [% input.name %] from [% input.uri %] (commit [% input.revision %])..."
echo "fetching Mercurial input [% input.name %] from [% input.uri %] (commit [% input.revision %])..." >&2
requireCommand hg requireCommand hg
inputDirTmp="$inputDir.tmp" inputDirTmp="$inputDir.tmp"
rm -rf "$inputDirTmp" rm -rf "$inputDirTmp"
@ -119,8 +122,7 @@ args+=(--arg '[% input.name %]' "{ outPath = $inputDir; rev = \"[% input.revisio
inputDir="$tmpDir/[% input.name %]/svn-export" inputDir="$tmpDir/[% input.name %]/svn-export"
if ! [ -d "$inputDir" ]; then if ! [ -d "$inputDir" ]; then
echo info "fetching Subversion input [% input.name %] from [% input.uri %] (commit [% input.revision %])..."
echo "fetching Subversion input [% input.name %] from [% input.uri %] (commit [% input.revision %])..." >&2
requireCommand svn requireCommand svn
rm -rf "$inputDir.tmp" rm -rf "$inputDir.tmp"
svn export '[% input.uri %]@[% input.revision %]' "$inputDir.tmp" svn export '[% input.uri %]@[% input.revision %]' "$inputDir.tmp"
@ -166,8 +168,8 @@ fi
# when evaluating jobs that rely on builtins.currentSystem. # when evaluating jobs that rely on builtins.currentSystem.
args+=(--option system x86_64-linux) args+=(--option system x86_64-linux)
echo info "running nix-build..."
echo "Nix path is $NIX_PATH" >&2 echo "Nix path is $NIX_PATH" >&2
echo "Nix args are ${args[@]}" >&2 echo "Nix args are ${args[@]}" >&2
nix-build "$nixExprInputDir/[% build.nixexprpath %]" -A '[% build.job.name %]' "${args[@]}" "${extraArgs[@]}" exec nix-build "$nixExprInputDir/[% build.nixexprpath %]" -A '[% build.job.name %]' "${args[@]}" "${extraArgs[@]}"