
Signed-off-by: Scott Little <scott.little@windriver.com> Change-Id: I72827cc20ed9ac2a29848cbcccefcede24c06827
81 lines
2.1 KiB
Bash
Executable File
81 lines
2.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
#
|
|
# Copyright (c) 2022 Wind River Systems, Inc.
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
|
|
set -e
|
|
source $(dirname "$0")/lib/job_utils.sh
|
|
require_job_env BUILD_HOME
|
|
|
|
require_job_env BUILD_PACKAGES
|
|
declare_job_env BUILD_PACKAGES_LIST
|
|
require_job_env BUILD_RT
|
|
require_job_env BUILD_ISO
|
|
declare_job_env BUILD_PACKAGES_PARALLEL_JOBS
|
|
require_job_env PKG_REUSE
|
|
declare_job_env STX_SHARED_SOURCE
|
|
declare_job_env STX_SHARED_SOURCE
|
|
|
|
load_build_env
|
|
|
|
$BUILD_PACKAGES || bail "BUILD_PACKAGES=false, skipping build"
|
|
|
|
BUILD_PACKAGES_LIST=$(trim $(echo $BUILD_PACKAGES_LIST | sed 's/,/ /g'))
|
|
info "BUILD_PACKAGES_LIST=$BUILD_PACKAGES_LIST"
|
|
|
|
# Always build std, rt only if requested
|
|
build_types="std"
|
|
if $BUILD_RT || $BUILD_ISO; then
|
|
build_types+=",rt"
|
|
fi
|
|
|
|
declare -a parallel_args
|
|
if [[ -n "$BUILD_PACKAGES_PARALLEL_JOBS" && "$BUILD_PACKAGES_PARALLEL_JOBS" -gt 1 ]] ; then
|
|
parallel_args=("--parallel" "$BUILD_PACKAGES_PARALLEL_JOBS")
|
|
fi
|
|
|
|
count=0
|
|
success=0
|
|
# Build all packages a few times
|
|
declare -a extra_args
|
|
while [[ $count -lt $BUILD_PACKAGES_ITERATIONS ]] ; do
|
|
extra_args=()
|
|
environment_args=()
|
|
|
|
# Either build specific or all packages
|
|
if [[ -n $BUILD_PACKAGES_LIST ]] ; then
|
|
extra_args+=("--packages" "$(echo $BUILD_PACKAGES_LIST | sed 's/ /,/g')")
|
|
else
|
|
extra_args+=("--all")
|
|
|
|
if $PKG_REUSE && [[ $count -eq 0 ]] ; then
|
|
extra_args+=("--clean")
|
|
extra_args+=("--reuse")
|
|
|
|
if [[ -n $STX_SHARED_SOURCE ]]; then
|
|
environment_args+=("STX_SHARED_SOURCE=$STX_SHARED_SOURCE")
|
|
fi
|
|
|
|
if [[ -n $STX_SHARED_REPO ]]; then
|
|
environment_args+=("STX_SHARED_REPO=$STX_SHARED_REPO")
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
# buld'em
|
|
if stx_docker_cmd $DRY_RUN_ARG $VEBOSE_ARG "${environment_args[*]} build-pkgs ${parallel_args[*]} ${extra_args[*]} -b $build_types" ; then
|
|
success=1
|
|
break
|
|
else
|
|
success=0
|
|
fi
|
|
let ++count
|
|
done
|
|
if [[ $success -ne 1 ]] ; then
|
|
notice "Failed to build packages after $BUILD_PACKAGES_ITERATIONS iterations"
|
|
exit 1
|
|
fi
|