<commit_before>#!/bin/bash

# runs command from parameters and exits with the eoror code of the command
# if it fails
function successOrExit {
    "$@"
    local status=$?
    if [ $status -ne 0 ]; then
        echo "$1 exited with error: $status"
        exit $status
    fi
}

set | grep TRAVIS

test $1 && arg1=$1
if [[ $arg1 = 'release' ]]; then
  ver=${ML_VERSION}
  fname=MarkLogic-RHEL6-${ver}.x86_64.rpm
  fnamedeb="marklogic_"
  fnamedeb=$fnamedeb$ver
  suff="_amd64.deb"
  fnamedeb=$fnamedeb$suff

  curl -c cookies.txt --data "email=${MLBUILD_USER}&password=${<PASSWORD>}" https://developer.marklogic.com/login
  dl_link=$(curl -b cookies.txt --data "download=/download/binaries/8.0/${fname}" https://developer.marklogic.com/get-download-url | perl -pe 's/.*"path":"([^"]+).*/\1/')
  url="https://developer.marklogic.com${dl_link}"

  echo "********* Downloading MarkLogic $ver"

  successOrExit curl -k -o ./$fname $url

  fname=$(pwd)/$fname

  sudo apt-get update
  sudo apt-get install wajig alien rpm lsb-base dpkg-dev debhelper build-essential
  (cd /etc && sudo ln -s default sysconfig)
  sudo wajig rpminstall $fname

  echo "********* MarkLogic $ver installed"
else
  # find today
  day=$(date +"%Y%m%d")

  # if the user passed a day string as a param then use it instead
  test $1 && day=$1
  # make a version number out of the date
  #ver="8.0-$day"
  ver="9.0-$day"

  echo "********* Downloading MarkLogic nightly $ver"

  # fetch/install ML nightly
  #fname="MarkLogic-$ver.x86_64.rpm"
  fname="MarkLogic-RHEL6-$ver.x86_64.rpm"
  fnamedeb="marklogic_"
  fnamedeb=$fnamedeb$ver
  suff="_amd64.deb"
  fnamedeb=$fnamedeb$suff

  #url="https://root.marklogic.com/nightly/builds/linux64/rh6-intel64-80-test-1.marklogic.com/b8_0/pkgs.$day/$fname"
  url="https://root.marklogic.com/nightly/builds/linux64/rh6v-intel64-90-test-1.marklogic.com/b9_0/pkgs.$day/$fname"
  echo "$url"

  status=$(curl -k --anyauth -u $MLBUILD_USER:$MLBUILD_PASSWORD --head --write-out %{http_code} --silent --output /dev/null $url)
  if [[ $status = 200 ]]; then<commit_msg>Changes MarkLogic install to use HEAD, not b9_0<commit_after>#!/bin/bash

# runs command from parameters and exits with the eoror code of the command
# if it fails
function successOrExit {
    "$@"
    local status=$?
    if [ $status -ne 0 ]; then
        echo "$1 exited with error: $status"
        exit $status
    fi
}

set | grep TRAVIS

test $1 && arg1=$1
if [[ $arg1 = 'release' ]]; then
  ver=${ML_VERSION}
  fname=MarkLogic-RHEL6-${ver}.x86_64.rpm
  fnamedeb="marklogic_"
  fnamedeb=$fnamedeb$ver
  suff="_amd64.deb"
  fnamedeb=$fnamedeb$suff

  curl -c cookies.txt --data "email=${MLBUILD_USER}&password=${<PASSWORD>}" https://developer.marklogic.com/login
  dl_link=$(curl -b cookies.txt --data "download=/download/binaries/8.0/${fname}" https://developer.marklogic.com/get-download-url | perl -pe 's/.*"path":"([^"]+).*/\1/')
  url="https://developer.marklogic.com${dl_link}"

  echo "********* Downloading MarkLogic $ver"

  successOrExit curl -k -o ./$fname $url

  fname=$(pwd)/$fname

  sudo apt-get update
  sudo apt-get install wajig alien rpm lsb-base dpkg-dev debhelper build-essential
  (cd /etc && sudo ln -s default sysconfig)
  sudo wajig rpminstall $fname

  echo "********* MarkLogic $ver installed"
else
  # find today
  day=$(date +"%Y%m%d")

  # if the user passed a day string as a param then use it instead
  test $1 && day=$1
  # make a version number out of the date
  #ver="8.0-$day"
  ver="9.0-$day"

  echo "********* Downloading MarkLogic nightly $ver"

  # fetch/install ML nightly
  #fname="MarkLogic-$ver.x86_64.rpm"
  fname="MarkLogic-RHEL6-$ver.x86_64.rpm"
  fnamedeb="marklogic_"
  fnamedeb=$fnamedeb$ver
  suff="_amd64.deb"
  fnamedeb=$fnamedeb$suff

  #url="https://root.marklogic.com/nightly/builds/linux64/rh6-intel64-80-test-1.marklogic.com/b8_0/pkgs.$day/$fname"
  url="https://root.marklogic.com/nightly/builds/linux64/rh6v-intel64-90-test-1.marklogic.com/HEAD/pkgs.$day/$fname"
  echo "$url"

  status=$(curl -k --anyauth -u $MLBUILD_USER:$MLBUILD_PASSWORD --head --write-out %{http_code} --silent --output /dev/null $url)
  if [[ $status = 200 ]]; then
{'fraction_non_alphanumeric': 0.17265325670498086, 'fraction_numerical': 0.02681992337164751, 'mean_word_length': 3.746590909090909, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 10, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5497933', 'n_tokens_mistral': 1694, 'n_tokens_neox': 1564, 'n_words': 350}