<commit_before># This function builds and tests an Autoconf-style source tarball.
# The result can be installed normally in an environment (e.g., after
# making it available through a channel).  If `doCoverageAnalysis' is
# true, it does an ordinary build from a source tarball, except that
# it turns on GCC's coverage analysis feature.  It then runs `make
# check' and produces a coverage analysis report using `lcov'.

{ buildOutOfSourceTree ? false
, preConfigure ? null
, doCoverageAnalysis ? false
, lcovFilter ? []
, lcovExtraTraceFiles ? []
, src, stdenv
, name ? if doCoverageAnalysis then "nix-coverage" else "nix-build"
, failureHook ? null
, prePhases ? []
, postPhases ? []
, ... } @ args:

stdenv.mkDerivation (

  {
    # Also run a `make check'.
    doCheck = true;

    # When doing coverage analysis, we don't care about the result.
    dontInstall = doCoverageAnalysis;
    useTempPrefix = doCoverageAnalysis;

    showBuildStats = true;

    finalPhase =
      ''
        # Propagate the release name of the source tarball.  This is
        # to get nice package names in channels.
        if test -e $origSrc/nix-support/hydra-release-name; then
          cp $origSrc/nix-support/hydra-release-name $out/nix-support/hydra-release-name
        fi
      '';

    failureHook = (stdenv.lib.optionalString (failureHook != null) failureHook) +
    ''
      if test -n "$succeedOnFailure"; then
          if test -n "$keepBuildDirectory"; then
              KEEPBUILDDIR="$out/`basename $TMPDIR`"
              header "Copying build directory to $KEEPBUILDDIR"
              mkdir -p $KEEPBUILDDIR
              cp -R $TMPDIR/* $KEEPBUILDDIR
              stopNest 
          fi
      fi
    '';
  }

  // args // 

  {
    name = name + (if src ? version then "-" + src.version else "");
  
    postHook = ''
      . ${./functions.sh}
      origSrc=$src
      src=$(findTarballs $src | head -1)

      # Set GCC flags for coverage analysis, if desired.
      if test -n "${toString doCoverageAnalysis}"; then
          export NIX_CFLAGS_COMPILE="-O0 --coverage $NIX_CFLAGS_COMPILE"
          export CFLAGS="-O0"
          export CXXFLAGS="-O0"
      fi
    ''; # */

    initPhase = ''
      mkdir -p $out/nix-support
      echo "$system" > $out/nix-support/system

      if [ -z "${toString doCoverageAnalysis}" ]; then
          echo "nix-build none $out" >> $out/nix-support/hydra-build-products<commit_msg>releaseTools.nixBuild: Support builds with multiple outputs<commit_after># This function builds and tests an Autoconf-style source tarball.
# The result can be installed normally in an environment (e.g., after
# making it available through a channel).  If `doCoverageAnalysis' is
# true, it does an ordinary build from a source tarball, except that
# it turns on GCC's coverage analysis feature.  It then runs `make
# check' and produces a coverage analysis report using `lcov'.

{ buildOutOfSourceTree ? false
, preConfigure ? null
, doCoverageAnalysis ? false
, lcovFilter ? []
, lcovExtraTraceFiles ? []
, src, stdenv
, name ? if doCoverageAnalysis then "nix-coverage" else "nix-build"
, failureHook ? null
, prePhases ? []
, postPhases ? []
, ... } @ args:

stdenv.mkDerivation (

  {
    # Also run a `make check'.
    doCheck = true;

    # When doing coverage analysis, we don't care about the result.
    dontInstall = doCoverageAnalysis;
    useTempPrefix = doCoverageAnalysis;

    showBuildStats = true;

    finalPhase =
      ''
        # Propagate the release name of the source tarball.  This is
        # to get nice package names in channels.
        if test -e $origSrc/nix-support/hydra-release-name; then
          cp $origSrc/nix-support/hydra-release-name $out/nix-support/hydra-release-name
        fi
      '';

    failureHook = (stdenv.lib.optionalString (failureHook != null) failureHook) +
    ''
      if test -n "$succeedOnFailure"; then
          if test -n "$keepBuildDirectory"; then
              KEEPBUILDDIR="$out/`basename $TMPDIR`"
              header "Copying build directory to $KEEPBUILDDIR"
              mkdir -p $KEEPBUILDDIR
              cp -R $TMPDIR/* $KEEPBUILDDIR
              stopNest
          fi
      fi
    '';
  }

  // args //

  {
    name = name + (if src ? version then "-" + src.version else "");

    postHook = ''
      . ${./functions.sh}
      origSrc=$src
      src=$(findTarballs $src | head -1)

      # Set GCC flags for coverage analysis, if desired.
      if test -n "${toString doCoverageAnalysis}"; then
          export NIX_CFLAGS_COMPILE="-O0 --coverage $NIX_CFLAGS_COMPILE"
          export CFLAGS="-O0"
          export CXXFLAGS="-O0"
      fi
    ''; # */

    initPhase = ''
      mkdir -p $out/nix-support
      echo "$system" > $out/nix-support/system

      if [ -z "${toString doCoverageAnalysis}" ]; then
          for i in $outputs; do
              if [ "$i" = out ]; then j=none; else j="$i"; fi
              echo "nix-build $j ''${!i}" >> $out/nix-support/hydra-build-products
          done
{'fraction_non_alphanumeric': 0.1110223642172524, 'fraction_numerical': 0.001597444089456869, 'mean_word_length': 2.416780354706685, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5513181', 'n_tokens_mistral': 1569, 'n_tokens_neox': 1518, 'n_words': 466}