pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint/files The LOCALBASE variable should n...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/a2c11e5fd7d6
branches:  trunk
changeset: 539461:a2c11e5fd7d6
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Thu Mar 06 08:51:36 2008 +0000

description:
The LOCALBASE variable should not be used in packages, it should just be
defined in mk.conf. Suggested by jlam, who also provided the excellent
explanation (see "pkglint -e" for it).

diffstat:

 pkgtools/pkglint/files/pkglint.pl |  33 ++++++++++++++++++++++++++++++++-
 1 files changed, 32 insertions(+), 1 deletions(-)

diffs (48 lines):

diff -r 6de25cc72c3c -r a2c11e5fd7d6 pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Thu Mar 06 08:38:12 2008 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Thu Mar 06 08:51:36 2008 +0000
@@ -1,5 +1,5 @@
 #! @PERL@
-# $NetBSD: pkglint.pl,v 1.767 2008/03/06 08:37:26 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.768 2008/03/06 08:51:36 rillig Exp $
 #
 
 # pkglint - static analyzer and checker for pkgsrc packages
@@ -4121,6 +4121,37 @@
                }
        }
 
+       if ($varname eq "LOCALBASE" && !$is_internal) {
+               $line->log_warning("The LOCALBASE variable should not be used by packages.");
+               $line->explain_warning(
+# from jlam via private mail.
+"Currently, LOCALBASE is typically used in these cases:",
+"",
+"(1) To locate a file or directory from another package.",
+"(2) To refer to own files after installation.",
+"",
+"In the first case, the example is:",
+"",
+"      STRLIST=        \${LOCALBASE}/bin/strlist",
+"      do-build:",
+"              cd \${WRKSRC} && \${STRLIST} *.str",
+"",
+"This should really be:",
+"",
+"      EVAL_PREFIX=    STRLIST_PREFIX=strlist",
+"      STRLIST=        \${STRLIST_PREFIX}/bin/strlist",
+"      do-build:",
+"              cd \${WRKSRC} && \${STRLIST} *.str",
+"",
+"In the second case, the example is:",
+"",
+"      CONFIGURE_ENV+= --with-datafiles=\${LOCALBASE}/share/battalion",
+"",
+"This should really be:",
+"",
+"      CONFIGURE_ENV+= --with-datafiles=\${PREFIX}/share/battalion");
+       }
+
        my $needs_quoting = variable_needs_quoting($line, $varname, $context);
 
        if ($context->shellword == VUC_SHELLWORD_FOR) {



Home | Main Index | Thread Index | Old Index