OpenPKG CVS Repository http://cvs.openpkg.org/ ____________________________________________________________________________
Server: cvs.openpkg.org Name: Ralf S. Engelschall Root: /e/openpkg/cvs Email: [EMAIL PROTECTED] Module: openpkg-re Date: 22-Jul-2003 21:44:53 Branch: HEAD Handle: 2003072220445200 Modified files: openpkg-re speclint.pl Log: add one more check: make sure all used macros exists Summary: Revision Changes Path 1.46 +19 -1 openpkg-re/speclint.pl ____________________________________________________________________________ patch -p0 <<'@@ .' Index: openpkg-re/speclint.pl ============================================================================ $ cvs diff -u -r1.45 -r1.46 speclint.pl --- openpkg-re/speclint.pl 22 Jul 2003 15:52:42 -0000 1.45 +++ openpkg-re/speclint.pl 22 Jul 2003 19:44:52 -0000 1.46 @@ -866,7 +866,6 @@ # check for "shtool install" with multiple -e on same line my $done = ''; my $this = ''; my $todo = $spec; - #hile ($todo =~ m/%{l_shtool} install[^\n]+\\\n([^\n]*-e[^\n]*-e[^\n]*\\\n)+/s) { while ($todo =~ m/%{l_shtool} install[^\n]+\\\n([^\n]*?-e[^\n]*?-e[^\n]*\\\n)+/s) { $done .= $`; $this = $&; $todo = $'; &lint_warning($file, $done, $this, "found multiple -e options of \"shtool install\" on same line (expected separate lines)"); @@ -899,6 +898,25 @@ if ($spec !~ m/\n\%No(Source|Patch)/s and $spec =~ m/\n\s*\%integrity/s) { &lint_error($file, undef, undef, "found no \"\%NoSource/\%NoPatch\", but \"\%integrity\" usage". " (expected to see \"\%NoSource/\%NoPatch\" in source section)"); + } + + # check for valid RPM macro usage + if ($file !~ m|^(.+/)?openpkg\.spec$|s) { + my $ok = `$rpm --eval '\%dump' 2>&1 | egrep "^-*[0-9][0-9]*: l_" | sed -e 's;^[^:]*: *\\(l_[a-zA-Z0-9_]*\\).*;\\1;' | sort -u`; + my @ok = split(/\n/, $ok); + my $todo = $spec; + $todo =~ s|^([a-zA-Z][a-zA-Z0-9]+):\s+(.+)$|push(@ok, lc($1)), ''|mge; + $todo =~ s/^\%(?:define|option)\s+(\S+)\s+.+$/push(@ok, $1), ''/mge; + my $done = ''; my $this = ''; my $todo = $spec; + while ($todo =~ m|\%\{([a-zA-Z][a-zA-Z0-9_]+)|s) { + $done .= $`; $this = $&; $todo = $'; + my $name = $1; + next if ($name =~ m/^(SOURCE|PATCH)\d*$/ or $name eq 'expand'); + if (not grep(/^\Q$name\E$/, @ok)) { + &lint_error($file, $done, $this, "unknown macro \"\%{$name}\""); + } + $done .= $this; + } } } @@ . ______________________________________________________________________ The OpenPKG Project www.openpkg.org CVS Repository Commit List [EMAIL PROTECTED]