pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint4/files pkgtools/pkglint4: remove more...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/83c59d0217a6
branches:  trunk
changeset: 402261:83c59d0217a6
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Sun Oct 06 11:45:05 2019 +0000

description:
pkgtools/pkglint4: remove more unreliable or outdated checks

CFLAGS and LDFLAGS had been checked for GCC-style flags only. This didn't
make sense since wrong flags would be detected on the exotic platforms
anyway.

The experimental --autofix has been removed.

The check for "# used by" comments in Makefile.common has been removed.
Especially the --autofix could damage files.

The warnings for ICON_THEMES have been removed since they appear in
groups of thousands, and the old pkglint cannot issue warnings "once per
file" simply.

diffstat:

 pkgtools/pkglint4/files/PkgLint/FileUtil.pm |   43 +-----
 pkgtools/pkglint4/files/PkgLint/Line.pm     |    6 +-
 pkgtools/pkglint4/files/makevars.map        |   40 ++--
 pkgtools/pkglint4/files/pkglint.0           |   44 +----
 pkgtools/pkglint4/files/pkglint.1           |   28 +---
 pkgtools/pkglint4/files/pkglint.pl          |  228 +---------------------------
 pkgtools/pkglint4/files/pkglint.t           |   12 +-
 7 files changed, 43 insertions(+), 358 deletions(-)

diffs (truncated from 775 to 300 lines):

diff -r 7f4afe673b0d -r 83c59d0217a6 pkgtools/pkglint4/files/PkgLint/FileUtil.pm
--- a/pkgtools/pkglint4/files/PkgLint/FileUtil.pm       Sun Oct 06 11:36:15 2019 +0000
+++ b/pkgtools/pkglint4/files/PkgLint/FileUtil.pm       Sun Oct 06 11:45:05 2019 +0000
@@ -1,12 +1,10 @@
-# $NetBSD: FileUtil.pm,v 1.1 2015/11/25 16:42:21 rillig Exp $
+# $NetBSD: FileUtil.pm,v 1.2 2019/10/06 11:45:05 rillig Exp $
 #
 # Subroutines for loading and saving line-oriented files.
 # The load_file() subroutine loads a file completely into memory,
 # optionally handling continuation line folding. The load_lines() subrou-
 # tine is an abbreviation for the common case of loading files without
-# continuation lines. The save_autofix_changes() subroutine examines an
-# array of lines if some of them have changed. It then saves the modified
-# files.
+# continuation lines.
 #
 package PkgLint::FileUtil;
 
@@ -19,7 +17,6 @@
        @ISA = qw(Exporter);
        @EXPORT_OK = qw(
                load_file load_lines
-               save_autofix_changes
        );
 
        import PkgLint::Util qw(
@@ -128,39 +125,3 @@
 
        return load_lines($fname, false);
 }
-
-sub save_autofix_changes($) {
-       my ($lines) = @_;
-
-       my (%changed, %physlines);
-
-       foreach my $line (@{$lines}) {
-               if ($line->is_changed) {
-                       $changed{$line->fname}++;
-               }
-               push(@{$physlines{$line->fname}}, @{$line->physlines});
-       }
-
-       foreach my $fname (sort(keys(%changed))) {
-               my $new = "${fname}.pkglint.tmp";
-               my $f;
-
-               if (!open($f, ">", $new)) {
-                       log_error($new, NO_LINE_NUMBER, "$!");
-                       next;
-               }
-               foreach my $physline (@{$physlines{$fname}}) {
-                       print $f ($physline->[1]);
-               }
-               if (!close($f)) {
-                       log_error($new, NO_LINE_NUMBER, "$!");
-                       next;
-               }
-
-               if (!rename($new, $fname)) {
-                       log_error($fname, NO_LINE_NUMBER, "$!");
-                       next;
-               }
-               log_note($fname, NO_LINE_NUMBER, "Has been autofixed. Please re-run pkglint.");
-       }
-}
diff -r 7f4afe673b0d -r 83c59d0217a6 pkgtools/pkglint4/files/PkgLint/Line.pm
--- a/pkgtools/pkglint4/files/PkgLint/Line.pm   Sun Oct 06 11:36:15 2019 +0000
+++ b/pkgtools/pkglint4/files/PkgLint/Line.pm   Sun Oct 06 11:45:05 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Line.pm,v 1.1 2015/11/25 16:42:21 rillig Exp $
+# $NetBSD: Line.pm,v 1.2 2019/10/06 11:45:05 rillig Exp $
 #
 # When files are read in by pkglint, they are interpreted in terms of
 # lines. For Makefiles, line continuations are handled properly, allowing
@@ -13,10 +13,6 @@
 # C<lines>, C<text>, C<physlines> and C<is_changed>, as well as some
 # methods for printing diagnostics easily.
 #
-# Some other methods allow modification of the physical lines, but leave
-# the logical line (the C<text>) untouched. These methods are used in the
-# --autofix mode.
-#
 # A line can have some "extra" fields that allow the results of parsing to
 # be saved under a name.
 #
diff -r 7f4afe673b0d -r 83c59d0217a6 pkgtools/pkglint4/files/makevars.map
--- a/pkgtools/pkglint4/files/makevars.map      Sun Oct 06 11:36:15 2019 +0000
+++ b/pkgtools/pkglint4/files/makevars.map      Sun Oct 06 11:45:05 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: makevars.map,v 1.12 2019/10/06 11:06:42 rillig Exp $
+# $NetBSD: makevars.map,v 1.13 2019/10/06 11:45:05 rillig Exp $
 #
 
 # This file contains the guessed type of some variables, according to
@@ -145,7 +145,7 @@
 BDBBASE                        Pathname [$system]
 BDB_ACCEPTED           List of { db1 db2 db3 db4 db5 } [$package]
 BDB_DEFAULT            { db1 db2 db3 db4 db5 } []
-BDB_LIBS               List of LdFlag [$system]
+BDB_LIBS               List of ShellWord [$system]
 BDB_TYPE               { db1 db2 db3 db4 db5 } [$system]
 BINGRP                 UserGroupName [$system]
 BINMODE                        FileMode [$system]
@@ -161,10 +161,10 @@
 BUILDLINK_API_DEPENDS.*        InternalList of Dependency [*:a]
 BUILDLINK_CONTENTS_FILTER      List of ShellWord []
 # ^^ ShellCommand
-BUILDLINK_CFLAGS       List of CFlag [$system]
-BUILDLINK_CFLAGS.*     List of CFlag [$bl_list]
-BUILDLINK_CPPFLAGS     List of CFlag [$system]
-BUILDLINK_CPPFLAGS.*   List of CFlag [$bl_list]
+BUILDLINK_CFLAGS       List of ShellWord [$system]
+BUILDLINK_CFLAGS.*     List of ShellWord [$bl_list]
+BUILDLINK_CPPFLAGS     List of ShellWord [$system]
+BUILDLINK_CPPFLAGS.*   List of ShellWord [$bl_list]
 BUILDLINK_CONTENTS_FILTER.*    ShellCommand [b:s]
 BUILDLINK_DEPENDS      InternalList of Identifier [b:a]
 BUILDLINK_DEPMETHOD.*  List of BuildlinkDepmethod [b:ad,m:as,c:a,*.mk:a]
@@ -176,11 +176,11 @@
 # ^^ ShellCommand
 BUILDLINK_INCDIRS.*    List of Pathname [b:ad]                 # b:d?
 BUILDLINK_JAVA_PREFIX.*        Pathname [b:s]
-BUILDLINK_LDADD.*      List of LdFlag [builtin.mk:adsu, b:, m:u, c:u, *.mk:u]
-BUILDLINK_LDFLAGS      List of LdFlag [$system]
-BUILDLINK_LDFLAGS.*    List of LdFlag [$bl_list]
+BUILDLINK_LDADD.*      List of ShellWord [builtin.mk:adsu, b:, m:u, c:u, *.mk:u]
+BUILDLINK_LDFLAGS      List of ShellWord [$system]
+BUILDLINK_LDFLAGS.*    List of ShellWord [$bl_list]
 BUILDLINK_LIBDIRS.*    List of Pathname [$bl_list]
-BUILDLINK_LIBS.*       List of LdFlag [b:a]
+BUILDLINK_LIBS.*       List of ShellWord [b:a]
 BUILDLINK_PACKAGES     BuildlinkPackages [b:aps]
 BUILDLINK_PASSTHRU_DIRS        List of Pathname [m:a,c:a,b:a,h:a]
 BUILDLINK_PASSTHRU_RPATHDIRS   List of Pathname [m:a,c:a,b:a,h:a]
@@ -212,7 +212,7 @@
 CATEGORIES             List of Category [m:as,c:ads]
 CC_VERSION             Message [$system]
 CC                     ShellCommand [$system]
-CFLAGS*                        List of CFlag [$package_list]
+CFLAGS*                        List of ShellWord [$package_list]
 # ^^ may also be changed by the user
 CHECK_BUILTIN          YesNo [builtin.mk:d,m:s]
 CHECK_BUILTIN.*                YesNo [*:p]
@@ -254,10 +254,10 @@
 COPY                   { -c } [$system]
 # ^^ the flag that tells ${INSTALL} to copy a file
 CPP                    ShellCommand [$system]
-CPPFLAGS*              List of CFlag [$package_list]
+CPPFLAGS*              List of ShellWord [$package_list]
 CRYPTO                 Yes [m:s]
 CXX                    ShellCommand [$system]
-CXXFLAGS*              List of CFlag [$package_list]
+CXXFLAGS*              List of ShellWord [$package_list]
 DEINSTALL_FILE         Pathname [m:s]
 DEINSTALL_SRC          List of Pathname [m:s,c:ds]
 DEINSTALL_TEMPLATES    List of Pathname [m:as,c:ads]
@@ -287,7 +287,7 @@
 DJB_SLASHPACKAGE       YesNo
 DLOPEN_REQUIRE_PTHREADS        YesNo
 DL_AUTO_VARS           Yes [m:s,c:s,o:s]
-DL_LIBS                        List of LdFlag
+DL_LIBS                        List of ShellWord
 DOCOWN                 UserGroupName [$system]
 DOCGRP                 UserGroupName [$system]
 DOCMODE                        FileMode [$system]
@@ -334,7 +334,7 @@
 ERROR_MSG              ShellCommand [$system]
 EVAL_PREFIX            InternalList of ShellWord [m:a,c:a]
 # ^^ FIXME: Looks like a type mismatch.
-EXPORT_SYMBOLS_LDFLAGS List of LdFlag [$system]
+EXPORT_SYMBOLS_LDFLAGS List of ShellWord [$system]
 EXTRACT_CMD            ShellCommand [$system]
 EXTRACT_DIR            Pathname [$package]
 EXTRACT_ELEMENTS       List of Pathmask [$package_list]
@@ -429,12 +429,12 @@
 KRB5_DEFAULT           { heimdal mit-krb5 } [$user]
 KRB5_TYPE              Unchecked [$system]
 LD                     ShellCommand [$system]
-LDFLAGS*               List of LdFlag [$package_list]
+LDFLAGS*               List of ShellWord [$package_list]
 LIBGRP                 UserGroupName [$system]
 LIBMODE                        FileMode [$system]
 LIBOWN                 UserGroupName [$system]
 LIBOSSAUDIO            Pathname [$system]
-LIBS*                  List of LdFlag [$package_list]
+LIBS*                  List of ShellWord [$package_list]
 LIBTOOL                        ShellCommand [$system]
 LIBTOOL_OVERRIDE       List of Pathmask [m:as]
 LIBTOOL_REQD           List of Version [$package_list]
@@ -649,9 +649,9 @@
 PRINT_PLIST_AWK                AwkCommand [*:a]
 PRIVILEGED_STAGES      List of { install package clean }
 PTHREAD_AUTO_VARS      YesNo [m:s]
-PTHREAD_CFLAGS         List of CFlag [$system]
-PTHREAD_LDFLAGS                List of LdFlag [$system]
-PTHREAD_LIBS           List of LdFlag [$system]
+PTHREAD_CFLAGS         List of ShellWord [$system]
+PTHREAD_LDFLAGS                List of ShellWord [$system]
+PTHREAD_LIBS           List of ShellWord [$system]
 PTHREAD_OPTS           List of { native optional require } [m:as,c:a,b:a]
 PTHREAD_TYPE           Identifier [$system]
 # ^^ or "native" or "none".
diff -r 7f4afe673b0d -r 83c59d0217a6 pkgtools/pkglint4/files/pkglint.0
--- a/pkgtools/pkglint4/files/pkglint.0 Sun Oct 06 11:36:15 2019 +0000
+++ b/pkgtools/pkglint4/files/pkglint.0 Sun Oct 06 11:45:05 2019 +0000
@@ -1,4 +1,4 @@
-PKGLINT(1)                  General Commands Manual                 PKGLINT(1)
+PKGLINT(1)              NetBSD General Commands Manual              PKGLINT(1)
 
 NNAAMMEE
      ppkkgglliinntt -- static analyzer for pkgsrc packages
@@ -10,7 +10,6 @@
      ppkkgglliinntt attempts to detect features of the named pkgsrc packages that are
      likely to be bugs, or that are simply deprecated.
 
-
    OOppttiioonnss
      --CC{{[[nnoo--]]cchheecckk,,......}}  Enable or disable specific checks.  For a list of
                          checks, see below.
@@ -18,8 +17,6 @@
      --DD{{[[nnoo--]]ddeebbuugg,,......}}  Enable or disable debugging categories.  For a list
                          of categories, see below.
 
-     --FF|----aauuttooffiixx        Repair trivial things automatically.
-
      --II                  Show the _M_a_k_e_f_i_l_e that is constructed by including
                          all the files that are slurped in via `.include'
                          directives.  This flag is mainly for debugging.
@@ -32,9 +29,9 @@
      --WW{{[[nnoo--]]wwaarrnn,,......}}   Enable or disable specific warnings.  For a list of
                          warnings, see below.
 
-     --ee|----eexxppllaaiinn        Print further explanations for diagnostics.
-                         Sometimes the reasons for diagnostics are not obvious
-                         and need further explanation.
+     --ee|----eexxppllaaiinn        Print further explanations for diagnostics.  Some-
+                         times the reasons for diagnostics are not obvious and
+                         need further explanation.
 
      --gg|----ggcccc--oouuttppuutt--ffoorrmmaatt
                          Use a format for the diagnostics that is understood
@@ -125,8 +122,6 @@
 
      nnoonnee                Disable all warnings.
 
-     [[nnoo--]]aabbssnnaammee        Warn if a file contains an absolute pathname.
-
      [[nnoo--]]ddiirreeccttccmmdd      Warn if a system command name is used instead of a
                          variable (e.g. sed instead of ${SED}).
 
@@ -136,28 +131,11 @@
      [[nnoo--]]oorrddeerr          Warn if Makefile variables are not in the preferred
                          order.
 
-     [[nnoo--]]ppeerrmm           Warn if a variable is used or defined outside its
-                         specified scope.  The available permissions are:
-                         append
-                              append something using +=
-                         default
-                              set a default value using ?=
-                         preprocess
-                              use a variable during preprocessing
-                         runtime
-                              use a variable at runtime
-                         set  set a variable using :=, =, !=
-                         unknown
-                              permissions for this variable currently not
-                              known
-                         A `?' means that it is not yet clear which
-                         permissions are allowed and which aren't.
-
      [[nnoo--]]pplliisstt--ddeepprr     Warn if deprecated pathnames are used in _P_L_I_S_T files.
                          This warning is disabled by default.
 
-     [[nnoo--]]pplliisstt--ssoorrtt     Warn if items of a PLIST file are not sorted
-                         alphabetically.  This warning is disabled by default.
+     [[nnoo--]]pplliisstt--ssoorrtt     Warn if items of a PLIST file are not sorted alpha-
+                         betically.  This warning is disabled by default.
 
      [[nnoo--]]qquuoottiinngg        Warn for possibly invalid quoting of make variables
                          in shell programs and shell variables themselves.
@@ -174,11 +152,11 @@
                          ordered in the way it is described the pkgsrc guide.
 
    OOtthheerr aarrgguummeennttss
-           _d_i_r _._._.             The pkgsrc directories to be checked.  If
-                               omitted, the current directory is checked.
+           _d_i_r _._._.             The pkgsrc directories to be checked.  If omit-
+                               ted, the current directory is checked.
 
 FFIILLEESS
-     _p_k_g_s_r_c_/_m_k_/_*  Files from the pkgsrc infrastructure.
+     pkgsrc/mk/*  Files from the pkgsrc infrastructure.
 
 EEXXAAMMPPLLEESS
      ppkkgglliinntt --CCnnoonnee,,ppaattcchheess ..
@@ -202,7 +180,7 @@
                    critical as errors.
 



Home | Main Index | Thread Index | Old Index