From d6083f48ab92a3517f97a3aa888747a441ae62d8 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Sat, 4 Feb 2023 04:52:30 -0500 Subject: sbolint: detect PRINT_PACKAGE_NAME issues. --- sbolint | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/sbolint b/sbolint index b98ee08..0a67943 100755 --- a/sbolint +++ b/sbolint @@ -1131,7 +1131,7 @@ sub check_script { my $lineno = 0; my ($prgnam, $version, $build, $tag, $need_doinst, $slackdesc, $makepkg, $install); - my ($cdpkg, $codestart, $lint_enabled, $print_pkg_name); + my ($cdpkg, $codestart, $lint_enabled, $print_pkg_name, $pkg_type, $arch_lineno); $lint_enabled = 1; for(@lines) { @@ -1227,7 +1227,16 @@ sub check_script { # 20220312 bkw: 15.0 template if(/^[^#]*\$.*PRINT_PACKAGE_NAME/) { - $print_pkg_name = 1; + $print_pkg_name = $lineno; + } + + # 20230204 bkw: more 15.0 template + if(/^PKGTYPE=/) { + $pkg_type = $lineno; + } + + if((not defined $arch_lineno) && (/\bARCH=/)) { + $arch_lineno = $lineno; } } @@ -1255,7 +1264,15 @@ sub check_script { log_error("$file: no makepkg command found"); } - if(not defined($print_pkg_name)) { + # 20230204 bkw: better support for 15.0 template. + if(defined($print_pkg_name)) { + if((!defined $pkg_type) || ($pkg_type > $print_pkg_name)) { + log_error("$file: PKGTYPE not defined before PRINT_PACKAGE_NAME stanza (Slackware >= 15.0)"); + } + if((!defined $arch_lineno) || ($arch_lineno > $print_pkg_name)) { + log_error("$file: ARCH not defined before PRINT_PACKAGE_NAME stanza (Slackware >= 15.0)"); + } + } else { log_error("$file: missing PRINT_PACKAGE_NAME stanza (Slackware >= 15.0)"); } -- cgit v1.2.3