<commit_before>#!/usr/bin/env bash

#  Copyright (c) 2014-present, Facebook, Inc.
#  All rights reserved.
#
#  This source code is licensed as defined on the LICENSE file found in the
#  root directory of this source tree.

# 1: Path to install brew into
# 2: Linux or Darwin
function setup_brew() {
  DEPS="$1"
  BREW_TYPE="$2"
  ACTION="$3"

  if [[ "$BREW_TYPE" == "linux" ]]; then
    BREW_REPO=$LINUXBREW_REPO
    BREW_COMMIT=$LINUXBREW_BREW
    CORE_COMMIT=$LINUXBREW_CORE
    CORE_REPO=$LINUXBREW_CORE_REPO
  else
    BREW_REPO=$HOMEBREW_REPO
    BREW_COMMIT=$HOMEBREW_BREW
    CORE_COMMIT=$HOMEBREW_CORE
    CORE_REPO=$HOMEBREW_CORE_REPO
  fi

  # Checkout new brew in local deps dir
  if [[ -z "$HOMEBREW_NO_AUTO_UPDATE" ]]; then
    if [[ ! -d "$DEPS/.git" ]]; then
      log "setting up new brew in $DEPS"
      git clone $BREW_REPO "$DEPS"
    elif [[ ! "$ACTION" = "bottle" ]]; then
      log "checking for updates to brew"
      git fetch origin > /dev/null
      git reset --hard origin/master > /dev/null
      git clean -f
    fi
  fi

  # Reset to a deterministic checkout of brew.
  git reset --hard $BREW_COMMIT

  # Create a local cache directory
  mkdir -p "$DEPS/.cache"

  # Always update the location of the local tap link.
  log "refreshing local tap: osquery-local"

  TAPS="$DEPS/Library/Taps/"
  mkdir -p "$TAPS/osquery/"

  FORMULA_TAP="$TAPS/osquery/homebrew-osquery-local"
  if [[ -L "$FORMULA_TAP" ]]; then
    rm -f "$FORMULA_TAP"
  fi
  ln -sf "$FORMULA_DIR" "$FORMULA_TAP"

  export HOMEBREW_NO_ANALYTICS=1 # dissable analytics https://docs.brew.sh/Analytics
  export HOMEBREW_NO_ANALYTICS_THIS_RUN=1
  export HOMEBREW_NO_AUTO_UPDATE=1
  export HOMEBREW_CACHE="$DEPS/.cache/"
  export HOMEBREW_MAKE_JOBS=$THREADS
  export HOMEBREW_NO_EMOJI=1
  export HOMEBREW_BOTTLE_ARCH=core2
  export BREW="$DEPS/bin/brew"

  log "dissabling brew analytics"
  $DEPS/bin/brew analytics off

  # Grab full clone to perform a pin
  if [[ ! "$ACTION" = "bottle" ]]; then
    log "installing and updating Homebrew core"
    # Using a manual tap below, see: Homebrew/homebrew-core#19221
    # $BREW tap homebrew/core --full
    # (cd $TAPS/homebrew/homebrew-core && git pull > /dev/null && \
    #     git reset --hard $CORE_COMMIT)

    # This manually checks/clones/pulls the homebrew-core repo.
    if [[ ! -d "$TAPS/homebrew/homebrew-core/.git" ]]; then
      mkdir -p $TAPS/homebrew
      (cd $TAPS/homebrew; git clone $CORE_REPO)
    else
      (cd $TAPS/homebrew/homebrew-core; git pull > /dev/null)
    fi
    (cd $TAPS/homebrew/homebrew-core; git reset --hard $CORE_COMMIT)
  fi
<commit_msg>Fix typo in provision script<commit_after>#!/usr/bin/env bash

#  Copyright (c) 2014-present, Facebook, Inc.
#  All rights reserved.
#
#  This source code is licensed as defined on the LICENSE file found in the
#  root directory of this source tree.

# 1: Path to install brew into
# 2: Linux or Darwin
function setup_brew() {
  DEPS="$1"
  BREW_TYPE="$2"
  ACTION="$3"

  if [[ "$BREW_TYPE" == "linux" ]]; then
    BREW_REPO=$LINUXBREW_REPO
    BREW_COMMIT=$LINUXBREW_BREW
    CORE_COMMIT=$LINUXBREW_CORE
    CORE_REPO=$LINUXBREW_CORE_REPO
  else
    BREW_REPO=$HOMEBREW_REPO
    BREW_COMMIT=$HOMEBREW_BREW
    CORE_COMMIT=$HOMEBREW_CORE
    CORE_REPO=$HOMEBREW_CORE_REPO
  fi

  # Checkout new brew in local deps dir
  if [[ -z "$HOMEBREW_NO_AUTO_UPDATE" ]]; then
    if [[ ! -d "$DEPS/.git" ]]; then
      log "setting up new brew in $DEPS"
      git clone $BREW_REPO "$DEPS"
    elif [[ ! "$ACTION" = "bottle" ]]; then
      log "checking for updates to brew"
      git fetch origin > /dev/null
      git reset --hard origin/master > /dev/null
      git clean -f
    fi
  fi

  # Reset to a deterministic checkout of brew.
  git reset --hard $BREW_COMMIT

  # Create a local cache directory
  mkdir -p "$DEPS/.cache"

  # Always update the location of the local tap link.
  log "refreshing local tap: osquery-local"

  TAPS="$DEPS/Library/Taps/"
  mkdir -p "$TAPS/osquery/"

  FORMULA_TAP="$TAPS/osquery/homebrew-osquery-local"
  if [[ -L "$FORMULA_TAP" ]]; then
    rm -f "$FORMULA_TAP"
  fi
  ln -sf "$FORMULA_DIR" "$FORMULA_TAP"

  export HOMEBREW_NO_ANALYTICS=1 # dissable analytics https://docs.brew.sh/Analytics
  export HOMEBREW_NO_ANALYTICS_THIS_RUN=1
  export HOMEBREW_NO_AUTO_UPDATE=1
  export HOMEBREW_CACHE="$DEPS/.cache/"
  export HOMEBREW_MAKE_JOBS=$THREADS
  export HOMEBREW_NO_EMOJI=1
  export HOMEBREW_BOTTLE_ARCH=core2
  export BREW="$DEPS/bin/brew"

  log "disabling brew analytics"
  $DEPS/bin/brew analytics off

  # Grab full clone to perform a pin
  if [[ ! "$ACTION" = "bottle" ]]; then
    log "installing and updating Homebrew core"
    # Using a manual tap below, see: Homebrew/homebrew-core#19221
    # $BREW tap homebrew/core --full
    # (cd $TAPS/homebrew/homebrew-core && git pull > /dev/null && \
    #     git reset --hard $CORE_COMMIT)

    # This manually checks/clones/pulls the homebrew-core repo.
    if [[ ! -d "$TAPS/homebrew/homebrew-core/.git" ]]; then
      mkdir -p $TAPS/homebrew
      (cd $TAPS/homebrew; git clone $CORE_REPO)
    else
      (cd $TAPS/homebrew/homebrew-core; git pull > /dev/null)
    fi
    (cd $TAPS/homebrew/homebrew-core; git reset --hard $CORE_COMMIT)
  fi

{'fraction_non_alphanumeric': 0.1166603126191384, 'fraction_numerical': 0.0072436141822340835, 'mean_word_length': 3.2144578313253014, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3706363', 'n_tokens_mistral': 2091, 'n_tokens_neox': 1927, 'n_words': 512}