pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint4 pkgtools/pkglint4: update to 4.193.0...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/280b120a3f4a
branches:  trunk
changeset: 340675:280b120a3f4a
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Sun Oct 06 10:33:34 2019 +0000

description:
pkgtools/pkglint4: update to 4.193.0, remove check for absolute paths

The check for absolute paths is not necessary since it doesn't provide
any benefit. It had been removed from pkgtools/pkglint already.

diffstat:

 pkgtools/pkglint4/Makefile                            |    9 +-
 pkgtools/pkglint4/README                              |   27 -
 pkgtools/pkglint4/TODO                                |   37 -
 pkgtools/pkglint4/files/PkgLint/Patches.pm            |  168 +-----
 pkgtools/pkglint4/files/PkgLint/Shell.pm              |    6 +-
 pkgtools/pkglint4/files/doc/Makefile                  |   27 -
 pkgtools/pkglint4/files/doc/chap.code.xml             |  307 ----------
 pkgtools/pkglint4/files/doc/chap.defs.xml             |   26 -
 pkgtools/pkglint4/files/doc/chap.design.xml           |  117 ---
 pkgtools/pkglint4/files/doc/chap.future.xml           |   91 ---
 pkgtools/pkglint4/files/doc/chap.intro.xml            |   15 -
 pkgtools/pkglint4/files/doc/chap.statemachines.xml    |   77 --
 pkgtools/pkglint4/files/doc/chap.types.xml            |  545 ------------------
 pkgtools/pkglint4/files/doc/pkglint.xml               |   38 -
 pkgtools/pkglint4/files/doc/statemachine.patch.dia    |  Bin 
 pkgtools/pkglint4/files/doc/statemachine.shellcmd.dia |  Bin 
 pkgtools/pkglint4/files/doc/stylesheet.xsl            |    6 -
 pkgtools/pkglint4/files/pkglint.pl                    |   59 +-
 pkgtools/pkglint4/files/pkglint.t                     |   36 +-
 19 files changed, 26 insertions(+), 1565 deletions(-)

diffs (truncated from 1809 to 300 lines):

diff -r 9df7e6a07df2 -r 280b120a3f4a pkgtools/pkglint4/Makefile
--- a/pkgtools/pkglint4/Makefile        Sun Oct 06 10:00:00 2019 +0000
+++ b/pkgtools/pkglint4/Makefile        Sun Oct 06 10:33:34 2019 +0000
@@ -1,7 +1,6 @@
-# $NetBSD: Makefile,v 1.12 2019/08/11 13:22:36 wiz Exp $
+# $NetBSD: Makefile,v 1.13 2019/10/06 10:33:34 rillig Exp $
 
-PKGNAME=       pkglint4-4.164
-PKGREVISION=   2
+PKGNAME=       pkglint4-4.193.0
 CATEGORIES=    pkgtools
 
 OWNER=         rillig%NetBSD.org@localhost
@@ -36,7 +35,7 @@
 .else
 SUBST_VARS.pkglint=    PKGSRCDIR
 .endif
-SUBST_VARS.pkglint=    PREFIX
+SUBST_VARS.pkglint+=   PREFIX
 SUBST_SED.pkglint+=    -e s\|@DISTVER@\|${PKGNAME:S/pkglint-//}\|g
 SUBST_VARS.pkglint+=   MAKE
 SUBST_SED.pkglint+=    -e s\|@PERL@\|${PERL5:Q}\|g
@@ -57,7 +56,7 @@
                && mv pkglint.pl.inlined pkglint.pl
 
 do-test:
-       cd ${WRKSRC} && prove pkglint.t
+       cd ${WRKSRC} && prove -v -I. pkglint.t
 
 do-install:
        ${INSTALL_SCRIPT} ${WRKSRC}/pkglint.pl ${DESTDIR}${PREFIX}/bin/pkglint
diff -r 9df7e6a07df2 -r 280b120a3f4a pkgtools/pkglint4/README
--- a/pkgtools/pkglint4/README  Sun Oct 06 10:00:00 2019 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-$NetBSD: README,v 1.1 2015/11/25 16:42:21 rillig Exp $
-
-== Current problems ==
-
-There are finally some automated tests that document a few intended
-and actual behaviors. There is still plenty of poorly expressed
-code not yet under test and therefore not yet safe to refactor.
-
-The current pkglint architecture will not scale much further. What is
-needed next are parsers for nested, non-context-free languages (make(1),
-sh(1), sed(1)). The parsers should be able to recognize partial
-structures, as well as structures containing foreign parts. This is
-because most of pkgsrc is heavily based on preprocessors:
-
-- The .if and .for directives in Makefiles are preprocessed by make(1)
-  before building dependencies and shell commands out of the remaining
-  text.
-
-- make(1) assembles shell commands from literal text and variables like
-  ${PKGNAME}.
-
-- Shell commands often use dynamic evaluation of variables.
-
-All this makes enhancing pkglint non-trivial. If you know of any
-academic papers that might be of help in this case, please tell me.
-
-The pkglint source code is much too big for a single file.
diff -r 9df7e6a07df2 -r 280b120a3f4a pkgtools/pkglint4/TODO
--- a/pkgtools/pkglint4/TODO    Sun Oct 06 10:00:00 2019 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-$NetBSD: TODO,v 1.1 2015/11/25 16:42:21 rillig Exp $
-
-Please add your own entries at the bottom of this file. If possible,
-include the name of an example package where a warning should occur.
-
-* When you understand some behavior of the code, document it by
-  adding automated tests to pkglint.t!
-* warn about the use of ${WRKDIR:=...}, as this construct should only
-  be used with lists.
-* Add checks for binary packages. See Debian/lintian for ideas.
-* Of the user-defined variables, some may be used at load-time and some
-  don't. Find out how pkglint can distinguish them.
-* Make sure that no variable is modified at load-time after it has been
-  used once. This should at least flag BUILD_DEFS in bsd.pkg.mk.
-* Invent an annotation scheme for files that intentionally define
-  variables for use in other files.
-* ${MACHINE_ARCH}-${LOWER_OPSYS}elf in PLISTs etc. is a NetBSD config.guess
-  problem ==> use of ${APPEND_ELF}
-* Packages including lang/python/extension.mk must follow the Python version
-  scheme. Enforcing PYPKGPREFIX for those is most likely a good idea.
-* Check for parallel files/dirs whose names differ only in case.
-* Check for license files that are completely unused.
-* If a dependency depends on an option (in options.mk), it should also
-  depend on the same option in the buildlink3.mk file.
-* Complain about ${PKGSRC_COMPILER} == "sunpro", which should be
-  !empty(PKGSRC_COMPILER:Msunpro).
-* If USE_TOOLS has autoconf213, and the package does stuff like
-  cd ${WRKSRC} && autoconf, then an incorrect warning is issued.
-* LOCALBASE should not be used in normal Makefiles
-* don't complain about "procedure calls", like for pkg-build-options in
-  the various buildlink3.mk files.
-* if package A conflicts with B, then B should also conflict with A.
-* When pkglint runs on a case-insensitive filesystem, it should still
-  point out problems that only occur on case-sensitive filesystems. For
-  example, devel/p5-Net-LDAP and devel/p5-Net-ldap should be considered
-  different paths.
-* Warn about using REPLACE_PYTHON without including application.mk.
diff -r 9df7e6a07df2 -r 280b120a3f4a pkgtools/pkglint4/files/PkgLint/Patches.pm
--- a/pkgtools/pkglint4/files/PkgLint/Patches.pm        Sun Oct 06 10:00:00 2019 +0000
+++ b/pkgtools/pkglint4/files/PkgLint/Patches.pm        Sun Oct 06 10:33:34 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Patches.pm,v 1.1 2015/11/25 16:42:21 rillig Exp $
+# $NetBSD: Patches.pm,v 1.2 2019/10/06 10:33:34 rillig Exp $
 #
 # Everything concerning checks for patch files.
 #
@@ -6,55 +6,6 @@
 use strict;
 use warnings;
 
-# Guess the type of file based on the filename. This is used to select
-# the proper subroutine for detecting absolute pathnames.
-#
-# Returns one of "source", "shell", "make", "text", "configure",
-# "ignore", "unknown".
-#
-sub get_filetype($$) {
-       my ($line, $fname) = @_;
-       my $basename = basename($fname);
-
-       # The trailig .in part is not needed, since it does not
-       # influence the type of contents.
-       $basename =~ s,\.in$,,;
-
-       # Let's assume that everything else that looks like a Makefile
-       # is indeed a Makefile.
-       if ($basename =~ m"^I?[Mm]akefile(?:\..*|)?|.*\.ma?k$") {
-               return "make";
-       }
-
-       # Too many false positives for shell scripts, so configure
-       # scripts get their own category.
-       if ($basename =~ m"^configure(?:|\.ac)$") {
-               $opt_debug_unchecked and $line->log_debug("Skipped check for absolute pathnames.");
-               return "configure";
-       }
-
-       if ($basename =~ m"\.(?:sh|m4)$"i) {
-               return "shell";
-       }
-
-       if ($basename =~ m"\.(?:cc?|cpp|cxx|el|hh?|hpp|l|pl|pm|py|s|t|y)$"i) {
-               return "source";
-       }
-
-       if ($basename =~ m"^.+\.(?:\d+|conf|html|info|man|po|tex|texi|texinfo|txt|xml)$"i) {
-               return "text";
-       }
-
-       # Filenames without extension are hard to guess right. :(
-       if ($basename !~ m"\.") {
-               return "unknown";
-       }
-
-       $opt_debug_misc and $line->log_debug("Don't know the file type of ${fname}.");
-
-       return "unknown";
-}
-
 sub checkline_cpp_macro_names($$) {
        my ($line, $text) = @_;
        my ($rest);
@@ -120,85 +71,11 @@
        }
 }
 
-# Checks whether the line contains text that looks like absolute
-# pathnames, assuming that the file uses the common syntax with
-# single or double quotes to represent strings.
-#
-sub checkline_source_absolute_pathname($$) {
-       my ($line, $text) = @_;
-       my ($abspath);
-
-       $opt_debug_trace and $line->log_debug("checkline_source_absolute_pathname(${text})");
-
-       if ($text =~ m"(.*)([\"'])(/[^\"']*)\2") {
-               my ($before, $delim, $string) = ($1, $2, $3);
-
-               $opt_debug_misc and $line->log_debug("checkline_source_absolute_pathname(before=${before}, string=${string})");
-               if ($before =~ m"[A-Z_]+\s*$") {
-                       # allowed: PREFIX "/bin/foo"
-
-               } elsif ($string =~ m"^/[*/]") {
-                       # This is more likely to be a C or C++ comment.
-
-               } elsif ($string !~ m"^/\w") {
-                       # Assume that pathnames start with a letter or digit.
-
-               } elsif ($before =~ m"\+\s*$") {
-                       # Something like foodir + '/lib'
-
-               } else {
-                       $abspath = $string;
-               }
-       }
-
-       if (defined($abspath)) {
-               checkword_absolute_pathname($line, $abspath);
-       }
-}
-
-# Last resort if the file does not look like a Makefile or typical
-# source code. All strings that look like pathnames and start with
-# one of the typical Unix prefixes are found.
-#
-sub checkline_other_absolute_pathname($$) {
-       my ($line, $text) = @_;
-
-       $opt_debug_trace and $line->log_debug("checkline_other_absolute_pathname(\"${text}\")");
-
-       if ($text =~ m"^#[^!]") {
-               # Don't warn for absolute pathnames in comments,
-               # except for shell interpreters.
-
-       } elsif ($text =~ m"^(.*?)((?:/[\w.]+)*/(?:bin|dev|etc|home|lib|mnt|opt|proc|sbin|tmp|usr|var)\b[\w./\-]*)(.*)$") {
-               my ($before, $path, $after) = ($1, $2, $3);
-
-               if ($before =~ m"\@$") {
-                       # Something like @PREFIX@/bin
-
-               } elsif ($before =~ m"[)}]$") {
-                       # Something like ${prefix}/bin or $(PREFIX)/bin
-
-               } elsif ($before =~ m"\+\s*[\"']$") {
-                       # Something like foodir + '/lib'
-
-               } elsif ($before =~ m"\w$") {
-                       # Something like $dir/lib
-
-               } elsif ($before =~ m"\.$") {
-                       # ../foo is not an absolute pathname.
-
-               } else {
-                       $opt_debug_misc and $line->log_debug("before=${before}");
-                       checkword_absolute_pathname($line, $path);
-               }
-       }
-}
-
 sub checkfile_patch($) {
        my ($fname) = @_;
        my ($lines);
        my ($state, $redostate, $nextstate, $dellines, $addlines, $hunks);
-       my ($seen_comment, $current_fname, $current_ftype, $patched_files);
+       my ($seen_comment, $current_fname, $patched_files);
        my ($leading_context_lines, $trailing_context_lines, $context_scanning_leading);
 
        # Abbreviations used:
@@ -271,42 +148,6 @@
                return unless $m->has(1);
                $text = $m->text(1);
                checkline_cpp_macro_names($line, $text);
-
-               # XXX: This check is not as accurate as the similar one in
-               # checkline_mk_shelltext().
-               if (defined($current_fname)) {
-                       if ($current_ftype eq "shell" || $current_ftype eq "make") {
-                               my ($mm, $rest) = match_all($text, $regex_shellword);
-
-                               foreach my $m (@{$mm}) {
-                                       my $shellword = $m->text(1);
-
-                                       if ($shellword =~ m"^#") {
-                                               last;
-                                       }
-                                       checkline_mk_absolute_pathname($line, $shellword);
-                               }
-
-                       } elsif ($current_ftype eq "source") {
-                               checkline_source_absolute_pathname($line, $text);
-
-                       } elsif ($current_ftype eq "configure") {
-                               if ($text =~ m": Avoid regenerating within pkgsrc$") {
-                                       $line->log_error("This code must not be included in patches.");
-                                       $line->explain_error(
-"It is generated automatically by pkgsrc after the patch phase.",
-"",
-"For more details, look for \"configure-scripts-override\" in",
-"mk/configure/gnu-configure.mk.");
-                               }
-
-                       } elsif ($current_ftype eq "ignore") {
-                               # Ignore it.
-
-                       } else {
-                               checkline_other_absolute_pathname($line, $text);
-                       }
-               }
        };
 
        my $check_hunk_end = sub($$$) {
@@ -431,8 +272,6 @@
                PST_CFA() =>



Home | Main Index | Thread Index | Old Index