reproduce.tt: Add --help flag

[?]
May 2, 2013, 2:04 PM
5Q4ZLL37EZJQJ2VJW2Z5NRR4C7TA6657HLZXXKM4UWSGEMII7SRQC

Dependencies

  • [2] HZWUT4YN Allow users to reproduce builds on their own systems

Change contents

  • replacement in src/root/reproduce.tt at line 1
    [2.527][2.528:539]()
    #! /bin/sh
    [2.527]
    [2.539]
    #! /usr/bin/env bash
  • edit in src/root/reproduce.tt at line 7
    [2.660]
    [2.660]
    tmpDir=${TMPDIR:-/tmp}/build-[% build.id +%]
    declare -a args extraArgs
    # Process the command line.
    while [ $# -gt 0 ]; do
    arg="$1"
    shift
    if [ "$arg" = --help ]; then
    cat <<EOF
    Usage: $0 [--dir PATH] [--run-env]
  • replacement in src/root/reproduce.tt at line 20
    [2.661][2.661:678]()
    export NIX_PATH=
    [2.661]
    [2.678]
    This script will reproduce Hydra build [% build.id %] of job [%
    build.project.name %]:[% build.jobset.name %]:[% build.job.name +%]
    (available at [%+ c.uri_for('/build' build.id) +%]). It will fetch
    all inputs of the Hydra build, then invoke Nix to build the job and
    all its dependencies.
    The inputs will be stored in $tmpDir. This can be overriden using the
    --dir flag. After the build, the result of the build is available via
    the symlink $tmpDir/result.
    Flags:
    --dir PATH
    Override the location where the inputs and result symlink are stored.
    --run-env
    Fetch the inputs and build the dependencies, then start an
    interactive shell in which the environment is equal to that used
    to perform the build. See the description of the --run-env flag
    in the nix-build(1) manpage for more details.
    Any additional flags are passed to nix-build. See the nix-build(1)
    manpage for details.
    EOF
    exit 0
    elif [ "$arg" = --dir ]; then
    tmpDir="$1"
    if [ -z "$tmpDir" ]; then
    echo "$0: --dir requires an argument" >&2
    exit 1
    fi
    shift
    else
    extraArgs+=("$arg")
    fi
    done
  • replacement in src/root/reproduce.tt at line 57
    [2.679][2.679:806]()
    srcDir=${TMPDIR:-/tmp}/build-[% build.id +%]
    mkdir -p "$srcDir"/build
    cd "$srcDir"/build
    echo "storing sources in $srcDir" >&2
    [2.679]
    [2.806]
    export NIX_PATH=
  • replacement in src/root/reproduce.tt at line 60
    [2.807][2.807:823]()
    declare -a args
    [2.807]
    [2.823]
    mkdir -p "$tmpDir"
    cd "$tmpDir"
    echo "storing sources in $tmpDir" >&2
  • replacement in src/root/reproduce.tt at line 72
    [2.925][2.925:972]()
    inputDir="$srcDir/[% input.name %]/git-export"
    [2.925]
    [2.972]
    inputDir="$tmpDir/[% input.name %]/git-export"
  • replacement in src/root/reproduce.tt at line 90
    [2.1672][2.1672:1719]()
    inputDir="$srcDir/[% input.name %]/hg-archive"
    [2.1672]
    [2.1719]
    inputDir="$tmpDir/[% input.name %]/hg-archive"
  • replacement in src/root/reproduce.tt at line 105
    [2.2224][2.2224:2271]()
    inputDir="$srcDir/[% input.name %]/svn-export"
    [2.2224]
    [2.2271]
    inputDir="$tmpDir/[% input.name %]/svn-export"
  • replacement in src/root/reproduce.tt at line 154
    [2.3568][2.3568:3665]()
    nix-build "$nixExprInputDir/[% build.nixexprpath %]" -A '[% build.job.name %]' "${args[@]}" "$@"
    [2.3568]
    nix-build "$nixExprInputDir/[% build.nixexprpath %]" -A '[% build.job.name %]' "${args[@]}" "${extraArgs[@]}"