aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2023-05-12 21:12:32 -0400
committerB. Watson <urchlay@slackware.uk>2023-05-12 21:12:32 -0400
commit5220f663e45743cefbc94bb31e26509b88c92c8a (patch)
tree12b3f2c3ef7459b24bf102a1ce90ef5cb402bc74
parent18298dc73a71033049ba1a27e0d0b856aef3850c (diff)
downloadsbo-maintainer-tools-5220f663e45743cefbc94bb31e26509b88c92c8a.tar.gz
sbolint: check TMP PKG OUTPUT; sbopkglint: check empty man dirs.
-rwxr-xr-xsbolint30
-rw-r--r--sbopkglint.d/05-basic-sanity.t.sh2
-rw-r--r--sbopkglint.d/30-manpages.t.sh8
3 files changed, 37 insertions, 3 deletions
diff --git a/sbolint b/sbolint
index 3634f04..748410c 100755
--- a/sbolint
+++ b/sbolint
@@ -196,7 +196,8 @@ I<VERSION> must match the I<VERSION> in the .info file.
=item -
-I<TAG=${TAG:-_SBo}> must occur in the script.
+I<TAG=${TAG:-_SBo}>, I<TMP=${TMP:-/tmp/SBo}>, I<PKG=$TMP/package-$PRGNAM>, and
+I<OUTPUT=${OUTPUT:-/tmp}> must occur in the script.
=item -
@@ -1200,6 +1201,21 @@ sub check_script {
if($tag !~ /\$\{TAG:-(?:_SBo|("|')_SBo(\1))\}/) {
log_error("$file:$lineno: TAG=\${TAG:-_SBo} is required");
}
+ } elsif(/^TMP=(\S+)/) {
+ $tmp = dequote($1);
+ if($tmp ne '${TMP:-/tmp/SBo}') {
+ log_error("$file:$lineno: TMP=\${TMP:-/tmp/SBo} is required");
+ }
+ } elsif(/^PKG=(\S+)/) {
+ $pkg = dequote($1);
+ if($pkg ne '$TMP/package-$PRGNAM') {
+ log_error("$file:$lineno: PKG=\$TMP/package-\$PRGNAM is required");
+ }
+ } elsif(/^OUTPUT=(\S+)/) {
+ $output = dequote($1);
+ if($output ne '${OUTPUT:-/tmp}') {
+ log_error("$file:$lineno: OUTPUT=\${OUTPUT:-/tmp} is required");
+ }
} elsif(/^[^#]*\$\{?CWD\}?\/doinst\.sh/) {
# 20220205 bkw: some scripts don't have a doinst.sh in the
# script dir, but they create one with >> (the jack rt audio stuff
@@ -1276,6 +1292,18 @@ sub check_script {
log_error("$file: no TAG= line");
}
+ if(not defined($tmp)) {
+ log_error("$file: no TMP= line");
+ }
+
+ if(not defined($pkg)) {
+ log_error("$file: no PKG= line");
+ }
+
+ if(not defined($output)) {
+ log_error("$file: no OUTPUT= line");
+ }
+
if(not defined($slackdesc)) {
log_error("$file: doesn't seem to install slack-desc in \$PKG/install");
}
diff --git a/sbopkglint.d/05-basic-sanity.t.sh b/sbopkglint.d/05-basic-sanity.t.sh
index cfdf9cd..0600036 100644
--- a/sbopkglint.d/05-basic-sanity.t.sh
+++ b/sbopkglint.d/05-basic-sanity.t.sh
@@ -165,5 +165,5 @@ brokenlinks="$( find -L . -type l \! -lname '/*' )"
# 20230320 bkw: empty directories. this isn't an error, just a note, and
# we ignore any empty dirs under /var because lots of packages need these.
-emptydirs="$( find . -type d -a -empty | grep -v 'var\>' )"
+emptydirs="$( find . -type d -a -empty | grep -v '^\./var\>' )"
[ -n "$emptydirs" ] && note "package contains empty dirs, are these necessary?" && ls -ld $emptydirs
diff --git a/sbopkglint.d/30-manpages.t.sh b/sbopkglint.d/30-manpages.t.sh
index 30c3841..7ab56d4 100644
--- a/sbopkglint.d/30-manpages.t.sh
+++ b/sbopkglint.d/30-manpages.t.sh
@@ -91,6 +91,7 @@ check_locale_dir() {
if [ -d usr/man ]; then
find usr/man -type f > .manpages.$$
find usr/man -mindepth 1 -type d > .mandirs.$$
+ find usr/man -type d -a -empty > .manemptydirs.$$
while read d; do
[ "$( stat -c '%a %U %G' "$d" )" != "755 root root" ] && BADDIRPERMS+="$d "
@@ -113,7 +114,12 @@ if [ -d usr/man ]; then
esac
done < .manpages.$$
- rm -f .manpages.$$ .mandirs.$$
+ if [ -s .manemptydirs.$$ ]; then
+ warn "empty dir(s) in /usr/man:"
+ cat .manemptydirs.$$
+ fi
+
+ rm -f .manpages.$$ .mandirs.$$ manemptydirs.$$
[ -n "$BADPERMS" ] && warn "bad man page owner/permissions (should be 0644, root:root)" && ls -ld $BADPERMS
[ -n "$BADDIRPERMS" ] && warn "bad man directory owner/permissions (should be 0755, root:root)" && ls -ld $BADDIRPERMS