<commit_before>#!/bin/bash -e
# $1 - Specifies distribution - RHEL7/CentOS7
# $2 - Specifies PostgreSQL version - 9.2
# TEST_MODE - If set, build a candidate image and test it

# Array of all versions of PostgreSQL
declare -a VERSIONS=(9.2)

OS=$1
VERSION=$2

function squash {
  # install the docker layer squashing tool
  easy_install --user docker-scripts==0.4.1
  base=$(awk '/^FROM/{print $2}' $1)
  $HOME/.local/bin/docker-scripts squash -f $base ${IMAGE_NAME}
}

if [ -z ${VERSION} ]; then
  # Build all versions
  dirs=${VERSIONS}
else
  # Build only specified version on PostgreSQL
  dirs=${VERSION}
fi

for dir in ${dirs}; do
  IMAGE_NAME=openshift/postgresql-${dir//./}-${OS}
  if [ -v TEST_MODE ]; then
    IMAGE_NAME="${IMAGE_NAME}-candidate"
  fi
  echo ">>>> Building ${IMAGE_NAME}"

  pushd ${dir} > /dev/null

  if [ "$OS" == "rhel7" -o "$OS" == "rhel7-candidate" ]; then
    docker build -t ${IMAGE_NAME} -f Dockerfile.rhel7 .
    if [ "${SKIP_SQUASH}" -ne "1" ]; then
      squash Dockerfile.rhel7
    fi
  else
    docker build -t ${IMAGE_NAME} .
    if [ "${SKIP_SQUASH}" -ne "1" ]; then
      squash Dockerfile
    fi
  fi

  if [ -v TEST_MODE ]; then
    IMAGE_NAME=${IMAGE_NAME} test/run
  fi

  popd > /dev/null
done
<commit_msg>Fix docker-py version for squash script<commit_after>#!/bin/bash -e
# $1 - Specifies distribution - RHEL7/CentOS7
# $2 - Specifies PostgreSQL version - 9.2
# TEST_MODE - If set, build a candidate image and test it

# Array of all versions of PostgreSQL
declare -a VERSIONS=(9.2)

OS=$1
VERSION=$2

function squash {
  # install the docker layer squashing tool
  easy_install --user docker_py==1.2.3 docker-scripts==0.4.2
  base=$(awk '/^FROM/{print $2}' $1)
  $HOME/.local/bin/docker-scripts squash -f $base ${IMAGE_NAME}
}

if [ -z ${VERSION} ]; then
  # Build all versions
  dirs=${VERSIONS}
else
  # Build only specified version on PostgreSQL
  dirs=${VERSION}
fi

for dir in ${dirs}; do
  IMAGE_NAME=openshift/postgresql-${dir//./}-${OS}
  if [ -v TEST_MODE ]; then
    IMAGE_NAME="${IMAGE_NAME}-candidate"
  fi
  echo ">>>> Building ${IMAGE_NAME}"

  pushd ${dir} > /dev/null

  if [ "$OS" == "rhel7" -o "$OS" == "rhel7-candidate" ]; then
    docker build -t ${IMAGE_NAME} -f Dockerfile.rhel7 .
    if [ "${SKIP_SQUASH}" -ne "1" ]; then
      squash Dockerfile.rhel7
    fi
  else
    docker build -t ${IMAGE_NAME} .
    if [ "${SKIP_SQUASH}" -ne "1" ]; then
      squash Dockerfile
    fi
  fi

  if [ -v TEST_MODE ]; then
    IMAGE_NAME=${IMAGE_NAME} test/run
  fi

  popd > /dev/null
done

{'fraction_non_alphanumeric': 0.1524892199137593, 'fraction_numerical': 0.01764014112112897, 'mean_word_length': 3.07667731629393, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '2677418', 'n_tokens_mistral': 986, 'n_tokens_neox': 934, 'n_words': 270}