diff options
author | B. Watson <urchlay@slackware.uk> | 2023-06-19 14:17:51 -0400 |
---|---|---|
committer | B. Watson <urchlay@slackware.uk> | 2023-06-19 14:17:51 -0400 |
commit | f1b7e4355c01521758cd1d9881c29d07134d1a84 (patch) | |
tree | 8b1021133aae0b6e273a4cd0e30f204c2507530d | |
parent | 13e6b643cbb46d1f9a8156e401ff33c78509eb64 (diff) | |
download | sbo-maintainer-tools-f1b7e4355c01521758cd1d9881c29d07134d1a84.tar.gz |
sbolint: doinst.sh content check.
-rw-r--r-- | NEWS | 5 | ||||
-rwxr-xr-x | sbolint | 66 |
2 files changed, 71 insertions, 0 deletions
@@ -7,6 +7,11 @@ New in 0.9.0: sbopkglint: - Spaces in filenames are now handled correctly. - Permissions and ownership of icons are now checked. +- Shared libraries are now checked for +x permission. + +sbolint: +- If doinst.sh exists, it's checked for correct usage of config(), + preserve_perms(), and gtk-update-icon-cache. New in 0.8.2: ============= @@ -214,6 +214,17 @@ If there is a doinst.sh script, the SlackBuild must install it to I<$PKG/install =item - +If there is a doinst.sh script, and it uses the config() function, the function must +be defined before it's used. Also, config files passed to config() must end with +a B<.new> suffix. + +=item - + +If there is a doinst.sh script, and it calls B<gtk-update-icon-cache>, the existence +of the cache must be checked before this command is run. + +=item - + Template boilerplate comments should be removed, e.g. I<"REMOVE THIS ENTIRE BLOCK OF TEXT"> or I<"Automatically determine the architecture we're building on">. @@ -657,6 +668,7 @@ sub run_checks { \&check_slackdesc, \&check_info, \&check_script, + \&check_doinst, \&check_images, \&check_empty_hidden, ); @@ -1464,6 +1476,60 @@ sub check_script { } } +sub check_doinst { + my $file = "doinst.sh"; + return unless -f $file; + my @lines = check_and_read($file); + return unless scalar @lines; + + my $lineno = 0; + my ($config_defined, $icon_theme_check, $pp_defined); + + for(@lines) { + $lineno++; + s,#.*,,; + s,^\s*,,; + s,\s*$,,; + next unless /./; + + if(/^config\(\)/) { + $config_defined = $lineno; + } elsif(/^config\s+/) { + # the [\@\$] is intended to skip stuff like $NEW, or a for loop variable, + # or something intended to be sedded like @PATH@. + if(/^config\s+\//) { + log_error("$file:$lineno: 'config' uses absolute path."); + } + if(!/[\@\$]/ && !/\.new["']?$/) { + log_error("$file:$lineno: 'config' filename missing .new suffix."); + } + if(!$config_defined) { + log_error("$file:$lineno: 'config' function used, but not defined."); + } + } elsif(/^preserve_perms\(\)/) { + $pp_defined = $lineno; + } elsif(/^preserve_perms\s+/) { + if(/^preserve_perms\s+\//) { + log_error("$file:$lineno: 'preserve_perms' uses absolute path."); + } + if(!/[\@\$]/ && !/\.new["']?$/) { + log_error("$file:$lineno: 'preserve_perms' filename missing .new suffix."); + } + if(!$pp_defined) { + log_error("$file:$lineno: 'preserve_perms' function used, but not defined."); + } + } elsif(m,-e\s+usr/share/icons/[^/]*/icon-theme\.cache,) { + $icon_theme_check = $lineno; + } elsif(m,usr/bin/gtk-update-icon-cache.*usr/share/icons,) { + if(!$icon_theme_check) { + log_error("$file:$lineno: icon cache created unconditionally!"); + } + undef $icon_theme_check; # in case there's multiple icon dirs + } + } + +} + sub findem { my ($findcmd, $errmsg) = @_; open my $fh, "-|", "$findcmd"; |