OpenPKG CVS Repository http://cvs.openpkg.org/ ____________________________________________________________________________
Server: cvs.openpkg.org Name: Thomas Lotterer Root: /e/openpkg/cvs Email: [EMAIL PROTECTED] Module: openpkg-re Date: 05-Feb-2004 23:19:01 Branch: HEAD Handle: 2004020522190000 Modified files: openpkg-re speclint.pl Log: remove all numbers immediately following %setup/%patch to ease overriding of these macros and thus make version tracking working; also clean up option order; do not use setup/patch number when only one file exists but enforce patch number on multiple files Summary: Revision Changes Path 1.63 +35 -10 openpkg-re/speclint.pl ____________________________________________________________________________ patch -p0 <<'@@ .' Index: openpkg-re/speclint.pl ============================================================================ $ cvs diff -u -r1.62 -r1.63 speclint.pl --- openpkg-re/speclint.pl 3 Feb 2004 19:27:14 -0000 1.62 +++ openpkg-re/speclint.pl 5 Feb 2004 22:19:00 -0000 1.63 @@ -818,20 +818,45 @@ } } - # check for setup macro usage setup vs. setup0 + # check for setup and patch macro usage if ($section eq '%prep') { + $done = $outer_done; $this = ''; $todo = $outer_this; my @tokens = &shell_tokenize($outer_this); - if (grep(/^\%setup\d+$/, @tokens) == 1 and not grep(/^\%setup$/, @tokens)) { - &lint_warning($file, undef, undef, "section $section: single numbered \"\%setup\" macro" . - " (if single macros, make unnumbered)"); + while ($todo =~ m/([^\n]*)\n/s) { + $done .= $`; $this = $&; $todo = $'; + if ($this =~ m/^ *%setup.* .*$/) { + &lint_warning($file, undef, undef, "section $section: multiple spaces in \"\%setup\" macro" . + " (reduce to single space)"); + } + if ($this =~ m/^ *%setup.*-[ab]$/ and grep(/^\%setup+$/, @tokens) == 1) { + &lint_warning($file, undef, undef, "section $section: -[ab] option superflous for single \"\%setup\" macro" . + " (remove it)"); + } + if ($this =~ m/^ *%patch.* .*$/) { + &lint_warning($file, undef, undef, "section $section: multiple spaces in \"\%patch\" macro" . + " (reduce to single space)"); + } + if ($this =~ m/^ *%patch.*-p +0/) { + &lint_warning($file, undef, undef, "section $section: syntactically wrong space in \"\%patch\" macro" . + " (use -p0)"); + } + if ($this =~ m/^ *%patch.*-P 0/ and grep(/^\%patch+$/, @tokens) == 1) { + &lint_warning($file, undef, undef, "section $section: syntactically wrong space in \"\%patch\" macro" . + " (omit -P for single patch)"); + } + if ($this =~ m/^ *%patch.*-P [^0-9]/ and grep(/^\%patch+$/, @tokens) > 1) { + &lint_warning($file, undef, undef, "section $section: syntactically wrong space in \"\%patch\" macro" . + " (use -P for multiple patches)"); + } + $done .= $this; } - if (grep(/^\%setup$/, @tokens) and grep(/^\%setup\d+$/, @tokens)) { - &lint_warning($file, undef, undef, "section $section: intermixed numbered and unnumbered \"\%setup\" macro" . - " (if multiple macros, make all numbered)"); + if (grep(/^\%setup\d+$/, @tokens)) { + &lint_warning($file, undef, undef, "section $section: numbered \"\%setup\" macro" . + " (do not use %setup directly followed by a number, replace with %setup ... -[ab])"); } - if (grep(/^\%patch$/, @tokens) and grep(/^\%patch\d+$/, @tokens)) { - &lint_warning($file, undef, undef, "section $section: intermixed numbered and unnumbered \"\%patch\" macro" . - " (if multiple macros, make all numbered)"); + if (grep(/^\%patch\d+$/, @tokens)) { + &lint_warning($file, undef, undef, "section $section: numbered \"\%patch\" macro" . + " (do not use %patch directly followed by a number, replace with %patch ... -P)"); } } @@ . ______________________________________________________________________ The OpenPKG Project www.openpkg.org CVS Repository Commit List [EMAIL PROTECTED]