pkgsrc-Changes archive

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

CVS commit: pkgsrc/pkgtools/pkglint4/files



Module Name:    pkgsrc
Committed By:   rillig
Date:           Sun Oct  6 11:45:05 UTC 2019

Modified Files:
        pkgsrc/pkgtools/pkglint4/files: makevars.map pkglint.0 pkglint.1
            pkglint.pl pkglint.t
        pkgsrc/pkgtools/pkglint4/files/PkgLint: FileUtil.pm Line.pm

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 pkgsrc/pkgtools/pkglint4/files/makevars.map
cvs rdiff -u -r1.1 -r1.2 pkgsrc/pkgtools/pkglint4/files/pkglint.0 \
    pkgsrc/pkgtools/pkglint4/files/pkglint.1
cvs rdiff -u -r1.9 -r1.10 pkgsrc/pkgtools/pkglint4/files/pkglint.pl
cvs rdiff -u -r1.3 -r1.4 pkgsrc/pkgtools/pkglint4/files/pkglint.t
cvs rdiff -u -r1.1 -r1.2 pkgsrc/pkgtools/pkglint4/files/PkgLint/FileUtil.pm \
    pkgsrc/pkgtools/pkglint4/files/PkgLint/Line.pm

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/pkgtools/pkglint4/files/makevars.map
diff -u pkgsrc/pkgtools/pkglint4/files/makevars.map:1.12 pkgsrc/pkgtools/pkglint4/files/makevars.map:1.13
--- pkgsrc/pkgtools/pkglint4/files/makevars.map:1.12    Sun Oct  6 11:06:42 2019
+++ pkgsrc/pkgtools/pkglint4/files/makevars.map Sun Oct  6 11:45:05 2019
@@ -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 @@ BDB185_DEFAULT              Unchecked []
 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_ABI_DEPENDS.*   InternalList of 
 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 @@ BUILDLINK_FILES_CMD.*     List of ShellWord 
 # ^^ 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 @@ BUILTIN_X11_VERSION Unchecked [$system]
 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 @@ CONF_FILES_PERMS  List of ShellWord [$pac
 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_RESTRICTED              YesNo [m:s]
 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_CAT           ShellCommand [$system]
 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_ACCEPTED             List of { heimdal mit-krb
 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 @@ PREV_PKGPATH                Pathname [*:u]  # doesn't e
 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".

Index: pkgsrc/pkgtools/pkglint4/files/pkglint.0
diff -u pkgsrc/pkgtools/pkglint4/files/pkglint.0:1.1 pkgsrc/pkgtools/pkglint4/files/pkglint.0:1.2
--- pkgsrc/pkgtools/pkglint4/files/pkglint.0:1.1        Wed Nov 25 16:42:21 2015
+++ pkgsrc/pkgtools/pkglint4/files/pkglint.0    Sun Oct  6 11:45:05 2019
@@ -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 @@ DDEESSCCRRIIPPTTIIOONN
      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 @@ DDEESSCCRRIIPPTTIIOONN
      --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 @@ DDEESSCCRRIIPPTTIIOONN
      --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 @@ DDEESSCCRRIIPPTTIIOONN
 
      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 @@ DDEESSCCRRIIPPTTIIOONN
      [[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 @@ DDEESSCCRRIIPPTTIIOONN
                          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 @@ DDIIAAGGNNOOSSTTIICCSS
                    critical as errors.
 
 AAUUTTHHOORRSS
-     Roland Illig <rillig%NetBSD.org@localhost>
+     Roland Illig <_r_i_l_l_i_g_@_N_e_t_B_S_D_._o_r_g>
 
 BBUUGGSS
      Many more checks could be added.
@@ -210,4 +188,4 @@ BBUUGGSS
      If you don't understand the messages, feel free to ask on the
      <tech-pkg%NetBSD.org@localhost> mailing list.
 
-NetBSD 6.99.8                    July 14, 2012                   NetBSD 6.99.8
+NetBSD 8.0                      October 6, 2019                     NetBSD 8.0
Index: pkgsrc/pkgtools/pkglint4/files/pkglint.1
diff -u pkgsrc/pkgtools/pkglint4/files/pkglint.1:1.1 pkgsrc/pkgtools/pkglint4/files/pkglint.1:1.2
--- pkgsrc/pkgtools/pkglint4/files/pkglint.1:1.1        Wed Nov 25 16:42:21 2015
+++ pkgsrc/pkgtools/pkglint4/files/pkglint.1    Sun Oct  6 11:45:05 2019
@@ -1,4 +1,4 @@
-.\"    $NetBSD: pkglint.1,v 1.1 2015/11/25 16:42:21 rillig Exp $
+.\"    $NetBSD: pkglint.1,v 1.2 2019/10/06 11:45:05 rillig Exp $
 .\"    From FreeBSD: portlint.1,v 1.8 1997/11/25 14:53:14 itojun Exp
 .\"
 .\" Copyright (c) 1997 by Jun-ichiro Itoh <itojun%itojun.org@localhost>.
@@ -7,7 +7,7 @@
 .\" Roland Illig <roland.illig%gmx.de@localhost>, 2004, 2005.
 .\" Thomas Klausner <wiz%NetBSD.org@localhost>, 2012.
 .\"
-.Dd July 14, 2012
+.Dd October 6, 2019
 .Dt PKGLINT 1
 .Os
 .Sh NAME
@@ -31,8 +31,6 @@ For a list of checks, see below.
 .It Fl D{[no-]debug,...}
 Enable or disable debugging categories.
 For a list of categories, see below.
-.It Fl F Ns | Ns Fl -autofix
-Repair trivial things automatically.
 .It Fl I
 Show the
 .Pa Makefile
@@ -145,8 +143,6 @@ Information about the contexts in which 
 Enable all warnings.
 .It Cm none
 Disable all warnings.
-.It Cm [no-]absname
-Warn if a file contains an absolute pathname.
 .It Cm [no-]directcmd
 Warn if a system command name is used instead of a variable (e.g. sed
 instead of ${SED}).
@@ -155,26 +151,6 @@ Emit some additional warnings that are n
 for whatever reason.
 .It Cm [no-]order
 Warn if Makefile variables are not in the preferred order.
-.It Cm [no-]perm
-Warn if a variable is used or defined outside its specified scope.
-The available permissions are:
-.Bl -tag -width 3n -compact
-.It append
-append something using +=
-.It default
-set a default value using ?=
-.It preprocess
-use a variable during preprocessing
-.It runtime
-use a variable at runtime
-.It set
-set a variable using :=, =, !=
-.It unknown
-permissions for this variable currently not known
-.El
-A
-.Sq \&?
-means that it is not yet clear which permissions are allowed and which aren't.
 .It Cm [no-]plist-depr
 Warn if deprecated pathnames are used in
 .Pa PLIST

Index: pkgsrc/pkgtools/pkglint4/files/pkglint.pl
diff -u pkgsrc/pkgtools/pkglint4/files/pkglint.pl:1.9 pkgsrc/pkgtools/pkglint4/files/pkglint.pl:1.10
--- pkgsrc/pkgtools/pkglint4/files/pkglint.pl:1.9       Sun Oct  6 11:06:42 2019
+++ pkgsrc/pkgtools/pkglint4/files/pkglint.pl   Sun Oct  6 11:45:05 2019
@@ -1,5 +1,5 @@
 #! @PERL@
-# $NetBSD: pkglint.pl,v 1.9 2019/10/06 11:06:42 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.10 2019/10/06 11:45:05 rillig Exp $
 #
 
 # pkglint - static analyzer and checker for pkgsrc packages
@@ -98,7 +98,6 @@ BEGIN {
        );
        import PkgLint::FileUtil qw(
                load_file load_lines
-               save_autofix_changes
        );
        import PkgLint::Type qw(
                LK_NONE LK_INTERNAL LK_EXTERNAL
@@ -190,34 +189,27 @@ my (%debug) = (
        "varuse"        => [\$opt_debug_varuse, "contexts where variables are used"],
 );
 
-my $opt_warn_absname   = true;
 my $opt_warn_directcmd = true;
 our $opt_warn_extra    = false;        # used by PkgLint::SubstContext
 my $opt_warn_order     = true;
-my $opt_warn_perm      = false;
 my $opt_warn_plist_depr        = false;
 my $opt_warn_plist_sort        = false;
 my $opt_warn_quoting   = false;
 my $opt_warn_space     = false;
 my $opt_warn_style     = false;
 my $opt_warn_types     = true;
-my $opt_warn_varorder  = false;
 my (%warnings) = (
-       "absname"       => [\$opt_warn_absname, "warn about use of absolute file names"],
        "directcmd"     => [\$opt_warn_directcmd, "warn about use of direct command names instead of Make variables"],
        "extra"         => [\$opt_warn_extra, "enable some extra warnings"],
        "order"         => [\$opt_warn_order, "warn if Makefile entries are unordered"],
-       "perm"          => [\$opt_warn_perm, "warn about unforeseen variable definition and use"],
        "plist-depr"    => [\$opt_warn_plist_depr, "warn about deprecated paths in PLISTs"],
        "plist-sort"    => [\$opt_warn_plist_sort, "warn about unsorted entries in PLISTs"],
        "quoting"       => [\$opt_warn_quoting, "warn about quoting issues"],
        "space"         => [\$opt_warn_space, "warn about inconsistent use of white-space"],
        "style"         => [\$opt_warn_style, "warn about stylistic issues"],
        "types"         => [\$opt_warn_types, "do some simple type checking in Makefiles"],
-       "varorder"      => [\$opt_warn_varorder, "warn about the ordering of variables"],
 );
 
-my $opt_autofix                = false;
 my $opt_dumpmakefile   = false;
 my $opt_import         = false;
 my $opt_quiet          = false;
@@ -237,8 +229,6 @@ my (@options) = (
                my ($opt, $val) = @_;
                parse_multioption($val, \%debug);
          } ],
-       [ "-F|--autofix", "Try to automatically fix some errors (experimental)",
-         "autofix|F", \$opt_autofix ],
        [ "-I|--dumpmakefile", "Dump the Makefile after parsing",
          "dumpmakefile|I", \$opt_dumpmakefile ],
        [ "-R|--rcsidstring", "Set the allowed RCS Id strings",
@@ -500,93 +490,6 @@ sub parse_command_line() {
 }
 
 #
-# Caching subroutines.
-#
-
-# The get_regex_plurals() function returns a regular expression that
-# matches for all make(1) variable names that are considered lists
-# of something.
-#
-# Rationale:
-#
-# The pkglint author thinks that variables containing lists of things
-# should have a name indicating some plural form. Sadly, there are other
-# reasons like backwards compatibility and other developer's
-# expectations that make changes to most of the following variables
-# highly unlikely.
-sub get_regex_plurals() {
-       state $result = undef;
-       return $result if defined($result);
-
-       my @plurals_ok = qw(
-               .*S
-               .*LIST
-               .*_AWK
-               .*_ENV
-               .*_REQD
-               .*_SED
-               .*_SKIP
-               BUILDLINK_LDADD
-               COMMENT
-               EXTRACT_ONLY
-               FETCH_MESSAGE
-               GENERATE_PLIST
-               PLIST_CAT
-               PLIST_PRE
-               PREPEND_PATH
-       );
-       my @plurals_missing_an_s = qw(
-               .*_OVERRIDE
-               .*_PREREQ
-               .*_SRC
-               .*_SUBST
-               .*_TARGET
-               .*_TMPL
-               BROKEN_EXCEPT_ON_PLATFORM
-               BROKEN_ON_PLATFORM
-               BUILDLINK_DEPMETHOD
-               BUILDLINK_TRANSFORM
-               EVAL_PREFIX
-               INTERACTIVE_STAGE
-               LICENSE
-               MASTER_SITE_.*
-               MASTER_SORT_REGEX
-               NOT_FOR_COMPILER
-               NOT_FOR_PLATFORM
-               ONLY_FOR_COMPILER
-               ONLY_FOR_PLATFORM
-               PERL5_PACKLIST
-               PKG_FAIL_REASON
-               PKG_SKIP_REASON
-       );
-       my @plurals_reluctantly_accepted = qw(
-               CRYPTO
-               DEINSTALL_TEMPLATE
-               FIX_RPATH
-               INSTALL_TEMPLATE
-               PYTHON_VERSIONS_INCOMPATIBLE
-               REPLACE_INTERPRETER
-               REPLACE_PERL
-               REPLACE_RUBY
-               RESTRICTED
-               SITES_.*
-               TOOLS_ALIASES\.*
-               TOOLS_BROKEN
-               TOOLS_CREATE
-               TOOLS_GNU_MISSING
-               TOOLS_NOOP
-       );
-       my $plurals = join("|",
-               @plurals_ok,
-               @plurals_missing_an_s,
-               @plurals_reluctantly_accepted
-       );
-
-       $result = qr"^(?:${plurals})$";
-       return $result;
-}
-
-#
 # Loading pkglint-specific data from files.
 #
 
@@ -730,25 +633,6 @@ sub get_vartypes_map() {
                }
        }
 
-# TODO: Enable when the time is ripe.
-if (false) {
-       # Additionally, scan mk/defaults/mk.conf for variable
-       # definitions. All these variables are reserved for the user and
-       # must not be set within packages.
-       $fname = "${cwd_pkgsrcdir}/mk/defaults/mk.conf";
-       if ((my $lines = load_file($fname))) {
-               foreach my $line (@{$lines}) {
-                       if ($line->text =~ m"^#?([\w_]+)\?=") {
-                               my ($varname) = ($1);
-                               $opt_debug_misc and $line->log_debug("Found user-definable variable ${varname}.");
-                               $vartypes->{$varname} = "Userdefined"; # FIXME: type error
-                       }
-               }
-       } else {
-               log_fatal($fname, NO_LINE_NUMBER, "Cannot be read.");
-       }
-}
-
        return ($result = $vartypes);
 }
 
@@ -1237,14 +1121,6 @@ sub match_all($$) {
        return ($mm, substr($rest, $lastpos));
 }
 
-sub autofix($) {
-       my ($lines) = @_;
-
-       if ($opt_autofix) {
-               save_autofix_changes($lines);
-       }
-}
-
 # Checks whether a file is already committed to the CVS repository or not.
 sub is_committed($) {
        my ($fname) = @_;
@@ -2105,34 +1981,6 @@ sub readmakefile($$$$) {
                                        $opt_debug_include and $line->log_debug("Including \"$dirname/$includefile\".");
                                        my $last_lineno = $#{$all_lines};
                                        readmakefile("$dirname/$includefile", $main_lines, $all_lines, $seen_Makefile_include) or return false;
-
-                                       # Check that there is a comment in each
-                                       # Makefile.common that says which files
-                                       # include it.
-                                       if ($includefile =~ m"/Makefile\.common$") {
-                                               my @mc_lines = @{$all_lines}[$last_lineno+1 .. $#{$all_lines}];
-                                               my $expected = "# used by " . relative_path($cwd_pkgsrcdir, $fname);
-
-                                               if (!(grep { $_->text eq $expected } @mc_lines)) {
-                                                       my $lineno = 0;
-                                                       while ($lineno < $#mc_lines && $mc_lines[$lineno]->has("is_comment")) {
-                                                               $lineno++;
-                                                       }
-                                                       my $iline = $mc_lines[$lineno];
-                                                       $iline->log_warning("Please add a line \"$expected\" here.");
-                                                       $iline->explain_warning(
-"Since Makefile.common files usually don't have any comments and",
-"therefore not a clearly defined interface, they should at least contain",
-"references to all files that include them, so that it is easier to see",
-"what effects future changes may have.",
-"",
-"If there are more than five packages that use a Makefile.common,",
-"you should think about giving it a proper name (maybe plugin.mk) and",
-"documenting its interface.");
-                                                       $iline->append_before($expected);
-                                                       autofix(\@mc_lines);
-                                               }
-                                       }
                                }
                        }
 
@@ -2711,42 +2559,6 @@ sub checkline_mk_vartype_basic($$$$$$$$)
                        }
                },
 
-               CFlag => sub {
-                       if ($value =~ m"^-D([0-9A-Z_a-z]+)=(.*)") {
-                               my ($macname, $macval) = ($1, $2);
-
-                               # No checks needed, since the macro definitions
-                               # are usually directory names, which don't need
-                               # any quoting.
-
-                       } elsif ($value =~ m"^-[DU]([0-9A-Z_a-z]+)") {
-                               my ($macname) = ($1);
-
-                               $opt_debug_unchecked and $line->log_debug("Unchecked macro ${macname} in ${varname}.");
-
-                       } elsif ($value =~ m"^-I(.*)") {
-                               my ($dirname) = ($1);
-
-                               $opt_debug_unchecked and $line->log_debug("Unchecked directory ${dirname} in ${varname}.");
-
-                       } elsif ($value eq "-c99") {
-                               # Only works on IRIX, but is usually enclosed with
-                               # the proper preprocessor conditional.
-
-                       } elsif ($value =~ m"^-[OWfgm]|^-std=.*") {
-                               $opt_debug_unchecked and $line->log_debug("Unchecked compiler flag ${value} in ${varname}.");
-
-                       } elsif ($value =~ m"^-.*") {
-                               $line->log_warning("Unknown compiler flag \"${value}\".");
-
-                       } elsif ($value =~ regex_unresolved) {
-                               $opt_debug_unchecked and $line->log_debug("Unchecked CFLAG: ${value}");
-
-                       } else {
-                               $line->log_warning("Compiler flag \"${value}\" does not start with a dash.");
-                       }
-               },
-
                Comment => sub {
                        if ($value eq "SHORT_DESCRIPTION_OF_THE_PACKAGE") {
                                $line->log_error("COMMENT must be set.");
@@ -2935,35 +2747,6 @@ sub checkline_mk_vartype_basic($$$$$$$$)
                        }
                },
 
-               LdFlag => sub {
-                       if ($value =~ m"^-L(.*)") {
-                               my ($dirname) = ($1);
-
-                               $opt_debug_unchecked and $line->log_debug("Unchecked directory ${dirname} in ${varname}.");
-
-                       } elsif ($value =~ m"^-l(.*)") {
-                               my ($libname) = ($1);
-
-                               $opt_debug_unchecked and $line->log_debug("Unchecked library name ${libname} in ${varname}.");
-
-                       } elsif ($value =~ m"^(?:-static)$") {
-                               # Assume that the wrapper framework catches these.
-
-                       } elsif ($value =~ m"^(-Wl,(?:-R|-rpath|--rpath))") {
-                               my ($rpath_flag) = ($1);
-                               $line->log_warning("Please use \${COMPILER_RPATH_FLAG} instead of ${rpath_flag}.");
-
-                       } elsif ($value =~ m"^-.*") {
-                               $line->log_warning("Unknown linker flag \"${value}\".");
-
-                       } elsif ($value =~ regex_unresolved) {
-                               $opt_debug_unchecked and $line->log_debug("Unchecked LDFLAG: ${value}");
-
-                       } else {
-                               $line->log_warning("Linker flag \"${value}\" does not start with a dash.");
-                       }
-               },
-
                License => sub {
 
                        use constant deprecated_licenses => array_to_hash(qw(
@@ -4343,7 +4126,6 @@ sub checkfile_DESCR($) {
 "fit on one screen. It is also intended to give a _brief_ summary",
 "about the package's contents.");
        }
-       autofix($lines);
 }
 
 sub checkfile_distinfo($) {
@@ -4536,7 +4318,6 @@ sub checkfile_mk($) {
 
        parselines_mk($lines);
        checklines_mk($lines);
-       autofix($lines);
 }
 
 sub checkfile_package_Makefile($$) {
@@ -4673,7 +4454,6 @@ sub checkfile_package_Makefile($$) {
        }
 
        checklines_mk($lines);
-       autofix($lines);
 }
 
 #include PkgLint/Patches.pm
@@ -4925,9 +4705,6 @@ sub checkfile_PLIST($) {
                                }
 
                        } elsif ($text =~ m"^share/icons/[^/]+/.+$") {
-                               if (defined($pkgctx_vardef) && !exists($pkgctx_vardef->{"ICON_THEMES"})) {
-                                       $line->log_warning("Packages that install icon theme files should set ICON_THEMES.");
-                               }
 
                        } elsif ($pkgpath ne "graphics/hicolor-icon-theme" && $text =~ m"^share/icons/hicolor(?:$|/)") {
                                my $f = "../../graphics/hicolor-icon-theme/buildlink3.mk";
@@ -5005,7 +4782,6 @@ sub checkfile_PLIST($) {
                }
        }
        checklines_trailing_empty_lines($lines);
-       autofix($lines);
 }
 
 sub checkfile($) {
@@ -5359,8 +5135,6 @@ sub checkdir_category() {
 
        checklines_mk($lines);
 
-       autofix($lines);
-
        if ($opt_recursive) {
                unshift(@todo_items, @subdirs);
        }

Index: pkgsrc/pkgtools/pkglint4/files/pkglint.t
diff -u pkgsrc/pkgtools/pkglint4/files/pkglint.t:1.3 pkgsrc/pkgtools/pkglint4/files/pkglint.t:1.4
--- pkgsrc/pkgtools/pkglint4/files/pkglint.t:1.3        Sun Oct  6 10:33:34 2019
+++ pkgsrc/pkgtools/pkglint4/files/pkglint.t    Sun Oct  6 11:45:05 2019
@@ -1,5 +1,5 @@
 #! @PERL@
-# $NetBSD: pkglint.t,v 1.3 2019/10/06 10:33:34 rillig Exp $
+# $NetBSD: pkglint.t,v 1.4 2019/10/06 11:45:05 rillig Exp $
 #
 
 require 'pkglint.pl';                  # so we can test its internals
@@ -28,10 +28,10 @@ sub test_unit {
        if (defined $exitcode) {
                is($trap->exit, $exitcode, qq{exits $exitcode});
        } else {
-               is($trap->exit, undef, q{doesn't exit});
+               is($trap->exit, undef, q{doesn't exit}); #'
        }
-       like($trap->stdout, qr/$stdout_re/sm, qq{stdout matches $stdout_re});
-       like($trap->stderr, qr/$stderr_re/sm, qq{stderr matches $stderr_re});
+       like($trap->stdout, qr/$stdout_re/sm, sprintf(qq{stdout '%s' matches '%s'}, $trap->stdout, $stdout_re));
+       like($trap->stderr, qr/$stderr_re/sm, sprintf(qq{stderr '%s' matches '%s'}, $trap->stderr, $stderr_re));
 
        return @results;
 }
@@ -73,11 +73,11 @@ sub test_get_vartypes_basictypes {
        my @all_vartypes_basictypes = qw(
                AwkCommand BrokenIn
                BuildlinkDepmethod BuildlinkDepth BuildlinkPackages
-               CFlag Category Comment
+               Category Comment
                Dependency DependencyWithPath
                DistSuffix EmulPlatform
                FetchURL FileMode Filemask Filename
-               Identifier Integer LdFlag License Mail_Address Message Option
+               Identifier Integer License Mail_Address Message Option
                Pathlist Pathmask Pathname
                Perl5Packlist
                PkgName PkgOptionsVar PkgPath PkgRevision

Index: pkgsrc/pkgtools/pkglint4/files/PkgLint/FileUtil.pm
diff -u pkgsrc/pkgtools/pkglint4/files/PkgLint/FileUtil.pm:1.1 pkgsrc/pkgtools/pkglint4/files/PkgLint/FileUtil.pm:1.2
--- pkgsrc/pkgtools/pkglint4/files/PkgLint/FileUtil.pm:1.1      Wed Nov 25 16:42:21 2015
+++ pkgsrc/pkgtools/pkglint4/files/PkgLint/FileUtil.pm  Sun Oct  6 11:45:05 2019
@@ -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 @@ BEGIN {
        @ISA = qw(Exporter);
        @EXPORT_OK = qw(
                load_file load_lines
-               save_autofix_changes
        );
 
        import PkgLint::Util qw(
@@ -128,39 +125,3 @@ sub load_file($) {
 
        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.");
-       }
-}
Index: pkgsrc/pkgtools/pkglint4/files/PkgLint/Line.pm
diff -u pkgsrc/pkgtools/pkglint4/files/PkgLint/Line.pm:1.1 pkgsrc/pkgtools/pkglint4/files/PkgLint/Line.pm:1.2
--- pkgsrc/pkgtools/pkglint4/files/PkgLint/Line.pm:1.1  Wed Nov 25 16:42:21 2015
+++ pkgsrc/pkgtools/pkglint4/files/PkgLint/Line.pm      Sun Oct  6 11:45:05 2019
@@ -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.
 #



Home | Main Index | Thread Index | Old Index