
lib/job_utils.sh: function "require_env" conflicts with the like-named function in utils.sh. Rename it to "require_job_env". Signed-off-by: Davlet Panech <davlet.panech@windriver.com> Change-Id: I557cf14c4a3df000be245471cef5663e49badb06
63 lines
1.5 KiB
Bash
Executable File
63 lines
1.5 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
|
|
|
|
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=()
|
|
|
|
# Either build specific or all packages
|
|
if [[ -n $BUILD_PACKAGES_LIST ]] ; then
|
|
extra_args+=("-p" "$(echo $BUILD_PACKAGES_LIST | sed 's/ /,/g')")
|
|
else
|
|
extra_args+=("-a")
|
|
fi
|
|
|
|
# buld'em
|
|
if stx_docker_cmd $DRY_RUN_ARG $VEBOSE_ARG "build-pkgs ${parallel_args[*]} ${extra_args[*]} -b $build_types" ; then
|
|
success=1
|
|
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
|