pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint/files Moved all explaining texts to t...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/54fb4a91e4bb
branches:  trunk
changeset: 548663:54fb4a91e4bb
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Mon Oct 20 11:09:07 2008 +0000

description:
Moved all explaining texts to the beginning of a line, so they stand out
from the rest of the code.

diffstat:

 pkgtools/pkglint/files/pkglint.pl |  399 ++++++++++++++++++-------------------
 1 files changed, 199 insertions(+), 200 deletions(-)

diffs (truncated from 748 to 300 lines):

diff -r afc3a3ee9ad1 -r 54fb4a91e4bb pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Mon Oct 20 10:56:18 2008 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Mon Oct 20 11:09:07 2008 +0000
@@ -1,5 +1,5 @@
 #! @PERL@
-# $NetBSD: pkglint.pl,v 1.778 2008/10/20 10:56:18 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.779 2008/10/20 11:09:07 rillig Exp $
 #
 
 # pkglint - static analyzer and checker for pkgsrc packages
@@ -3385,15 +3385,15 @@
        } else {
                $line->log_warning("Found absolute pathname: ${word}");
                $line->explain_warning(
-                       "Absolute pathnames are often an indicator for unportable code. As",
-                       "pkgsrc aims to be a portable system, absolute pathnames should be",
-                       "avoided whenever possible.",
-                       "",
-                       "A special variable in this context is \${DESTDIR}, which is used in GNU",
-                       "projects to specify a different directory for installation than what",
-                       "the programs see later when they are executed. Usually it is empty, so",
-                       "if anything after that variable starts with a slash, it is considered",
-                       "an absolute pathname.");
+"Absolute pathnames are often an indicator for unportable code. As",
+"pkgsrc aims to be a portable system, absolute pathnames should be",
+"avoided whenever possible.",
+"",
+"A special variable in this context is \${DESTDIR}, which is used in GNU",
+"projects to specify a different directory for installation than what",
+"the programs see later when they are executed. Usually it is empty, so",
+"if anything after that variable starts with a slash, it is considered",
+"an absolute pathname.");
        }
 }
 
@@ -3407,9 +3407,9 @@
        if (length($line->text) > $maxlength) {
                $line->log_warning("Line too long (should be no more than $maxlength characters).");
                $line->explain_warning(
-                       "Back in the old time, terminals with 80x25 characters were common.",
-                       "And this is still the default size of many terminal emulators.",
-                       "Moderately short lines also make reading easier.");
+"Back in the old time, terminals with 80x25 characters were common.",
+"And this is still the default size of many terminal emulators.",
+"Moderately short lines also make reading easier.");
        }
 }
 
@@ -3599,9 +3599,9 @@
        if ($path !~ m"^(?:\./)?\.\./\.\./[^/]+/[^/]+$") {
                $line->log_warning("\"${path}\" is not a valid relative package directory.");
                $line->explain_warning(
-                       "A relative pathname always starts with \"../../\", followed",
-                       "by a category, a slash and a the directory name of the package.",
-                       "For example, \"../../misc/screen\" is a valid relative pathname.");
+"A relative pathname always starts with \"../../\", followed",
+"by a category, a slash and a the directory name of the package.",
+"For example, \"../../misc/screen\" is a valid relative pathname.");
        }
 }
 
@@ -3723,23 +3723,23 @@
                if ($is_load_time && !$is_indirect) {
                        $line->log_warning("${varname} should not be evaluated at load time.");
                        $line->explain_warning(
-                               "Many variables, especially lists of something, get their values",
-                               "incrementally. Therefore it is generally unsafe to rely on their value",
-                               "until it is clear that it will never change again. This point is",
-                               "reached when the whole package Makefile is loaded and execution of the",
-                               "shell commands starts, in some cases earlier.",
-                               "",
-                               "Additionally, when using the \":=\" operator, each \$\$ is replaced",
-                               "with a single \$, so variables that have references to shell variables",
-                               "or regular expressions are modified in a subtle way.");
+"Many variables, especially lists of something, get their values",
+"incrementally. Therefore it is generally unsafe to rely on their value",
+"until it is clear that it will never change again. This point is",
+"reached when the whole package Makefile is loaded and execution of the",
+"shell commands starts, in some cases earlier.",
+"",
+"Additionally, when using the \":=\" operator, each \$\$ is replaced",
+"with a single \$, so variables that have references to shell variables",
+"or regular expressions are modified in a subtle way.");
                }
                if ($is_load_time && $is_indirect) {
                        $line->log_warning("${varname} should not be evaluated indirectly at load time.");
                        $line->explain_warning(
-                               "The variable on the left-hand side may be evaluated at load time, but",
-                               "the variable on the right-hand side may not. Due to this assignment, it",
-                               "might be used indirectly at load-time, when it is not guaranteed to be",
-                               "properly defined.");
+"The variable on the left-hand side may be evaluated at load time, but",
+"the variable on the right-hand side may not. Due to this assignment, it",
+"might be used indirectly at load-time, when it is not guaranteed to be",
+"properly defined.");
                }
 
                if ($perms !~ m"p" && $perms !~ m"u") {
@@ -3794,10 +3794,10 @@
                } else {
                        $line->log_warning("The variable ${varname} should not be used in .for loops.");
                        $line->explain_warning(
-                               "The .for loop splits its argument at sequences of white-space, as",
-                               "opposed to all other places in make(1), which act like the shell.",
-                               "Therefore only variables that are specifically designed to match this",
-                               "requirement should be used here.");
+"The .for loop splits its argument at sequences of white-space, as",
+"opposed to all other places in make(1), which act like the shell.",
+"Therefore only variables that are specifically designed to match this",
+"requirement should be used here.");
                }
        }
 
@@ -3873,8 +3873,8 @@
        if ($text =~ m"\$\{WRKSRC\}/\.\./") {
                $line->log_warning("Using \"\${WRKSRC}/..\" is conceptually wrong. Please use a combination of WRKSRC, CONFIGURE_DIRS and BUILD_DIRS instead.");
                $line->explain_warning(
-                       "You should define WRKSRC such that all of CONFIGURE_DIRS, BUILD_DIRS",
-                       "and INSTALL_DIRS are subdirectories of it.");
+"You should define WRKSRC such that all of CONFIGURE_DIRS, BUILD_DIRS",
+"and INSTALL_DIRS are subdirectories of it.");
        }
 
        if ($text =~ m"\b(-Wl,--rpath,|-Wl,-rpath-link,|-Wl,-rpath,|-Wl,-R)\b") {
@@ -4004,8 +4004,8 @@
                        if ($varname eq "\@") {
                                $line->log_warning("Please use \"\${.TARGET}\" instead of \"\$\@\".");
                                $line->explain_warning(
-                                       "The variable \$\@ can easily be confused with the shell variable of the",
-                                       "same name, which has a completely different meaning.");
+"The variable \$\@ can easily be confused with the shell variable of the",
+"same name, which has a completely different meaning.");
                                $varname = ".TARGET";
                        }
 
@@ -4023,8 +4023,8 @@
                        } elsif ($state == SWST_DQUOT && defined($mod) && $mod =~ m":Q$") {
                                $line->log_warning("Please don't use the :Q operator in double quotes.");
                                $line->explain_warning(
-                                       "Either remove the :Q or the double quotes. In most cases, it is more",
-                                       "appropriate to remove the double quotes.");
+"Either remove the :Q or the double quotes. In most cases, it is more",
+"appropriate to remove the double quotes.");
 
                        }
 
@@ -4100,8 +4100,8 @@
                        } elsif ($rest =~ s/^\$\@//) {
                                $line->log_warning("Please use \"\${.TARGET}\" instead of \"\$@\".");
                                $line->explain_warning(
-                                       "It is more readable and prevents confusion with the shell variable of",
-                                       "the same name.");
+"It is more readable and prevents confusion with the shell variable of",
+"the same name.");
 
                        } elsif ($rest =~ s/^\$\$\@//) {
                                $line->log_warning("The \$@ shell variable should only be used in double quotes.");
@@ -4112,8 +4112,8 @@
                        } elsif ($rest =~ s/^\$\$\(/(/) {
                                $line->log_warning("Invoking subshells via \$(...) is not portable enough.");
                                $line->explain_warning(
-                                       "The Solaris /bin/sh does not know this way to execute a command in a",
-                                       "subshell. Please use backticks (\`...\`) as a replacement.");
+"The Solaris /bin/sh does not know this way to execute a command in a",
+"subshell. Please use backticks (\`...\`) as a replacement.");
 
                        } else {
                                last;
@@ -4145,10 +4145,10 @@
                                my ($char) = ($1);
                                $line->log_warning("Please use \"\\\\${char}\" instead of \"\\${char}\".");
                                $line->explain_warning(
-                                       "Although the current code may work, it is not good style to rely on",
-                                       "the shell passing \"\\${char}\" exactly as is, and not discarding the",
-                                       "backslash. Alternatively you can use single quotes instead of double",
-                                       "quotes.");
+"Although the current code may work, it is not good style to rely on",
+"the shell passing \"\\${char}\" exactly as is, and not discarding the",
+"backslash. Alternatively you can use single quotes instead of double",
+"quotes.");
                        } else {
                                last;
                        }
@@ -4191,20 +4191,20 @@
                } elsif (exists(discouraged_install_commands->{$shellcmd})) {
                        $line->log_warning("The shell command \"${shellcmd}\" should not be used in the install phase.");
                        $line->explain_warning(
-                               "In the install phase, the only thing that should be done is to install",
-                               "the prepared files to their final location. The file's contents should",
-                               "not be changed anymore.");
+"In the install phase, the only thing that should be done is to install",
+"the prepared files to their final location. The file's contents should",
+"not be changed anymore.");
 
                } elsif ($shellcmd eq "\${CP}") {
                        $line->log_warning("\${CP} should not be used to install files.");
                        $line->explain_warning(
-                               "The \${CP} command is highly platform dependent and cannot overwrite",
-                               "files that don't have write permission. Please use \${PAX} instead.",
-                               "",
-                               "For example, instead of",
-                               "\t\${CP} -R \${WRKSRC}/* \${PREFIX}/foodir",
-                               "you should use",
-                               "\tcd \${WRKSRC} && \${PAX} -wr * \${PREFIX}/foodir");
+"The \${CP} command is highly platform dependent and cannot overwrite",
+"files that don't have write permission. Please use \${PAX} instead.",
+"",
+"For example, instead of",
+"\t\${CP} -R \${WRKSRC}/* \${PREFIX}/foodir",
+"you should use",
+"\tcd \${WRKSRC} && \${PAX} -wr * \${PREFIX}/foodir");
 
                } else {
                        $opt_debug_misc and $line->log_debug("May \"${shellcmd}\" be used in the install phase?");
@@ -4245,15 +4245,15 @@
        if ($text =~ m"\$\{SED\}" && $text =~ m"\$\{MV\}") {
                $line->log_note("Please use the SUBST framework instead of \${SED} and \${MV}.");
                $line->explain_note(
-                       "When converting things, pay attention to \"#\" characters. In shell",
-                       "commands make(1) does not interpret them as comment character, but",
-                       "in other lines it does. Therefore, instead of the shell command",
-                       "",
-                       "\tsed -e 's,#define foo,,'",
-                       "",
-                       "you need to write",
-                       "",
-                       "\tSUBST_SED.foo+=\t's,\\#define foo,,'");
+"When converting things, pay attention to \"#\" characters. In shell",
+"commands make(1) does not interpret them as comment character, but",
+"in other lines it does. Therefore, instead of the shell command",
+"",
+"\tsed -e 's,#define foo,,'",
+"",
+"you need to write",
+"",
+"\tSUBST_SED.foo+=\t's,\\#define foo,,'");
        }
 
        if ($text =~ m"^\@*-(.*(MKDIR|INSTALL.*-d|INSTALL_.*_DIR).*)") {
@@ -4292,18 +4292,18 @@
                        if (!exists(hidden_shell_commands->{$cmd})) {
                                $line->log_warning("The shell command \"${cmd}\" should not be hidden.");
                                $line->explain_warning(
-                                       "Hidden shell commands do not appear on the terminal or in the log file",
-                                       "when they are executed. When they fail, the error message cannot be",
-                                       "assigned to the command, which is very difficult to debug.");
+"Hidden shell commands do not appear on the terminal or in the log file",
+"when they are executed. When they fail, the error message cannot be",
+"assigned to the command, which is very difficult to debug.");
                        }
                }
 
                if ($hidden =~ m"-") {
                        $line->log_warning("The use of a leading \"-\" to suppress errors is deprecated.");
                        $line->explain_warning(
-                               "If you really want to ignore any errors from this command (including",
-                               "all errors you never thought of), append \"|| \${TRUE}\" to the",
-                               "command.");
+"If you really want to ignore any errors from this command (including",
+"all errors you never thought of), append \"|| \${TRUE}\" to the",
+"command.");
                }
 
                if ($macro eq "\${RUN}") {
@@ -4402,22 +4402,22 @@
 
                                if ($semicolon || $multiline) {
                                        $line->explain_warning(
-                                               "When you split a shell command into multiple lines that are continued",
-                                               "with a backslash, they will nevertheless be converted to a single line",
-                                               "before the shell sees them. That means that even if it _looks_ like that",
-                                               "the comment only spans one line in the Makefile, in fact it spans until",
-                                               "the end of the whole shell command. To insert a comment into shell code,",
-                                               "you can pass it as an argument to the \${SHCOMMENT} macro, which expands",
-                                               "to a command doing nothing. Note that any special characters are",
-                                               "nevertheless interpreted by the shell.");
+"When you split a shell command into multiple lines that are continued",
+"with a backslash, they will nevertheless be converted to a single line",
+"before the shell sees them. That means that even if it _looks_ like that",
+"the comment only spans one line in the Makefile, in fact it spans until",
+"the end of the whole shell command. To insert a comment into shell code,",
+"you can pass it as an argument to the \${SHCOMMENT} macro, which expands",
+"to a command doing nothing. Note that any special characters are",
+"nevertheless interpreted by the shell.");
                                }
 
                        } else {
                                $opt_warn_extra and $line->log_warning("Unknown shell command \"${shellword}\".");
                                $opt_warn_extra and $line->explain_warning(
-                                       "If you want your package to be portable to all platforms that pkgsrc",
-                                       "supports, you should only use shell commands that are covered by the",
-                                       "tools framework.");
+"If you want your package to be portable to all platforms that pkgsrc",
+"supports, you should only use shell commands that are covered by the",
+"tools framework.");
 
                        }
                }
@@ -4425,9 +4425,9 @@
                if ($state == SCST_COND && $shellword eq "cd") {



Home | Main Index | Thread Index | Old Index