aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2023-05-30 13:57:20 -0400
committerB. Watson <urchlay@slackware.uk>2023-05-30 13:57:20 -0400
commite9ba15e5acce91405f8a743d74987d01c3cd8c53 (patch)
treecb48aeb093c9d9ac5d092e784997cf129277c79c
parentb76a6efb4668d3fa60905a575d75ade4dcfabb85 (diff)
downloadsbo-maintainer-tools-e9ba15e5acce91405f8a743d74987d01c3cd8c53.tar.gz
sbolint: check that LIBDIRSUFFIX and SLKCFLAGS get used, if set.
-rw-r--r--TODO5
-rwxr-xr-xsbolint17
2 files changed, 19 insertions, 3 deletions
diff --git a/TODO b/TODO
index 70ad4ed..6828728 100644
--- a/TODO
+++ b/TODO
@@ -1,8 +1,7 @@
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, sbopkglint could complain if
- the SlackBuild sets SLKCFLAGS but there's no native code.
+TODO: sbopkglint could complain if the SlackBuild sets SLKCFLAGS
+ but there's no native code.
TODO: check for non-executable shared libs.
Future test ideas:
diff --git a/sbolint b/sbolint
index 5dbeb6d..bf6e25e 100755
--- a/sbolint
+++ b/sbolint
@@ -1174,6 +1174,7 @@ sub check_script {
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);
+ my ($libsuf_set, $flags_set, $libsuf_used, $flags_used);
$lint_enabled = 1;
for(@lines) {
@@ -1249,6 +1250,14 @@ sub check_script {
if($output !~ m,\$\{OUTPUT:-(?:/tmp|(["'])/tmp\1)\},) {
log_error("$file:$lineno: OUTPUT=\${OUTPUT:-/tmp} is required");
}
+ } elsif(/^[^#]*LIBDIRSUFFIX=/) {
+ $libsuf_set = $lineno;
+ } elsif(/^[^#]*SLKCFLAGS=/) {
+ $flags_set = $lineno;
+ } elsif(/^[^#]*\$\{?LIBDIRSUFFIX/) {
+ $libsuf_used = $lineno;
+ } elsif(/^[^#]*\$\{?SLKCFLAGS/) {
+ $flags_used = $lineno;
} elsif(/^[^#]*\$\{?CWD\}?\/doinst\.sh(?:"|'|\s|>)/) {
# 20220205 bkw: some scripts don't have a doinst.sh in the
# script dir, but they create one with >> (the jack rt audio stuff
@@ -1423,6 +1432,14 @@ sub check_script {
if($have_py2 && $have_py3) {
log_note("$file: it looks like this build includes both python2 and python3 code. consider splitting it into separate python2- and python3- builds.");
}
+
+ if($flags_set && (!$flags_used)) {
+ log_warning("$file:$flags_set: SLKCFLAGS gets set, but never used.");
+ }
+
+ if($libsuf_set && (!$libsuf_used)) {
+ log_warning("$file:$libsuf_set: LIBDIRSUFFIX gets set, but never used.");
+ }
}
sub findem {