root/build-tools/build-pkgs
Scott Little b0bcb59c15 Build: Improved logging, error handling, and other small fixes
Add function and line number to error logs.

Log git commands that are issured when using --edit.

Replace global DIR variable with a more unique variable name.
DIR is used in many scripts that get sourced, possibly overwriting
the value in the calling script.

Make sure scripts won't fail if a redundant --parallel or --serial
argurement is seen.

Source files once at top of script, rather than in multiple places.

Source build_srpm.data once per package, and handle case where
build_srpm.data file is missing.

Fix handling of '<build-cmd> --installer <pkg-name>'.

Add handling of 'BUILD_IS_BIG' and 'UILD_IS_SLOW' to serial build.

Fix handling of packages that are built twice, once with a -rt
extension, during srpm audit.

Fix some exit code handling.

Prioritize Name over Service when searching for a package.

Delete some commented out code paths.

Change-Id: Ib5153cecf7b586d68aa382d382bc5a1a03a6b326
Story: 2002835
Task: 24519
Signed-off-by: Scott Little <scott.little@windriver.com>
2018-08-29 16:31:09 -04:00

56 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
#
# Copyright (c) 2018 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
#
# This program is a wrapper around build-pkgs-parallel and build-pkgs-serial
#
BUILD_PKGS_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}" )" )"
usage () {
echo ""
echo "Usage: "
echo " Create source and binary rpms:"
echo " build-pkgs [--serial] [args]"
}
SERIAL_FLAG=0
RC=0
for arg in "$@"; do
case "$1" in
--serial) SERIAL_FLAG=1 ;;
esac
done
which mock_tmpfs_umount >> /dev/null
if [ $? -ne 0 ]; then
SERIAL_FLAG=1
fi
# Make sure we have a dependency cache
DEP_CACHE="$MY_REPO/cgcs-tis-repo/dependancy-cache"
if [ ! -d $DEP_CACHE ]; then
echo "Dependency cache is missing. Creating it now."
$BUILD_PKGS_DIR/create_dependancy_cache.py > $MY_WORKSPACE/create_dependancy_cache.log
echo "Dependency cache created."
echo ""
fi
if [ $SERIAL_FLAG -eq 1 ]; then
echo "build-pkgs-serial $@"
build-pkgs-serial "$@"
RC=$?
else
echo "build-pkgs-parallel $@"
build-pkgs-parallel "$@"
RC=$?
fi
exit $RC