pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint/files - Removed the checklines_mk() s...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/fae225ee3aac
branches:  trunk
changeset: 504182:fae225ee3aac
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Tue Dec 06 16:13:28 2005 +0000

description:
- Removed the checklines_mk() subroutine and copied the code to
  checklines_package_Makefile(). Then, renamed
  checklines_package_Makefile() to checklines_mk(), as it not only
  applies to the main package Makefile.
- Fixed the regular expression for detecting ambiguous variables like
  $f, which could mean either ${f} or $$f.
- When checking for deprecated variables, also mention the ones that
  don't have modifiers.

diffstat:

 pkgtools/pkglint/files/pkglint.pl |  47 +++++++++++---------------------------
 1 files changed, 14 insertions(+), 33 deletions(-)

diffs (118 lines):

diff -r 08d30616f558 -r fae225ee3aac pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Tue Dec 06 16:12:43 2005 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Tue Dec 06 16:13:28 2005 +0000
@@ -11,7 +11,7 @@
 # Freely redistributable.  Absolutely no warranty.
 #
 # From Id: portlint.pl,v 1.64 1998/02/28 02:34:05 itojun Exp
-# $NetBSD: pkglint.pl,v 1.424 2005/12/06 15:47:14 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.425 2005/12/06 16:13:28 rillig Exp $
 #
 # This version contains lots of changes necessary for NetBSD packages
 # done by:
@@ -1542,7 +1542,7 @@
        my ($line, $text) = @_;
        my ($rest);
 
-       if ($text =~ qr"^[^#]*[^\$]\$(\w+)") {
+       if ($text =~ qr"^(?:[^#]*[^\$])?\$(\w+)") {
                my ($varname) = ($1);
                $line->log_warning("\$$varname is ambiguous. Use \${$varname} if you mean a Makefile variable or \$\$$varname if you mean a shell variable.");
        }
@@ -1558,7 +1558,7 @@
        }
 
        $rest = $text;
-       while ($rest =~ s/\$\{([-A-Z0-9a-z_]+)(?::[^\}]+)\}//) {
+       while ($rest =~ s/\$\{([-A-Z0-9a-z_]+)(?::[^\}]+)?\}//) {
                my ($varname) = ($1);
 
                if (exists(get_deprecated_map()->{$varname})) {
@@ -2203,31 +2203,12 @@
        }
 }
 
-sub checklines_mk($) {
-       my ($lines) = @_;
-
-       foreach my $line (@{$lines}) {
-               my $text = $line->text;
-
-               if ($text =~ regex_varassign) {
-                       my ($varname, $op, $value, $comment) = ($1, $2, $3, $4);
-                       checkline_mk_varassign($line, $varname, $op, $value, $comment);
-
-               } elsif ($text =~ regex_shellcmd) {
-                       my ($shellcmd) = ($1);
-                       checkline_mk_shellcmd($line, $shellcmd);
-
-               } else {
-                       # Ignore for now.
-               }
-       }
-
-       autofix($lines);
-}
-
 sub checklines_package_Makefile_varorder($) {
        my ($lines) = @_;
 
+       # Disabled, as I don't like the current ordering scheme.
+       return;
+
 # TODO: Add support for optional sections with non-optional variables.
 
        use constant once       => 0;
@@ -2367,7 +2348,7 @@
 # This subroutine contains "local" checks that can be made looking only
 # at a single line at a time. The other checks are in
 # checkfile_package_Makefile.
-sub checklines_package_Makefile($) {
+sub checklines_mk($) {
        my ($lines) = @_;
        my ($allowed_targets, $for_variables) = ({}, {});
 
@@ -2384,10 +2365,12 @@
                        # Ignore empty lines and comments
 
                } elsif ($text =~ regex_varassign) {
-                       # Is already checked by checklines_mk().
+                       my ($varname, $op, $value, $comment) = ($1, $2, $3, $4);
+                       checkline_mk_varassign($line, $varname, $op, $value, $comment);
 
                } elsif ($text =~ regex_shellcmd) {
-                       # Is already checked by checklines_mk().
+                       my ($shellcmd) = ($1);
+                       checkline_mk_shellcmd($line, $shellcmd);
 
                } elsif ($text =~ regex_mk_include) {
                        my ($includefile) = ($1);
@@ -2475,7 +2458,6 @@
                }
        }
 
-       checklines_mk($lines);
        checklines_trailing_empty_lines($lines);
 }
 
@@ -2681,7 +2663,7 @@
                return;
        }
 
-       checklines_package_Makefile($lines);
+       checklines_mk($lines);
 }
 
 sub checkfile_package_Makefile($$$) {
@@ -2752,9 +2734,8 @@
                $makevar->{"USE_X11"}->log_note("... USE_X11 superfluous.");
        }
 
-       checklines_package_Makefile($lines);
-       # Disabled, as I don't like the current ordering scheme.
-       #checklines_package_Makefile_varorder($lines);
+       checklines_mk($lines);
+       checklines_package_Makefile_varorder($lines);
        autofix($lines);
 }
 



Home | Main Index | Thread Index | Old Index