diff options
author | B. Watson <yalhcru@gmail.com> | 2017-03-20 16:56:57 -0400 |
---|---|---|
committer | B. Watson <yalhcru@gmail.com> | 2017-03-20 16:56:57 -0400 |
commit | 2f947ddf32f47f570855eeaed6635930b9767870 (patch) | |
tree | 1e7bf24475eb901b0461fefda0218fe208a844e3 | |
parent | 40f986daaaf99b56d0ef06f5fe6d5a03f73108b3 (diff) | |
download | sbostuff-2f947ddf32f47f570855eeaed6635930b9767870.tar.gz |
sbolint: various fixes
-rwxr-xr-x | sbolint | 37 |
1 files changed, 23 insertions, 14 deletions
@@ -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; |