aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2023-05-30 12:26:09 -0400
committerB. Watson <urchlay@slackware.uk>2023-05-30 12:26:09 -0400
commitb76a6efb4668d3fa60905a575d75ade4dcfabb85 (patch)
treed55fe87f39b6c7782c019595a5f51370db0a3379
parentb32fed5e41ba86761853342b88b12121f64bfe0a (diff)
downloadsbo-maintainer-tools-b76a6efb4668d3fa60905a575d75ade4dcfabb85.tar.gz
sbolint: add douninst.sh checks; sbopkglint: add hardcoded $TMP check.
-rw-r--r--TODO8
-rwxr-xr-xsbolint19
-rwxr-xr-xsbopkglint5
-rw-r--r--sbopkglint.d/70-tmp_path.t.sh16
4 files changed, 39 insertions, 9 deletions
diff --git a/TODO b/TODO
index 9d1787f..70ad4ed 100644
--- a/TODO
+++ b/TODO
@@ -1,9 +1,7 @@
-TODO: sbopkglint should disallow new dirs in /usr (other than the
- standard ones).
-TODO: sbopklint: check libtins and anything-sync-daemon...
-TODO: sbolint: same checks for douninst.sh as we have for doinst.sh.
+TODO: check for "if [ -x /usr/bin/whatever ]" in doinst.sh, warn
+ if missing. this could be an ill-defined mess.
TODO: sbolint should warn if LIBDIRSUFFIX and/or SLKCFLAGS are
- set but never used. And/or, sbopklint could complain if
+ set but never used. And/or, sbopkglint could complain if
the SlackBuild sets SLKCFLAGS but there's no native code.
TODO: check for non-executable shared libs.
diff --git a/sbolint b/sbolint
index 675685f..5dbeb6d 100755
--- a/sbolint
+++ b/sbolint
@@ -1171,7 +1171,7 @@ sub check_script {
}
my $lineno = 0;
- my ($prgnam, $version, $build, $tag, $need_doinst, $slackdesc, $makepkg, $install);
+ my ($prgnam, $version, $build, $tag, $need_doinst, $need_douninst, $slackdesc, $makepkg, $install);
my ($cdpkg, $codestart, $lint_enabled, $print_pkg_name, $pkg_type, $arch_lineno);
my ($old_arch, $old_flags, $have_py2, $have_py3);
$lint_enabled = 1;
@@ -1254,6 +1254,8 @@ sub check_script {
# script dir, but they create one with >> (the jack rt audio stuff
# does this).
$need_doinst = $lineno;
+ } elsif(/^[^#]*\$\{?CWD\}?\/douninst\.sh(?:"|'|\s|>)/) {
+ $need_douninst = $lineno;
} elsif(/^[^#]*slack-desc/) {
$slackdesc = $lineno;
$install = $lineno if m,install/,; # assume OK
@@ -1382,16 +1384,29 @@ sub check_script {
log_error("$file: nothing gets installed in \$PKG/install");
}
- my $have_doinst = (-f "doinst.sh");
+ my $have_doinst = (-f "doinst.sh");
+ my $have_douninst = (-f "douninst.sh");
+
if($have_doinst) {
check_and_read("doinst.sh", 0644);
}
+
+ if($have_douninst) {
+ check_and_read("douninst.sh", 0644);
+ }
+
if($need_doinst && !$have_doinst) {
log_error("$file:$need_doinst: script installs doinst.sh, but it doesn't exist");
} elsif($have_doinst && !$need_doinst) {
log_error("$file: doinst.sh exists, but the script doesn't install it");
}
+ if($need_douninst && !$have_douninst) {
+ log_error("$file:$need_douninst: script installs douninst.sh, but it doesn't exist");
+ } elsif($have_douninst && !$need_douninst) {
+ log_error("$file: douninst.sh exists, but the script doesn't install it");
+ }
+
if($old_arch) {
# checking for the flags is supposed to let us tell the difference between
# source builds and binary repacks. since we have 30 or so old binary repack
diff --git a/sbopkglint b/sbopkglint
index b7648a5..917af58 100755
--- a/sbopkglint
+++ b/sbopkglint
@@ -469,8 +469,9 @@ die() {
exit 1
}
-TMP=${TMP:-/tmp}
-OUTPUT=${OUTPUT:-$TMP}
+# N.B. these need to match the template (and they do)
+TMP=${TMP:-/tmp/SBo}
+OUTPUT=${OUTPUT:-/tmp}
exit_status=0
diff --git a/sbopkglint.d/70-tmp_path.t.sh b/sbopkglint.d/70-tmp_path.t.sh
new file mode 100644
index 0000000..9d1f090
--- /dev/null
+++ b/sbopkglint.d/70-tmp_path.t.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+# sbopkglint test, must be sourced by sbopkglint (not run standalone).
+
+# PKG, PRGNAM, VERSION, ARCH are set by sbopkglint. also the current
+# directory is the root of the installed package tree.
+
+#######################################################################
+# checks for /tmp/SBo (or the environment TMP) hardcoded in files.
+# don't check the SlackBuild in the doc dir, since it's guaranteed to match.
+
+found="$(find . -type f | grep -v '^\./usr/doc/.*\.SlackBuild$' | xargs fgrep -l "$TMP")"
+if [ -n "$found" ]; then
+ warn "found files with TMP ($TMP) baked in:"
+ echo "$found" 1>&2
+fi