aboutsummaryrefslogtreecommitdiff
path: root/sbopkglint
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2022-04-08 14:52:58 -0400
committerB. Watson <yalhcru@gmail.com>2022-04-08 14:52:58 -0400
commit835f7cdaf808ed39bad7b08732266b718874c6e1 (patch)
tree9cf5d5bb5bedcc5d94267697a5f4862386294d16 /sbopkglint
parent90a2e202dc5867f0511020c9749a91ca98403fde (diff)
downloadsbo-maintainer-tools-835f7cdaf808ed39bad7b08732266b718874c6e1.tar.gz
cosmetics; --version; sbopkglint summary
Diffstat (limited to 'sbopkglint')
-rwxr-xr-xsbopkglint59
1 files changed, 46 insertions, 13 deletions
diff --git a/sbopkglint b/sbopkglint
index 16965b4..970816c 100755
--- a/sbopkglint
+++ b/sbopkglint
@@ -1,5 +1,10 @@
#!/bin/bash
+# 20220408 bkw: note to self: VER must be in sync with VERSION in sbolint
+# and the Makefile.
+
+VER=0.5
+
: <<EOF
=pod
@@ -37,7 +42,8 @@ Diagnostics will be logged to stdout and stderr. Exit status will
be 0 if all tests passed, non-zero otherwise.
This script must run as root. If you run it as a normal user, it tries
-to re-execute itself via sudo(8).
+to re-execute itself via sudo(8) before installing any packages. If
+you dislike sudo, you can always run it as root.
=head1 OPTIONS
@@ -73,6 +79,10 @@ pager (e.g. less(1) or more(1)) to display it.
Convert this documentation to a man page, on stdout.
+=item B<--version>
+
+Print the B<sbopkglint> version number on stdout and exit.
+
=back
=head1 EXIT STATUS
@@ -341,7 +351,7 @@ problem, so it might not be fixed any time soon.
=head1 AUTHOR
-B. Watson <urchlay@slackware.uk>, AKA Urchlay on Libera IRC.
+B. Watson <urchlay@slackware.uk>, aka Urchlay on Libera IRC.
=head1 SEE ALSO
@@ -350,18 +360,11 @@ B<sbolint>(1)
=cut
EOF
-# lint a binary Slackware package. primarily intended for use with
-# SBo packages, but could be used for any Slack pkg.
-
-# this must be run as root, as it installs the package in a temp dir,
-# with "installpkg -root". if it's not running as root, it tries to
-# run itself via sudo.
-
SELF="$( basename $0 )"
usage() {
cat 1>&2 <<EOF
-$SELF - check SBo binary packages for various problems
+$SELF v$VER - check SBo binary packages for various problems
Usage:
$0 [-k] [-i] [-s] [/path/to/package-file] [...]
@@ -370,8 +373,11 @@ Usage:
Options:
-k Keep (don't delete) the package install directory at exit.
-i Do not check for INSTALL in the doc dir.
+-s Do not check for \$PRGNAM.SlackBuild in doc dir.
+--help Show short help message (you're looking at it now).
--doc See the full documentation in your pager.
--man Convert the full documentation to a man page, on stdout.
+--version Print the sbopkglint version number on stdout and exit.
With no package arguments, it looks for a SlackBuild in the current
directory, extracts the PRINT_PACKAGE_NAME information, and tries to
@@ -384,14 +390,16 @@ Diagnostics will be logged to stdout and stderr. Exit status will
be 0 if all tests passed, non-zero otherwise.
This script must run as root. If you run it as a normal user, it tries
-to re-execute itself via sudo(8).
+to re-execute itself via sudo(8) before installing any packages. If
+you dislike sudo, you can always run it as root.
EOF
}
while true; do
case "$1" in
+ --version) echo $VER ; exit 0 ;;
--doc) exec perldoc "$0" ;;
- --man) exec pod2man --stderr -s1 -csbo-maintainer-tools -r0.5 "$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;;
@@ -461,6 +469,14 @@ done
echo "Using tests from $testdir"
+if echo "$packages" | grep -q ' '; then
+ want_summary=1
+fi
+
+faillist=""
+passcount=0
+failcount=0
+
for package in $packages; do
filename="$( basename $package )"
@@ -469,7 +485,7 @@ for package in $packages; do
VERSION="$( echo $filename | rev | cut -d- -f3 | rev )"
PKG="$( mktemp -d $TMP/sbopkglint.XXXXXX )"
- echo -n "Installing $package to $PKG..."
+ echo -n "Installing $package to $PKG ..."
/sbin/installpkg -root "$PKG" "$package" &> $PKG/.tmp.$$
S="$?"
@@ -520,10 +536,27 @@ for package in $packages; do
if [ "$totalwarns" = "0" ]; then
echo "=== $filename: All tests passed"
+ : $(( passcount ++ ))
else
exit_status=1
echo "!!! $filename: $totalwarns failures"
+ : $(( failcount ++ ))
+ faillist+="$filename "
fi
+ [ "$want_summary" = "1" ] && echo
done
+if [ "$want_summary" = "1" ]; then
+ count=$(( failcount + passcount ))
+ echo "=== $count packages linted, $passcount passed, $failcount failed"
+ if [ "$failcount" = "0" ]; then
+ echo "=== All packages check out OK"
+ else
+ echo "!!! Failed packages:"
+ for i in $faillist; do
+ echo $i
+ done
+ fi
+fi
+
exit $exit_status