root/build-tools/classify
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.8 KiB
Plaintext

classify () {
local pkg_dir="$1"
if [ -f $pkg_dir/centos/srpm_path ]; then
# echo "srpm + patch: $(basename $(cat $pkg_dir/centos/srpm_path | head -n 1))"
echo "srpm + patches"
elif [ -f $pkg_dir/centos/*.spec ]; then
if [ -f $pkg_dir/centos/build_srpm ]; then
# echo "spec + custom_script: $pkg_dir"
echo "spec + custom_script"
elif [ -f $pkg_dir/centos/build_srpm.data ]; then
local ALLOW_EMPTY_RPM=""
local COPY_LIST=""
local SRC_DIR=""
local PKG_BASE="$pkg_dir"
source $pkg_dir/centos/build_srpm.data
if [ "" != "$SRC_DIR" ] ; then
# echo "spec + src_dir: $pkg_dir/$SRC_DIR"
echo "spec + src_dir"
elif [ "" != "$COPY_LIST" ] ; then
local TARBALL=""
for f in $COPY_LIST; do
case $f in
*.tar.gz) TARBALL=$f ;;
*.tgz) TARBALL=$f ;;
*.tar.bz2) TARBALL=$f ;;
*.tar.xz) TARBALL=$f ;;
*.tar) TARBALL=$f ;;
esac
done
if [ "" != "$TARBALL" ]; then
# echo "spec + tarball: $pkg_dir/$TARBALL"
echo "spec + tarball"
else
# echo "spec + files: $pkg_dir"
echo "spec + files"
fi
elif [ "$ALLOW_EMPTY_RPM" == "true" ] ; then
# echo "spec + empty: $pkg_dir"
echo "spec + empty"
else
# echo "spec + build_srpm.data + unknown: $pkg_dir"
# cat $pkg_dir/centos/build_srpm.data
echo "spec + build_srpm.data + unknown"
fi
else
# echo "spec + unknown: $pkg_dir"
echo "spec + unknown"
fi
else
# echo "unknown: $pkg_dir"
echo "unknown"
fi
}