From 919b0a7dfa853bb2bc448956992bc427c17f9a3d Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Wed, 21 Jun 2023 14:34:35 -0400 Subject: sbopkglint: option bundling and long options. --- sbopkglint | 50 +++++++++++++++++++++++++++++++++++--------------- 1 file changed, 35 insertions(+), 15 deletions(-) (limited to 'sbopkglint') diff --git a/sbopkglint b/sbopkglint index 3e50e4e..f96d0a7 100755 --- a/sbopkglint +++ b/sbopkglint @@ -51,15 +51,15 @@ code, unless something really is wrong with it. =head1 OPTIONS -Do not bundle options. Use e.g. B<-k -i>, not B<-ki>. +Bundling options is supported, e.g. B<-ki> is the same as B<-k -i>. =over 4 -=item B<-k> +=item B<-k>, B<--keep> Keep the temporary package install directory instead of deleting it on exit. -=item B<-i> +=item B<-i>, B<--install-ok> Disable the "useless-looking install instructions" test. This is intended for SBo admins mass-linting a ton of packages. INSTALL in @@ -67,7 +67,7 @@ the doc dir is something that exists in thousands of existing builds, and it's not a major problem. New builds and updates should be linted without this option, however. -=item B<-s> +=item B<-s>, B<--slackbuild-missing-ok> Disable the check for /usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild. For use with non-SBo packages (including core Slackware packages). @@ -90,7 +90,7 @@ pager (e.g. less(1) or more(1)) to display it. Convert this documentation to a man page, on B. -=item B<--version> +=item B<-v>, B<--version> Print the B version number on B and exit. @@ -389,17 +389,31 @@ SELF="$( basename $0 )" COLOR=${COLOR:-auto} -while true; do +# Note: list long options with the -- but short ones without the - here. +parse_option() { case "$1" in - --version) echo $VER ; exit 0 ;; - -h*|--h*|--doc) exec perldoc "$0" ;; + --version|v) echo $VER ; exit 0 ;; + --h*|--doc|h) exec perldoc "$0" ;; --man) exec pod2man --stderr -s1 -csbo-maintainer-tools -r$VER "$0" ;; - -k) KEEP=1 ; shift ;; - -i) INSTALL_DOCS_OK=1 ; shift;; - -s) SLACKBUILD_MISSING_OK=1 ; shift;; - -c|--color) COLOR=yes ; shift ;; - -m|--mono*) COLOR=no ; shift ;; - -*) echo "$SELF: invalid option '$1', try '$SELF --help'" ; exit 1 ;; + --keep|k) KEEP=1 ;; + --install-ok|i) INSTALL_DOCS_OK=1 ;; + --slackbuild-missing-ok|s) SLACKBUILD_MISSING_OK=1 ;; + --color|c) COLOR=yes ;; + --mono*|m) COLOR=no ;; + *) echo "$SELF: invalid option '$1', try '$SELF --help'" ; exit 1 ;; + esac +} + +while true; do + case "$1" in + --) shift ; break ;; + --*) parse_option "$1" ; shift ;; + -*) + opt="$( printf "%s" "$1" | sed -e 's,^-,,' -e 's,\(.\),\1 ,g' )" + for i in $opt; do + parse_option "$i" + done + shift ;; *) break ;; esac done @@ -428,7 +442,7 @@ if [ "$(id -u)" != "0" ]; then SBOPKGLINT_PATH="$SBOPKGLINT_PATH" \ SLACKBUILD_MISSING_OK="$SLACKBUILD_MISSING_OK" \ COLOR="$COLOR" \ - "$0" "$@" + "$0" -- "$@" fi if [ "$COLOR" = "auto" ]; then @@ -539,6 +553,12 @@ passcount=0 failcount=0 for package in $packages; do + if [ ! -e "$package" ]; then + warn "$package does not exist" + echo_FAILED + continue + fi + filename="$( basename $package )" ARCH="$( echo $filename | rev | cut -d- -f2 | rev )" -- cgit v1.2.3