Mon Jan 26 15:44:15 2009 UTC ()
Added but disabled a check that tests whether the PKGNAME and the
package directory match. There is much work to do until this can be
enabled.


(rillig)
diff -r1.797 -r1.798 pkgsrc/pkgtools/pkglint/files/pkglint.pl

cvs diff -r1.797 -r1.798 pkgsrc/pkgtools/pkglint/files/Attic/pkglint.pl (expand / switch to unified diff)

--- pkgsrc/pkgtools/pkglint/files/Attic/pkglint.pl 2008/12/21 10:34:59 1.797
+++ pkgsrc/pkgtools/pkglint/files/Attic/pkglint.pl 2009/01/26 15:44:15 1.798
@@ -1,15 +1,15 @@ @@ -1,15 +1,15 @@
1#! @PERL@ 1#! @PERL@
2# $NetBSD: pkglint.pl,v 1.797 2008/12/21 10:34:59 rillig Exp $ 2# $NetBSD: pkglint.pl,v 1.798 2009/01/26 15:44:15 rillig Exp $
3# 3#
4 4
5# pkglint - static analyzer and checker for pkgsrc packages 5# pkglint - static analyzer and checker for pkgsrc packages
6# 6#
7# Written by: 7# Written by:
8# Roland Illig <rillig@NetBSD.org> 8# Roland Illig <rillig@NetBSD.org>
9# 9#
10# Based on work by: 10# Based on work by:
11# Hubert Feyrer <hubertf@NetBSD.org> 11# Hubert Feyrer <hubertf@NetBSD.org>
12# Thorsten Frueauf <frueauf@NetBSD.org> 12# Thorsten Frueauf <frueauf@NetBSD.org>
13# Thomas Klausner <wiz@NetBSD.org> 13# Thomas Klausner <wiz@NetBSD.org>
14# and others. 14# and others.
15# 15#
@@ -6876,26 +6876,30 @@ sub checkfile_package_Makefile($$) { @@ -6876,26 +6876,30 @@ sub checkfile_package_Makefile($$) {
6876 $pkgname_line->log_note("PKGNAME is \${DISTNAME} by default. You probably don't need to define PKGNAME."); 6876 $pkgname_line->log_note("PKGNAME is \${DISTNAME} by default. You probably don't need to define PKGNAME.");
6877 } 6877 }
6878 6878
6879 if (!defined($pkgname) && defined($distname) && $distname !~ regex_unresolved && $distname !~ regex_pkgname) { 6879 if (!defined($pkgname) && defined($distname) && $distname !~ regex_unresolved && $distname !~ regex_pkgname) {
6880 $distname_line->log_warning("As DISTNAME is not a valid package name, please define the PKGNAME explicitly."); 6880 $distname_line->log_warning("As DISTNAME is not a valid package name, please define the PKGNAME explicitly.");
6881 } 6881 }
6882 6882
6883 ($effective_pkgname, $effective_pkgname_line, $effective_pkgbase, $effective_pkgversion) 6883 ($effective_pkgname, $effective_pkgname_line, $effective_pkgbase, $effective_pkgversion)
6884 = (defined($pkgname) && $pkgname !~ regex_unresolved && $pkgname =~ regex_pkgname) ? ($pkgname.$nbpart, $pkgname_line, $1, $2) 6884 = (defined($pkgname) && $pkgname !~ regex_unresolved && $pkgname =~ regex_pkgname) ? ($pkgname.$nbpart, $pkgname_line, $1, $2)
6885 : (defined($distname) && $distname !~ regex_unresolved && $distname =~ regex_pkgname) ? ($distname.$nbpart, $distname_line, $1, $2) 6885 : (defined($distname) && $distname !~ regex_unresolved && $distname =~ regex_pkgname) ? ($distname.$nbpart, $distname_line, $1, $2)
6886 : (undef, undef, undef, undef); 6886 : (undef, undef, undef, undef);
6887 if (defined($effective_pkgname_line)) { 6887 if (defined($effective_pkgname_line)) {
6888 $opt_debug_misc and $effective_pkgname_line->log_debug("Effective name=${effective_pkgname} base=${effective_pkgbase} version=${effective_pkgversion}."); 6888 $opt_debug_misc and $effective_pkgname_line->log_debug("Effective name=${effective_pkgname} base=${effective_pkgbase} version=${effective_pkgversion}.");
 6889 # XXX: too many false positives
 6890 if (false && $pkgpath =~ m"/([^/]+)$" && $effective_pkgbase ne $1) {
 6891 $effective_pkgname_line->log_warning("Mismatch between PKGNAME ($effective_pkgname) and package directory ($1).");
 6892 }
6889 } 6893 }
6890 6894
6891 checkpackage_possible_downgrade(); 6895 checkpackage_possible_downgrade();
6892 6896
6893 if (!exists($pkgctx_vardef->{"COMMENT"})) { 6897 if (!exists($pkgctx_vardef->{"COMMENT"})) {
6894 log_warning($fname, NO_LINE_NUMBER, "No COMMENT given."); 6898 log_warning($fname, NO_LINE_NUMBER, "No COMMENT given.");
6895 } 6899 }
6896 6900
6897 if (exists($pkgctx_vardef->{"USE_IMAKE"}) && exists($pkgctx_vardef->{"USE_X11"})) { 6901 if (exists($pkgctx_vardef->{"USE_IMAKE"}) && exists($pkgctx_vardef->{"USE_X11"})) {
6898 $pkgctx_vardef->{"USE_IMAKE"}->log_note("USE_IMAKE makes ..."); 6902 $pkgctx_vardef->{"USE_IMAKE"}->log_note("USE_IMAKE makes ...");
6899 $pkgctx_vardef->{"USE_X11"}->log_note("... USE_X11 superfluous."); 6903 $pkgctx_vardef->{"USE_X11"}->log_note("... USE_X11 superfluous.");
6900 } 6904 }
6901 6905
@@ -7079,26 +7083,27 @@ sub checkfile_patch($) { @@ -7079,26 +7083,27 @@ sub checkfile_patch($) {
7079 }; 7083 };
7080 7084
7081 my $check_hunk_line = sub($$$$) { 7085 my $check_hunk_line = sub($$$$) {
7082 my ($deldelta, $adddelta, $newstate, $check_added) = @_; 7086 my ($deldelta, $adddelta, $newstate, $check_added) = @_;
7083 7087
7084 $check_contents->(); 7088 $check_contents->();
7085 $check_hunk_end->($deldelta, $adddelta, $newstate); 7089 $check_hunk_end->($deldelta, $adddelta, $newstate);
7086 if ($check_added) { 7090 if ($check_added) {
7087 $check_added_contents->(); 7091 $check_added_contents->();
7088 } 7092 }
7089 }; 7093 };
7090 7094
7091 my $transitions = 7095 my $transitions =
 7096 # [ from state, regex, to state, action ]
7092 [ [PST_START, re_patch_rcsid, PST_CENTER, sub() { 7097 [ [PST_START, re_patch_rcsid, PST_CENTER, sub() {
7093 checkline_rcsid($line, ""); 7098 checkline_rcsid($line, "");
7094 }], [PST_START, undef, PST_CENTER, sub() { 7099 }], [PST_START, undef, PST_CENTER, sub() {
7095 checkline_rcsid($line, ""); 7100 checkline_rcsid($line, "");
7096 }], [PST_CENTER, re_patch_empty, PST_TEXT, sub() { 7101 }], [PST_CENTER, re_patch_empty, PST_TEXT, sub() {
7097 # 7102 #
7098 }], [PST_TEXT, re_patch_cfd, PST_CFA, sub() { 7103 }], [PST_TEXT, re_patch_cfd, PST_CFA, sub() {
7099 if (!$seen_comment) { 7104 if (!$seen_comment) {
7100 $opt_warn_style and $line->log_warning("Comment expected."); 7105 $opt_warn_style and $line->log_warning("Comment expected.");
7101 } 7106 }
7102 $line->log_warning("Please use unified diffs (diff -u) for patches."); 7107 $line->log_warning("Please use unified diffs (diff -u) for patches.");
7103 }], [PST_TEXT, re_patch_ufd, PST_UFA, sub() { 7108 }], [PST_TEXT, re_patch_ufd, PST_UFA, sub() {
7104 if (!$seen_comment) { 7109 if (!$seen_comment) {