diff options
author | B. Watson <urchlay@slackware.uk> | 2023-05-30 13:57:20 -0400 |
---|---|---|
committer | B. Watson <urchlay@slackware.uk> | 2023-05-30 13:57:20 -0400 |
commit | e9ba15e5acce91405f8a743d74987d01c3cd8c53 (patch) | |
tree | cb48aeb093c9d9ac5d092e784997cf129277c79c | |
parent | b76a6efb4668d3fa60905a575d75ade4dcfabb85 (diff) | |
download | sbo-maintainer-tools-e9ba15e5acce91405f8a743d74987d01c3cd8c53.tar.gz |
sbolint: check that LIBDIRSUFFIX and SLKCFLAGS get used, if set.
-rw-r--r-- | TODO | 5 | ||||
-rwxr-xr-x | sbolint | 17 |
2 files changed, 19 insertions, 3 deletions
@@ -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: @@ -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 { |