pkgsrc-Users archive

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

[PATCH] lintpkgsrc cannot locate certain include files



Hello.

When I run "lintpkgsrc -i" in the root of my pkgsrc-current tree, I get
errors like this:

=== console ===
$ cd /pkgsrc-current
$ lintpkgsrc -i
Scan Makefiles: ..........._______________________________
/pkgsrc-current/editors/emacs/Makefile: Cannot locate ../../editors/${MY_EMACS_TYPE:S/nox//}/version.mk in . /pkgsrc-current/editors/emacs

/pkgsrc-current/editors/emacs-nox11/Makefile: Cannot locate ../../editors/${MY_EMACS_TYPE:S/nox//}-nox11/version.mk in . /pkgsrc-current/editors/emacs /pkgsrc-current/editors/emacs-nox11
12470 packages
Version mismatch: 'py-cElementTree' 2.7.9 vs 3.4.2
Version mismatch: 'py-expat' 2.7.9 vs 3.4.2
===============

I reported this in September 2013:

  http://mail-index.netbsd.org/pkgsrc-users/2013/09/09/msg018608.html

What I believe is happening is that lintpkgsrc's Makefile parsing can't
handle includes that need recursive expansion like on line 113 of
editors/emacs-nox11/Makefile.common:

  .include "${EMACS_PKGDIR}/version.mk"

lintpkgsrc's Makefile parser does replace ${EMACS_PKGDIR} with the
variable's value, but its value includes another variable that needs
expansion.  That second expansion doesn't happen, so it ends up looking
for the file "../../editors/${MY_EMACS_TYPE:S/nox//}/version.mk" which
obviously doesn't exist.

The lintpkgsrc source code comments make it clear that the Makefile
parsing is not perfect, and it already punts on includes that it
couldn't fully expand.  The below patch adds another condition for
detecting an include that did not fully expand: it looks for "${" in the
include path.  With this patch, the lintpkgsrc output is fixed:

=== console ===
$ cd /pkgsrc-current
$ lintpkgsrc -i
Scan Makefiles: 12470 packages
Version mismatch: 'py-cElementTree' 2.7.9 vs 3.4.2
Version mismatch: 'py-expat' 2.7.9 vs 3.4.2
===============

Does this seem like a reasonable fix?  Would a developer be willing to
commit it?

Thank you!

Regards,

Lewis

Index: files/lintpkgsrc.pl
===================================================================
RCS file: /cvsroot/pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl,v
retrieving revision 1.4
diff -b -u -r1.4 lintpkgsrc.pl
--- files/lintpkgsrc.pl	24 Nov 2014 09:41:25 -0000	1.4
+++ files/lintpkgsrc.pl	10 Jan 2015 05:21:22 -0000
@@ -1190,6 +1190,7 @@
             # fully expand
             if (   $incfile =~ m#/mk/bsd#
                 || $incfile =~ /$magic_undefined/
+                || $incfile =~ /\${/
                 || ( !$opt{d} && $incfile =~ m#/(buildlink[^/]*\.mk)# ) )
             {
                 debug("$file: .include \"$incfile\" skipped\n");


Home | Main Index | Thread Index | Old Index