pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint/files In addition to ${SED} and ${TR}...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/d8f7b464fdeb
branches:  trunk
changeset: 516612:d8f7b464fdeb
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Mon Jul 24 09:25:57 2006 +0000

description:
In addition to ${SED} and ${TR}, sed and tr should not be used in the
install phase.

Stricter checks for manual pages in PLIST files.

diffstat:

 pkgtools/pkglint/files/pkglint.pl |  43 +++++++++++++++++++++++++++++++-------
 1 files changed, 35 insertions(+), 8 deletions(-)

diffs (89 lines):

diff -r 9640bdb845b3 -r d8f7b464fdeb pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Mon Jul 24 08:42:44 2006 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Mon Jul 24 09:25:57 2006 +0000
@@ -1,5 +1,5 @@
 #! @PERL@
-# $NetBSD: pkglint.pl,v 1.661 2006/07/22 06:47:40 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.662 2006/07/24 09:25:57 rillig Exp $
 #
 
 # pkglint - static analyzer and checker for pkgsrc packages
@@ -4002,8 +4002,8 @@
                ${PAX}
        ));
        use constant discouraged_install_commands => array_to_hash(qw(
-               ${SED}
-               ${TR}
+               sed ${SED}
+               tr ${TR}
        ));
 
        if (defined($mkctx_target) && $mkctx_target =~ qr"^(?:pre|do|post)-install") {
@@ -4189,6 +4189,8 @@
                                                "capable implementation of that tool will be selected.");
                                }
 
+                               checkline_mk_shellcmd_use($line, $shellword);
+
                        } elsif ($shellword =~ qr"^\$\{([\w_]+)\}$" && defined($type = get_variable_type($line, $1)) && $type->basic_type eq "ShellCommand") {
                                checkline_mk_shellcmd_use($line, $shellword);
 
@@ -4889,6 +4891,13 @@
                                "Examples: NetBSD-*-i386, *-*-*, Linux-*-*.");
                }
 
+       } elsif ($type eq "PrefixPathname") {
+               if ($value =~ qr"^man/(.*)") {
+                       my ($mansubdir) = ($1);
+
+                       $line->log_warning("Please use \"\${PKGMANDIR}/${mansubdir}\" instead of \"${value}\".");
+               }
+
        } elsif ($type eq "RelativePkgDir") {
                checkline_relative_pkgdir($line, $value);
 
@@ -6887,14 +6896,26 @@
                                        }
                                }
 
-                       } elsif ($text =~ qr"^man/cat(\d)/(.*)\.\d$") {
-                               my ($cat, $manpage) = ($1, $2);
-                               if (!exists($all_files->{"man/man${cat}/${manpage}.${cat}"})) {
+                       } elsif ($text =~ qr"^man/(cat|man)(\w+)/(.*?)\.(\w+)(\.gz)?$") {
+                               my ($cat_or_man, $section, $manpage, $ext, $gz) = ($1, $2, $3, $4, $5);
+
+                               if ($section !~ qr"^[\dln]$") {
+                                       $line->log_warning("Unknown section \"${section}\" for manual page.");
+                               }
+
+                               if ($cat_or_man eq "cat" && !exists($all_files->{"man/man${section}/${manpage}.${section}"})) {
                                        $line->log_warning("Preformatted manual page without unformatted one.");
                                }
 
-                       } elsif ($text =~ qr"^man/man(\d)/([^/]+)\.\1(\.gz)?$") {
-                               my ($cat, $manpage, $gz) = ($1, $2, $3);
+                               if ($cat_or_man eq "cat") {
+                                       if ($ext ne "0") {
+                                               $line->log_warning("Preformatted manual pages should end in \".0\".");
+                                       }
+                               } else {
+                                       if ($section ne $ext) {
+                                               $line->log_warning("Mismatch between the section (${section}) and extension (${ext}) of the manual page.");
+                                       }
+                               }
 
                                if (defined($gz)) {
                                        $line->log_note("The .gz extension is unnecessary for manual pages.");
@@ -6905,6 +6926,12 @@
                                                "or not.");
                                }
 
+                       } elsif ($text =~ qr"^man/cat") {
+                               $line->log_warning("Invalid filename \"${text}\" for preformatted manual page.");
+
+                       } elsif ($text =~ qr"^man/man") {
+                               $line->log_warning("Invalid filename \"${text}\" for unformatted manual page.");
+
                        } elsif ($text =~ qr"^sbin/(.*)") {
                                my ($binname) = ($1);
 



Home | Main Index | Thread Index | Old Index