aboutsummaryrefslogtreecommitdiff
path: root/sbolint
diff options
context:
space:
mode:
Diffstat (limited to 'sbolint')
-rwxr-xr-xsbolint66
1 files changed, 66 insertions, 0 deletions
diff --git a/sbolint b/sbolint
index 6fc644d..1b9d61b 100755
--- a/sbolint
+++ b/sbolint
@@ -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";