aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2023-06-21 14:34:35 -0400
committerB. Watson <urchlay@slackware.uk>2023-06-21 14:34:35 -0400
commit919b0a7dfa853bb2bc448956992bc427c17f9a3d (patch)
treed745220eab05e180bc61c360be9fec70621c5f8a
parent0fbac3dd5e0471aa08e5ec48ecefd45ea31e8376 (diff)
downloadsbo-maintainer-tools-919b0a7dfa853bb2bc448956992bc427c17f9a3d.tar.gz
sbopkglint: option bundling and long options.
-rw-r--r--NEWS2
-rwxr-xr-xsbopkglint50
2 files changed, 37 insertions, 15 deletions
diff --git a/NEWS b/NEWS
index 4a9b2e0..e7cb265 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,8 @@ sbopkglint:
- Spaces in filenames are now handled correctly.
- Permissions and ownership of icons are now checked.
- Shared libraries are now checked for +x permission.
+- Option bundling is now supported (e.g. -ki is the same as -k -i).
+- Long names for all options (see --help or man page).
sbolint:
- Warning: -n option has changed meaning! It used to mean "no warnings",
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<stdout>.
-=item B<--version>
+=item B<-v>, B<--version>
Print the B<sbopkglint> version number on B<stdout> 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 )"