Add a dependency checker to build-pkgs
Builds a single package in a clean environment to detect missing build dependencies. Usage: build-pkgs --dep-test <pkg> Note: Should only be run after a full 'build-pkgs'. We want the build to fail because a dependency wasn't been listed, not because a dependency hasn't been built yet. Closes-Bug: 1880248 Change-Id: Icf64be37a77de0992647c37ce392fd5a2a458fba Signed-off-by: Scott Little <scott.little@windriver.com>
This commit is contained in:
parent
ed99a51d58
commit
c70efec479
@ -18,7 +18,6 @@ BUILD_PKGS_PARALLEL_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}" )" )"
|
||||
source "${BUILD_PKGS_PARALLEL_DIR}/git-utils.sh"
|
||||
source "${BUILD_PKGS_PARALLEL_DIR}/spec-utils"
|
||||
|
||||
|
||||
usage () {
|
||||
echo ""
|
||||
echo "Usage: "
|
||||
@ -30,6 +29,10 @@ usage () {
|
||||
echo " i.e. while debugging compilation failures."
|
||||
echo " build-pkgs-parallel [--layer] [--build-avoidance | --no-build-avoidance] [--no-descendants] [--no-required] [--no-build-info] [--no-autoclean] [--careful] [--formal] [ list of package names ]"
|
||||
echo ""
|
||||
echo " Test build dependencies of a package:"
|
||||
echo " Note: A full build of all packages should preceed the dependency test build"
|
||||
echo " build-pkgs-parallel --dep-test <package_name>"
|
||||
echo ""
|
||||
echo " Delete source rpms, and the directories associated with it's creation:"
|
||||
echo " Note: does not clean an edit environment"
|
||||
echo " build-pkgs-parallel --clean [--build-avoidance | --no-build-avoidance] [ list of package names ]"
|
||||
@ -57,12 +60,13 @@ STD_BUILD=1
|
||||
RT_BUILD=1
|
||||
INSTALLER_BUILD=0
|
||||
CONTAINERS_BUILD=0
|
||||
DEP_TEST_FLAG=0
|
||||
|
||||
export BUILD_AVOIDANCE_URL=""
|
||||
|
||||
|
||||
# read the options
|
||||
TEMP=$(getopt -o h --long parallel,rt,std,installer,containers,layer:,edit,build-avoidance,no-build-avoidance,build-avoidance-dir:,build-avoidance-host:,build-avoidance-user:,build-avoidance-day:,no-meta-patch,no-descendants,no-required,no-build-info,no-autoclean,formal,careful,help,clean,append-log -n 'build-pkgs-parallel' -- "$@")
|
||||
TEMP=$(getopt -o h --long parallel,rt,std,installer,containers,layer:,edit,build-avoidance,no-build-avoidance,build-avoidance-dir:,build-avoidance-host:,build-avoidance-user:,build-avoidance-day:,no-meta-patch,no-descendants,no-required,no-build-info,no-autoclean,formal,careful,help,clean,dep-test,append-log -n 'build-pkgs-parallel' -- "$@")
|
||||
if [ $? -ne 0 ]; then
|
||||
usage
|
||||
exit 1
|
||||
@ -98,6 +102,7 @@ while true ; do
|
||||
--no-meta-patch) EXTRA_ARGS_SRPM+=" --no-meta-patch" ; shift ;;
|
||||
-h|--help) HELP=1 ; shift ;;
|
||||
--clean) CLEAN_FLAG=1 ; shift ;;
|
||||
--dep-test) DEP_TEST_FLAG=1; EXTRA_ARGS_RPM+=" --dep-test"; shift ;;
|
||||
--edit) EDIT_FLAG=1 ; EXTRA_ARGS_SRPM+=" --edit"; shift ;;
|
||||
--rt) STD_BUILD=0 ; shift ;;
|
||||
--std) RT_BUILD=0 ; shift ;;
|
||||
|
@ -30,6 +30,10 @@ usage () {
|
||||
echo " i.e. while debugging compilation failures."
|
||||
echo " build-pkgs-serial [--build-avoidance | --no-build-avoidance] [--no-descendants] [--no-required] [--no-build-info] [--no-autoclean] [--careful] [--formal] [ list of package names ]"
|
||||
echo ""
|
||||
echo " Test build dependencies of a package:"
|
||||
echo " Note: A full build of all packages should preceed the dependency test build"
|
||||
echo " build-pkgs-serial --dep-test <package_name>"
|
||||
echo ""
|
||||
echo " Delete source rpms, and the directories associated with it's creation:"
|
||||
echo " Note: does not clean an edit environment"
|
||||
echo " build-pkgs-serial --clean [--build-avoidance | --no-build-avoidance] [ list of package names ]"
|
||||
@ -57,12 +61,13 @@ STD_BUILD=1
|
||||
RT_BUILD=1
|
||||
INSTALLER_BUILD=0
|
||||
CONTAINERS_BUILD=0
|
||||
DEP_TEST_FLAG=0
|
||||
|
||||
export BUILD_AVOIDANCE_URL=""
|
||||
|
||||
|
||||
# read the options
|
||||
TEMP=$(getopt -o h --long serial,rt,std,installer,containers,layer:,edit,build-avoidance,no-build-avoidance,build-avoidance-dir:,build-avoidance-host:,build-avoidance-user:,build-avoidance-day:,no-meta-patch,no-descendants,no-required,no-build-info,no-autoclean,formal,careful,help,clean,append-log -n 'build-pkgs-serial' -- "$@")
|
||||
TEMP=$(getopt -o h --long serial,rt,std,installer,containers,layer:,edit,build-avoidance,no-build-avoidance,build-avoidance-dir:,build-avoidance-host:,build-avoidance-user:,build-avoidance-day:,no-meta-patch,no-descendants,no-required,no-build-info,no-autoclean,formal,careful,help,clean,dep-test,append-log -n 'build-pkgs-serial' -- "$@")
|
||||
if [ $? -ne 0 ]; then
|
||||
usage
|
||||
exit 1
|
||||
@ -98,6 +103,7 @@ while true ; do
|
||||
--no-meta-patch) EXTRA_ARGS_SRPM+=" --no-meta-patch" ; shift ;;
|
||||
-h|--help) HELP=1 ; shift ;;
|
||||
--clean) CLEAN_FLAG=1 ; shift ;;
|
||||
--dep-test) DEP_TEST_FLAG=1; EXTRA_ARGS_RPM+=" --dep-test"; shift ;;
|
||||
--edit) EDIT_FLAG=1 ; EXTRA_ARGS_SRPM+=" --edit"; shift ;;
|
||||
--rt) STD_BUILD=0 ; shift ;;
|
||||
--std) RT_BUILD=0 ; shift ;;
|
||||
@ -427,7 +433,7 @@ function launch_build()
|
||||
|
||||
if [ $EDIT_FLAG -ne 1 ]; then
|
||||
echo -e "\n######## $(date): Launching build-rpms-serial --$build_type $EXTRA_ARGS $@\n" | tee --append $logfile
|
||||
echo "${BUILD_PKGS_SERIAL_DIR}/build-rpms-serial --$build_type $EXTRA_ARGS_COMMON $EXTRA_ARGS_SRPM $targets" | tee --append $logfile
|
||||
echo "${BUILD_PKGS_SERIAL_DIR}/build-rpms-serial --$build_type $EXTRA_ARGS_COMMON $EXTRA_ARGS_RPM $targets" | tee --append $logfile
|
||||
${BUILD_PKGS_SERIAL_DIR}/build-rpms-serial --$build_type $EXTRA_ARGS_COMMON $EXTRA_ARGS_RPM $targets 2>&1 | tee --append $logfile
|
||||
rc=${PIPESTATUS[0]}
|
||||
if [ $rc -eq 0 ]; then
|
||||
|
@ -29,7 +29,6 @@ export ME=$(basename "$0")
|
||||
CMDLINE="$ME $@"
|
||||
|
||||
|
||||
|
||||
# Build for distribution. Currently 'centos' is only supported value.
|
||||
export DISTRO="centos"
|
||||
|
||||
@ -98,6 +97,7 @@ usage () {
|
||||
echo ""
|
||||
echo "Usage: "
|
||||
echo " $ME [ [--rt] [--no-required] [--no-descendants] [--no-build-info] [--no-autoclean] [--formal] <optional list of package names> ]"
|
||||
echo " $ME --dep-test <package name>"
|
||||
echo " $ME --clean [ [--no-descendants] <optional list of package names> ]"
|
||||
echo " $ME --help"
|
||||
echo ""
|
||||
@ -1422,9 +1422,10 @@ HELP=0
|
||||
CLEAN_FLAG=0
|
||||
FORMAL_FLAG=0
|
||||
CAREFUL=0
|
||||
DEP_TEST_FLAG=0
|
||||
|
||||
# read the options
|
||||
TEMP=$(getopt -o h --long parallel,std,rt,installer,containers,no-required,no-descendants,no-autoclean,no-build-info,clean,tmpfs-clean,formal,careful,help,layer: -n "$ME" -- "$@")
|
||||
TEMP=$(getopt -o h --long parallel,std,rt,installer,containers,no-required,no-descendants,no-autoclean,no-build-info,dep-test,clean,tmpfs-clean,formal,careful,help,layer: -n "$ME" -- "$@")
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
usage
|
||||
@ -1451,6 +1452,7 @@ while true ; do
|
||||
--containers) BUILD_TYPE=containers; shift ;;
|
||||
-h|--help) HELP=1 ; shift ;;
|
||||
--clean) CLEAN_FLAG=1 ; shift ;;
|
||||
--dep-test) DEP_TEST_FLAG=1 ; MAX_WORKERS=1; NO_DESCENDANTS=1; NO_REQUIRED=1; NO_BUILD_INFO=1; shift ;;
|
||||
--tmpfs-clean) if [ -n "$MY_WORKSPACE" ]; then export MY_WORKSPACE=$MY_WORKSPACE/$BUILD_TYPE; exit 0; fi ;;
|
||||
--parallel) shift ;;
|
||||
--layer) export LAYER=$2 ; shift ; shift ;;
|
||||
@ -1621,12 +1623,23 @@ fi
|
||||
|
||||
ALL=0
|
||||
UNRESOLVED_TARGETS=" "
|
||||
if [ "x$TARGETS" == "x" ]; then
|
||||
echo "make: all"
|
||||
ALL=1
|
||||
|
||||
if [ $DEP_TEST_FLAG -eq 1 ]; then
|
||||
# we expect exactly one package
|
||||
if [ $(echo $TARGETS | wc -w) -ne 1 ]; then
|
||||
echo "ERROR: dependency testing requires exactly one package"
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "make: $TARGETS"
|
||||
UNRESOLVED_TARGETS="$TARGETS"
|
||||
# we accept a list of packages, and no list implies all
|
||||
if [ "x$TARGETS" == "x" ]; then
|
||||
echo "make: all"
|
||||
ALL=1
|
||||
else
|
||||
echo "make: $TARGETS"
|
||||
UNRESOLVED_TARGETS="$TARGETS"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$BUILD_TYPE" != "std" ]; then
|
||||
@ -1760,8 +1773,13 @@ clean_list () {
|
||||
\rm -f -v $RESULT_DIR/mockchain.log 2>> /dev/null
|
||||
mock_clean
|
||||
else
|
||||
# Wipe only traces of what we built
|
||||
mock_partial_clean "$SRPMS_LIST" "$RPMS_LIST"
|
||||
# If dependency test
|
||||
if [ $DEP_TEST_FLAG -eq 1 ]; then
|
||||
mock_clean
|
||||
else
|
||||
# Wipe only traces of what we built
|
||||
mock_partial_clean "$SRPMS_LIST" "$RPMS_LIST"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -61,6 +61,7 @@ usage () {
|
||||
echo ""
|
||||
echo "Usage: "
|
||||
echo " $ME [ [--rt] [--no-required] [--no-descendants] [--no-build-info] [--no-autoclean] [--formal] <optional list of package names> ]"
|
||||
echo " $ME --dep-test <package name>"
|
||||
echo " $ME --clean [ [--no-descendants] <optional list of package names> ]"
|
||||
echo " $ME --help"
|
||||
echo ""
|
||||
@ -1191,9 +1192,10 @@ HELP=0
|
||||
CLEAN_FLAG=0
|
||||
FORMAL_FLAG=0
|
||||
CAREFUL=0
|
||||
DEP_TEST_FLAG=0
|
||||
|
||||
# read the options
|
||||
TEMP=$(getopt -o h --long serial,std,rt,installer,containers,no-required,no-descendants,no-autoclean,no-build-info,clean,formal,careful,help,layer: -n "$ME" -- "$@")
|
||||
TEMP=$(getopt -o h --long serial,std,rt,installer,containers,no-required,no-descendants,no-autoclean,no-build-info,dep-test,clean,formal,careful,help,layer: -n "$ME" -- "$@")
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
usage
|
||||
@ -1220,6 +1222,7 @@ while true ; do
|
||||
--containers) BUILD_TYPE=containers; shift ;;
|
||||
-h|--help) HELP=1 ; shift ;;
|
||||
--clean) CLEAN_FLAG=1 ; shift ;;
|
||||
--dep-test) DEP_TEST_FLAG=1 ; MAX_WORKERS=1; NO_DESCENDANTS=1; NO_REQUIRED=1; NO_BUILD_INFO=1; shift ;;
|
||||
--serial) shift ;;
|
||||
--layer) export LAYER=$2 ; shift ; shift ;;
|
||||
--) shift ; break ;;
|
||||
@ -1304,13 +1307,12 @@ RELEASE_INFO_FILE="$(get_release_info)"
|
||||
if [ -f "$RELEASE_INFO_FILE" ]; then
|
||||
source "$RELEASE_INFO_FILE"
|
||||
else
|
||||
echo "ERROR: failed to find RELEASE_INFO_FILE=$RELEASE_INFO_FILE"
|
||||
exit 1
|
||||
echo "Warning: failed to find RELEASE_INFO_FILE=$RELEASE_INFO_FILE"
|
||||
fi
|
||||
|
||||
if [ "x$PLATFORM_RELEASE" == "x" ]; then
|
||||
echo "ERROR: PLATFORM_RELEASE is not defined in $RELEASE_INFO_FILE"
|
||||
exit 1
|
||||
echo "Warning: PLATFORM_RELEASE is not defined in $RELEASE_INFO_FILE"
|
||||
PLATFORM_RELEASE="00.00"
|
||||
fi
|
||||
|
||||
export RPM_BUILD_BASE="$RPM_BUILD_ROOT"
|
||||
@ -1370,7 +1372,7 @@ fi
|
||||
|
||||
# create temp dir
|
||||
export TMPDIR="$MY_WORKSPACE/tmp"
|
||||
mkdir -p $TMPDIR
|
||||
mkdir -p "$TMPDIR"
|
||||
|
||||
# Create symlinks from /var/... to /localdisk/loadbuild/... if on a build server
|
||||
|
||||
@ -1386,12 +1388,23 @@ fi
|
||||
|
||||
ALL=0
|
||||
UNRESOLVED_TARGETS=" "
|
||||
if [ "x$TARGETS" == "x" ]; then
|
||||
echo "make: all"
|
||||
ALL=1
|
||||
|
||||
if [ $DEP_TEST_FLAG -eq 1 ]; then
|
||||
# we expect exactly one package
|
||||
if [ $(echo $TARGETS | wc -w) -ne 1 ]; then
|
||||
echo "ERROR: dependency testing requires exactly one package"
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "make: $TARGETS"
|
||||
UNRESOLVED_TARGETS="$TARGETS"
|
||||
# we accept a list of packages, and no list implies all
|
||||
if [ "x$TARGETS" == "x" ]; then
|
||||
echo "make: all"
|
||||
ALL=1
|
||||
else
|
||||
echo "make: $TARGETS"
|
||||
UNRESOLVED_TARGETS="$TARGETS"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$BUILD_TYPE" != "std" ]; then
|
||||
@ -1520,8 +1533,13 @@ clean_list () {
|
||||
\rm -f -v $RESULT_DIR/mockchain.log 2>> /dev/null
|
||||
mock_clean
|
||||
else
|
||||
# Wipe only traces of what we built
|
||||
mock_partial_clean "$SRPMS_LIST" "$RPMS_LIST"
|
||||
# If dependency test
|
||||
if [ $DEP_TEST_FLAG -eq 1 ]; then
|
||||
mock_clean
|
||||
else
|
||||
# Wipe only traces of what we built
|
||||
mock_partial_clean "$SRPMS_LIST" "$RPMS_LIST"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user