<commit_before>pkg_name=hab-builder-worker
pkg_origin=core
pkg_version=$(cat "$PLAN_CONTEXT/../../../VERSION-BLDR")
pkg_maintainer="<NAME> <<EMAIL>>"
pkg_license=('Apache-2.0')
pkg_source=nosuchfile.tar.gz
pkg_bin_dirs=(bin)
pkg_deps=(core/glibc core/openssl core/gcc-libs core/zeromq core/libsodium core/libarchive)
pkg_build_deps=(core/make core/cmake core/protobuf core/protobuf-rust core/coreutils core/cacerts
  core/rust core/gcc core/pkg-config core/zlib)
bin="bldr-worker"
pkg_svc_run="$bin start -c ${pkg_svc_path}/config.toml"

do_prepare() {
  # Can be either `--release` or `--debug` to determine cargo build strategy
  build_type="--debug"
  build_line "Building artifacts with \`${build_type#--}' mode"

  export rustc_target="x86_64-unknown-linux-gnu"
  build_line "Setting rustc_target=$rustc_target"

  # Used by the `build.rs` program to set the version of the binaries
  export PLAN_VERSION="${pkg_version}/${pkg_release}"
  build_line "Setting PLAN_VERSION=$PLAN_VERSION"

  # Used by Cargo to use a pristine, isolated directory for all compilation
  export CARGO_TARGET_DIR="$HAB_CACHE_SRC_PATH/$pkg_dirname"
  build_line "Setting CARGO_TARGET_DIR=$CARGO_TARGET_DIR"

  export LIBARCHIVE_LIB_DIR="$(pkg_path_for libarchive)/lib"
  export LIBARCHIVE_INCLUDE_DIR="$(pkg_path_for libarchive)/include"
  export OPENSSL_LIB_DIR="$(pkg_path_for openssl)/lib"
  export OPENSSL_INCLUDE_DIR="$(pkg_path_for openssl)/include"
  export PROTOBUF_PREFIX="$(pkg_path_for protobuf)"
  export SODIUM_LIB_DIR="$(pkg_path_for libsodium)/lib"
  export LIBZMQ_PREFIX="$(pkg_path_for zeromq)"

  # Used by libssh2-sys
  export DEP_OPENSSL_ROOT="$(pkg_path_for openssl)"
  export DEP_Z_ROOT="$(pkg_path_for zlib)"
  export DEP_Z_INCLUDE="$(pkg_path_for zlib)/include"
}

do_build() {
  export LIBRARY_PATH=$LIBZMQ_PREFIX/lib
  build_line "Setting LIBRARY_PATH=$LIBRARY_PATH"

  pushd $PLAN_CONTEXT/.. > /dev/null
  cargo build ${build_type#--debug} --target=$rustc_target --verbose
  popd > /dev/null
}

do_install() {
  install -v -D $CARGO_TARGET_DIR/$rustc_target/${build_type#--}/$bin \
    $pkg_prefix/bin/$bin
}

do_strip() {
  if [[ "$build_type" != "--debug" ]]; then
    do_default_strip
  fi
}

# Turn the remaining default phases into no-ops
do_download() {
  return 0
}

do_verify() {
  return 0
}<commit_msg>Fix build step in builder-worker plan<commit_after>pkg_name=hab-builder-worker
pkg_origin=core
pkg_version=$(cat "$PLAN_CONTEXT/../../../VERSION-BLDR")
pkg_maintainer="<NAME> <<EMAIL>>"
pkg_license=('Apache-2.0')
pkg_source=nosuchfile.tar.gz
pkg_bin_dirs=(bin)
pkg_deps=(core/glibc core/openssl core/gcc-libs core/zeromq core/libsodium core/libarchive
  core/zlib)
pkg_build_deps=(core/make core/cmake core/protobuf core/protobuf-rust core/coreutils core/cacerts
  core/rust core/gcc core/pkg-config)
bin="bldr-worker"
pkg_svc_run="$bin start -c ${pkg_svc_path}/config.toml"

do_prepare() {
  # Can be either `--release` or `--debug` to determine cargo build strategy
  build_type="--debug"
  build_line "Building artifacts with \`${build_type#--}' mode"

  export rustc_target="x86_64-unknown-linux-gnu"
  build_line "Setting rustc_target=$rustc_target"

  # Used by the `build.rs` program to set the version of the binaries
  export PLAN_VERSION="${pkg_version}/${pkg_release}"
  build_line "Setting PLAN_VERSION=$PLAN_VERSION"

  # Used by Cargo to use a pristine, isolated directory for all compilation
  export CARGO_TARGET_DIR="$HAB_CACHE_SRC_PATH/$pkg_dirname"
  build_line "Setting CARGO_TARGET_DIR=$CARGO_TARGET_DIR"

  export LIBARCHIVE_LIB_DIR="$(pkg_path_for libarchive)/lib"
  export LIBARCHIVE_INCLUDE_DIR="$(pkg_path_for libarchive)/include"
  export OPENSSL_LIB_DIR="$(pkg_path_for openssl)/lib"
  export OPENSSL_INCLUDE_DIR="$(pkg_path_for openssl)/include"
  export PROTOBUF_PREFIX="$(pkg_path_for protobuf)"
  export SODIUM_LIB_DIR="$(pkg_path_for libsodium)/lib"
  export LIBZMQ_PREFIX="$(pkg_path_for zeromq)"

  # Used by libssh2-sys
  export DEP_Z_ROOT="$(pkg_path_for zlib)"
  export DEP_Z_INCLUDE="$(pkg_path_for zlib)/include"

  # Temporarily set PKG_CONFIG_PATH - this can be removed after all core packages are rebuilt with
  # hab-plan-build 0.11.x and pushed to the public depot.
  export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$(pkg_path_for zlib)/lib/pkgconfig"
  export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$(pkg_path_for openssl)/lib/pkgconfig"
}

do_build() {
  export LIBRARY_PATH=$LIBZMQ_PREFIX/lib
  build_line "Setting LIBRARY_PATH=$LIBRARY_PATH"

  pushd $PLAN_CONTEXT/.. > /dev/null
  cargo build ${build_type#--debug} --target=$rustc_target --verbose
  popd > /dev/null
}

do_install() {
  install -v -D $CARGO_TARGET_DIR/$rustc_target/${build_type#--}/$bin \
    $pkg_prefix/bin/$bin
}

do_strip() {
  if [[ "$build_type" != "--debug" ]]; then
    do_default_strip
  fi
}

# Turn the remaining default phases into no-ops
do_download() {
  return 0
}

do_verify() {
  return 0
}
{'fraction_non_alphanumeric': 0.12913034664504358, 'fraction_numerical': 0.004257044394891546, 'mean_word_length': 5.374677002583979, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, 'https://': 0, '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': '6258840', 'n_tokens_mistral': 1876, 'n_tokens_neox': 1771, 'n_words': 356}