From 2f947ddf32f47f570855eeaed6635930b9767870 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Mon, 20 Mar 2017 16:56:57 -0400 Subject: sbolint: various fixes --- sbolint | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) (limited to 'sbolint') diff --git a/sbolint b/sbolint index 4577f1f..fdd4a13 100755 --- a/sbolint +++ b/sbolint @@ -304,10 +304,12 @@ for(@ARGV) { $g_errcount += $errcount; $g_warncount += $warncount; - if($errcount == 0 and $warncount == 0) { - print "$buildname checks out OK\n" unless $quiet; - } else { - print "$buildname: errors $errcount, warnings $warncount\n"; + if(!$quiet) { + if($errcount == 0 and $warncount == 0) { + print "$buildname checks out OK\n"; + } else { + print "$buildname: errors $errcount, warnings $warncount\n"; + } } } @@ -320,6 +322,14 @@ if(!$quiet && @ARGV > 1) { exit ($g_errcount > 0 || (!$nowarn && $g_warncount > 0)); # } +sub dequote { + my $a = shift; + #warn "dequote arg: $a\n"; + $a =~ s/^("|')(\S+)(\1)$/$2/; + #warn "dequote ret: $a\n"; + return $a; +} + sub logmsg { my $severity = shift; my $format = shift; @@ -907,33 +917,32 @@ sub check_script { for(@lines) { $lineno++; if(/^PRGNAM=(\S+)/) { - $prgnam = $1; - if($1 ne $buildname) { - log_error("$file:$lineno: PRGNAM doesn't match dir name ($1 != $buildname)"); + $prgnam = dequote($1); + if($prgnam ne $buildname) { + log_error("$file:$lineno: PRGNAM doesn't match dir name ($prgnam != $buildname)"); } } elsif(/^VERSION=(\S+)/) { - $version = $1; - $version =~ s/^["']|["']$//g; + $version = dequote($1); if(not ($version =~ s/\$\{VERSION:-([^}]+)\}/$1/)) { log_warning("$file:$lineno: VERSION ignores environment (try VERSION=\${VERSION:-$version}"); } + $version = dequote($1); if($version ne $info{VERSION}) { log_error("$file:$lineno: VERSION ($version) doesn't match VERSION in the .info file ($info{VERSION})"); } } elsif(/^BUILD=(\S+)/) { - $build = $1; - $build =~ s/^["']|["']$//g; + $build = dequote($1); if(not ($build =~ /\d/)) { log_error("$file:$lineno: BUILD is non-numeric"); } elsif(not ($build =~ /\$\{BUILD:-\d+}/)) { log_warning("$file:$lineno: BUILD ignores environment (try BUILD=\${BUILD:-$build}"); } } elsif(/^TAG=(\S+)/) { - $tag = $1; - if($tag ne '${TAG:-_SBo}') { + $tag = dequote($1); + if($tag !~ /\$\{TAG:-(?:_SBo|("|')_SBo(\1))\}/) { log_error("$file:$lineno: TAG=\${TAG:-_SBo} is required"); } - } elsif(/^\s*cat\s+\$CWD\/doinst.sh/) { + } elsif(/^[^#]*\s+\$CWD\/doinst.sh/) { $need_doinst = $lineno; } elsif(/^[^#]*slack-desc/) { $slackdesc = $lineno; -- cgit v1.2.3