<commit_before>#!/bin/bash -x
## This script is for installing all the needed packages on CentOS 7 and Ubuntu Trusty to run the chef tests with 'chef exec rake'

if [ -f /usr/bin/yum ] ; then
  # install needed packages
  sudo yum clean all
  sudo yum -y groupinstall "Development Tools"
  sudo yum -y install xz-devel zlib-devel

  # uninstall requests from pip
  sudo pip uninstall requests -y || true

  # install chefdk
  chefdk=chefdk-0.15.15-1.el7.x86_64.rpm
  wget -nv -t 3 https://packages.chef.io/stable/el/7/$chefdk
  sudo yum -y install $chefdk
  rm $chefdk

  # explicitly disable selinux
  sudo /usr/sbin/setenforce 0

elif [ -f /usr/bin/apt-get ]; then

  # install needed packages
  sudo apt-get update
  sudo apt-get -y install build-essential liblzma-dev zlib1g-dev

  # install chefdk
  chefdk=chefdk_0.15.15-1_amd64.deb
  wget -nv -t 3 https://packages.chef.io/stable/ubuntu/12.04/$chefdk
  sudo dpkg -i $chefdk
  rm $chefdk

fi

# The following will handle cross cookbook patch dependencies via the Depends-On in commit message

# ZUUL_CHANGES has a ^ separated list of patches, the last being the current patch.
# The Depends_On will add patches to the front of this list.
echo $ZUUL_CHANGES
# Convert string list to array
cookbooks=(${ZUUL_CHANGES//^/ })
# Remove the last one as it's the current cookbook
# TODO(MRV) At some point we could consider removing the gerrit-git-prep step from the rake job
# and also doing that patch clone with zuul-cloner.  After gerrit-git-prep is removed, need to
# remove this unset line and adjust the clone map to have the base patch put into the current dir.
unset cookbooks[${#cookbooks[@]}-1]

# Create clone map
cat > clonemap.yaml <<EOF
clonemap:
 - name: 'openstack/(.*)'
   dest: '\1'
EOF

# Create list of Depends-On cookbook names and update Berksfile entry for each
cookbook_projects=""
for cookbook_info in "${cookbooks[@]}"; do
  [[ $cookbook_info =~ openstack/([a-z-]*):.* ]]
  cookbook_name="${BASH_REMATCH[1]}"<commit_msg>bump chefdk version to latest to keep up<commit_after>#!/bin/bash -x
## This script is for installing all the needed packages on CentOS 7 and Ubuntu Trusty to run the chef tests with 'chef exec rake'

if [ -f /usr/bin/yum ] ; then
  # install needed packages
  sudo yum clean all
  sudo yum -y groupinstall "Development Tools"
  sudo yum -y install xz-devel zlib-devel

  # uninstall requests from pip
  sudo pip uninstall requests -y || true

  # install chefdk
  chefdk=chefdk-0.17.17-1.el7.x86_64.rpm
  wget -nv -t 3 https://packages.chef.io/stable/el/7/$chefdk
  sudo yum -y install $chefdk
  rm $chefdk

  # explicitly disable selinux
  sudo /usr/sbin/setenforce 0

elif [ -f /usr/bin/apt-get ]; then

  # install needed packages
  sudo apt-get update
  sudo apt-get -y install build-essential liblzma-dev zlib1g-dev

  # install chefdk
  chefdk=chefdk_0.17.17-1_amd64.deb
  wget -nv -t 3 https://packages.chef.io/stable/ubuntu/12.04/$chefdk
  sudo dpkg -i $chefdk
  rm $chefdk

fi

# The following will handle cross cookbook patch dependencies via the Depends-On in commit message

# ZUUL_CHANGES has a ^ separated list of patches, the last being the current patch.
# The Depends_On will add patches to the front of this list.
echo $ZUUL_CHANGES
# Convert string list to array
cookbooks=(${ZUUL_CHANGES//^/ })
# Remove the last one as it's the current cookbook
# TODO(MRV) At some point we could consider removing the gerrit-git-prep step from the rake job
# and also doing that patch clone with zuul-cloner.  After gerrit-git-prep is removed, need to
# remove this unset line and adjust the clone map to have the base patch put into the current dir.
unset cookbooks[${#cookbooks[@]}-1]

# Create clone map
cat > clonemap.yaml <<EOF
clonemap:
 - name: 'openstack/(.*)'
   dest: '\1'
EOF

# Create list of Depends-On cookbook names and update Berksfile entry for each
cookbook_projects=""
for cookbook_info in "${cookbooks[@]}"; do
  [[ $cookbook_info =~ openstack/([a-z-]*):.* ]]
  cookbook_name="${BASH_REMATCH[1]}"
{'fraction_non_alphanumeric': 0.0990789146128952, 'fraction_numerical': 0.01593228777694797, 'mean_word_length': 3.672093023255814, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 4, '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': '2070645', 'n_tokens_mistral': 1475, 'n_tokens_neox': 1370, 'n_words': 506}