<commit_before>#!/usr/bin/env bash
# setup-env.sh requires bash

# Configuration
DXRCONFIG=$1
TREE="$2"
REMOTE="$3"
CURRENTDIR=`pwd`

if [ ! -f $DXRCONFIG ]; then
  if [ -f /etc/dxr/dxr.config ]; then
    DXRCONFIG=/etc/dxr/dxr.config
  else
    DXRCONFIG=dxr.config
  fi
fi

echo $DXRCONFIG

readconfig() {
  echo -c "reading $2 from section '$1'" >&2
  cat $DXRCONFIG | sed -n "/^\[$1\]/,/^\[.*\]/p" | grep "^[[:space:]]*$2[[:space:]]*=" | sed "s/.*=[:space:]*//"
}
SOURCE=`readconfig $TREE sourcedir`
BUILD=`readconfig $TREE objdir`
VCSPULL=`readconfig $TREE pullcommand`
BUILDCMD=`readconfig $TREE buildcommand`
DXRROOT=`readconfig DXR dxrroot`
WWWROOT=`readconfig Web wwwdir`

if [ "$DXRCONFIG" == "" -o "$TREE" == "" -o "$SOURCE" == "" -o "$BUILD" == "" -o "$VCSPULL" == "" -o "$BUILDCMD" == "" ]; then
  echo Usage: $0 DXRCONFIG TREE [REMOTE]<commit_msg>Drop the -c argument which doesn't exist in bash<commit_after>#!/usr/bin/env bash
# setup-env.sh requires bash

# Configuration
DXRCONFIG=$1
TREE="$2"
REMOTE="$3"
CURRENTDIR=`pwd`

if [ ! -f $DXRCONFIG ]; then
  if [ -f /etc/dxr/dxr.config ]; then
    DXRCONFIG=/etc/dxr/dxr.config
  else
    DXRCONFIG=dxr.config
  fi
fi

echo $DXRCONFIG

readconfig() {
  echo "reading $2 from section '$1'" >&2
  cat $DXRCONFIG | sed -n "/^\[$1\]/,/^\[.*\]/p" | grep "^[[:space:]]*$2[[:space:]]*=" | sed "s/.*=[:space:]*//"
}
SOURCE=`readconfig $TREE sourcedir`
BUILD=`readconfig $TREE objdir`
VCSPULL=`readconfig $TREE pullcommand`
BUILDCMD=`readconfig $TREE buildcommand`
DXRROOT=`readconfig DXR dxrroot`
WWWROOT=`readconfig Web wwwdir`

if [ "$DXRCONFIG" == "" -o "$TREE" == "" -o "$SOURCE" == "" -o "$BUILD" == "" -o "$VCSPULL" == "" -o "$BUILDCMD" == "" ]; then
  echo Usage: $0 DXRCONFIG TREE [REMOTE]
{'fraction_non_alphanumeric': 0.22063854047890535, 'fraction_numerical': 0.010262257696693273, 'mean_word_length': 4.161764705882353, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '6828931', 'n_tokens_mistral': 738, 'n_tokens_neox': 701, 'n_words': 166}