<commit_before>#!/bin/bash
# Copyright (c) 2012 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# Main entry point for buildbots.
# For local testing set BUILDBOT_BUILDERNAME and TEST_BUILDBOT, e.g:
#  export TEST_BUILDBOT=1
#  export BUILDBOT_BUILDERNAME=linux-newlib-0
#  ./buildbot_selector.sh

set -o errexit

SCRIPT_DIR="$(cd $(dirname $0) && pwd)"
export NACL_SDK_ROOT="$(dirname ${SCRIPT_DIR})/out/nacl_sdk"

BOT_GSUTIL='/b/build/scripts/slave/gsutil'
if [ -e ${BOT_GSUTIL} ]; then
  export GSUTIL=${BOT_GSUTIL}
else
  export GSUTIL=gsutil
fi


# The bots set the BOTO_CONFIG environment variable to a different .boto file
# (currently /b/build/site-config/.boto). override this to the gsutil default
# which has access to gs://nativeclient-mirror.
# gsutil also looks for AWS_CREDENTIAL_FILE, so clear that too.
unset AWS_CREDENTIAL_FILE
unset BOTO_CONFIG

RESULT=0

# TODO: Eliminate this dependency if possible.
# This is required on OSX so that the naclports version of pkg-config can be
# found.
export PATH=${PATH}:/opt/local/bin

StartBuild() {
  export NACL_ARCH=$1
  export SHARD=$2
  export SHARDS=$3

  echo "@@@BUILD_STEP $1 setup@@@"
  if ! ./build_tools/build_shard.sh ; then
    RESULT=1
  fi
  cd -
}

Publish() {
  if [ -n "${NACLPORTS_NO_UPLOAD:-}" ]; then
    return
  fi
  echo "@@@BUILD_STEP upload binaries@@@"
  UPLOAD_PATH=nativeclient-mirror/naclports/${PEPPER_DIR}/
  UPLOAD_PATH+=${BUILDBOT_GOT_REVISION}/publish
  SRC_PATH=out/publish
  echo "Uploading to ${UPLOAD_PATH}"

  ${GSUTIL} cp -R -a public-read ${SRC_PATH}/* gs://${UPLOAD_PATH}/<commit_msg>Go back to the right directory before building each arch.<commit_after>#!/bin/bash
# Copyright (c) 2012 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# Main entry point for buildbots.
# For local testing set BUILDBOT_BUILDERNAME and TEST_BUILDBOT, e.g:
#  export TEST_BUILDBOT=1
#  export BUILDBOT_BUILDERNAME=linux-newlib-0
#  ./buildbot_selector.sh

set -o errexit

SCRIPT_DIR="$(cd $(dirname $0) && pwd)"
export NACL_SDK_ROOT="$(dirname ${SCRIPT_DIR})/out/nacl_sdk"

BOT_GSUTIL='/b/build/scripts/slave/gsutil'
if [ -e ${BOT_GSUTIL} ]; then
  export GSUTIL=${BOT_GSUTIL}
else
  export GSUTIL=gsutil
fi


# The bots set the BOTO_CONFIG environment variable to a different .boto file
# (currently /b/build/site-config/.boto). override this to the gsutil default
# which has access to gs://nativeclient-mirror.
# gsutil also looks for AWS_CREDENTIAL_FILE, so clear that too.
unset AWS_CREDENTIAL_FILE
unset BOTO_CONFIG

RESULT=0

# TODO: Eliminate this dependency if possible.
# This is required on OSX so that the naclports version of pkg-config can be
# found.
export PATH=${PATH}:/opt/local/bin

StartBuild() {
  export NACL_ARCH=$1
  export SHARD=$2
  export SHARDS=$3

  echo "@@@BUILD_STEP $1 setup@@@"
  # Goto src/
  cd ${SCRIPT_DIR}/..
  if ! ./build_tools/build_shard.sh ; then
    RESULT=1
  fi
  cd -
}

Publish() {
  if [ -n "${NACLPORTS_NO_UPLOAD:-}" ]; then
    return
  fi
  echo "@@@BUILD_STEP upload binaries@@@"
  UPLOAD_PATH=nativeclient-mirror/naclports/${PEPPER_DIR}/
  UPLOAD_PATH+=${BUILDBOT_GOT_REVISION}/publish
  SRC_PATH=out/publish
  echo "Uploading to ${UPLOAD_PATH}"

  ${GSUTIL} cp -R -a public-read ${SRC_PATH}/* gs://${UPLOAD_PATH}/
{'fraction_non_alphanumeric': 0.11878612716763005, 'fraction_numerical': 0.007514450867052023, 'mean_word_length': 4.275914634146342, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2624766', 'n_tokens_mistral': 1312, 'n_tokens_neox': 1284, 'n_words': 358}