tweak script to skip packages with an empty REQUIRES= line unless new SKIP_EMPTY variable at top of script is uncommented.

This commit is contained in:
chess.griffin 2013-03-01 04:31:48 +00:00
parent b474cba048
commit f93141cb9f

View File

@ -36,12 +36,17 @@ SBOPKG_CONF=${SBOPKG_CONF:-/etc/sbopkg/sbopkg.conf}
# The user may want to change QUEUEDIR to a local temporary directory in $HOME
# since queuefiles in QUEUEDIR will be overwritten by this script. QUEUEDIR
# is commented out on purpose to get the user to review these variables.
# QUEUEDIR must be writable by the user executing the script.
# QUEUEDIR must be writable by the user executing the script. SKIP_EMPTY
# means the script will not create queuefiles for packages with an empty
# REQUIRES= line in the .info file. Uncomment or export a value to create
# queuefiles for packages with an empty REQUIRES= line (which will only
# contain the package name in the queuefile since there are no REQUIRES).
#QUEUEDIR=${QUEUEDIR:-/var/lib/sbopkg/queues}
REPO_ROOT=${REPO_ROOT:-/var/lib/sbopkg}
REPO_NAME=${REPO_NAME:-SBo}
REPO_BRANCH=${REPO_BRANCH:-14.0}
#SKIP_EMPTY=${SKIP_EMPTY:-NO}
### NO CHANGES SHOULD BE NECESSARY BELOW THIS LINE ###
@ -70,7 +75,9 @@ usage() {
cat << EOF
Usage: $SCRIPT [-a] to build all queuefiles or [-p <package>] for individual
packages. Multiple packages can be passed with quotes, e.g. -p "pkg1" "pkg2".
Package names are case-sensitive. Use 'sbopkg -g pkg' to search if needed.
Packages with an empty REQUIRES= line will be skipped unless SKIP_EMPTY is
uncommented at the top of the script. Package names are case-sensitive. Use
'sbopkg -g pkg' to search if needed.
This script will overwrite existing queuefiles in \$QUEUEDIR so back up any
existing queuefiles or local modifications. Check the top of the script for
@ -104,7 +111,7 @@ parse_queuefile_requires () {
echo "$DEP" >> $QUEUEFILE
parse_queuefile_requires $DEP
elif [[ "$DEP" == "%README%" ]]; then
echo "# %README% - see the $PARSEAPP README file. " >> $QUEUEFILE
echo "# %README%: see the $PARSEAPP README file. " >> $QUEUEFILE
fi
done
else
@ -122,22 +129,32 @@ build_queuefile () {
}
main_loop () {
local MAINAPP="$1"
local MAINAPP="$1" INFO
if [[ $MAINAPP == "_all" ]]; then
printf "Processing all SlackBuilds in the $REPO_SUBPATH repo..."
for INFO in $(find $REPO_DIR -name *.info); do
printf "."
. $INFO
build_queuefile
if [[ -z $REQUIRES && $SKIP_EMPTY == "" ]]; then
continue
else
printf "."
build_queuefile
fi
done
else
for MAINAPP in $PKG; do
if search_package $MAINAPP; then
echo "Processing $MAINAPP."
. $REPO_DIR/$PKGPATH/$MAINAPP.info
build_queuefile
if [[ -z $REQUIRES && $SKIP_EMPTY == "" ]]; then
echo "$MAINAPP: empty REQUIRES line. No queuefile generated."
echo "Uncomment SKIP_EMPTY to change this."
continue
else
echo "Processing $MAINAPP."
build_queuefile
fi
else
echo "$MAINAPP not found. Exiting."
echo "$MAINAPP: not found."
exit 1
fi
done