From f93141cb9f2efc7d158bfbaa3d45f24ec154867a Mon Sep 17 00:00:00 2001 From: "chess.griffin" Date: Fri, 1 Mar 2013 04:31:48 +0000 Subject: [PATCH] tweak script to skip packages with an empty REQUIRES= line unless new SKIP_EMPTY variable at top of script is uncommented. --- src/usr/doc/contrib/sqg | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/src/usr/doc/contrib/sqg b/src/usr/doc/contrib/sqg index 1738af3..dd06dc1 100755 --- a/src/usr/doc/contrib/sqg +++ b/src/usr/doc/contrib/sqg @@ -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 ] 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