sqg: Check for invalid .info files before processing.

Fixed #46.

Signed-off-by: Willy Sudiarto Raharjo <willysr@sbopkg.org>
This commit is contained in:
Willy Sudiarto Raharjo 2018-06-07 06:03:54 +07:00
parent 1bba4609d7
commit 35ceb9ce32
No known key found for this signature in database
GPG Key ID: 887B8374D7333381
2 changed files with 33 additions and 8 deletions

View File

@ -234,3 +234,19 @@ execute_build () {
build_queuefile_custom "$QUEUEDIR" "$CUSTOM_QUEUE" "$PKGS"
fi
}
#
# Check .info validity
# We only check for PRGNAM for now, but more may be added in the future
#
check_validity() {
local INFO_FILE="$1"
check_program=`grep PRGNAM $INFO_FILE`
if [ $? -eq 0 ]; then
return 0
else
return 1
fi
}

View File

@ -9,13 +9,22 @@ INFO="$3"
VERBOSE="${4:-no}"
CUSTOM_QUEUE="${5:-}"
. $INFO
check_validity $INFO
if [ "$VERBOSE" == "yes" ]; then
if [ $? -ne 0 ]; then
echo ""
echo "Found invalid .info file: $INFO. Skipping."
echo ""
continue;
else
. $INFO
if [ "$VERBOSE" == "yes" ]; then
INFO_BASENAME=$(basename $INFO .info)
echo "Processing $INFO_BASENAME."
fi
fi
if [[ ! -z $REQUIRES ]]; then
if [[ ! -z $REQUIRES ]]; then
build_queuefile "$REPO_DIR" "$QUEUEDIR" "$PRGNAM" "$CUSTOM_QUEUE"
fi
fi