4

We ran into this problem while packaging some software written in nodejs.

Because we can't package each and every dependency separately, we need to ship the node_modules/ directory along with the program. The code is installed into usr/share/<project>/..., and these are the warnings (and errors) that generates:

W: <project>: extra-license-file usr/share/<project>/node_modules/express/node_modules/mkdirp/LICENSE
E: <project>: wrong-path-for-interpreter usr/share/<project>/node_modules/request/node_modules/node-uuid/benchmark/bench.gnu (#!/opt/local/bin/gnuplot != /usr/bin/gnuplot)

There are hundreds of these.

I understand that all of those errors are relevant and meaningful, but I don't know how to get rid of them without cheating and without packaging each dependency separately. Is there another directory in the FHS in which a directory full of rubbish, like node_modules/, would be okay?

We've also looked into running npm install as part of the post install script, but decided we can't do that (for security and maintenance reasons)

Stefano Palazzo
  • 85,787
  • 45
  • 210
  • 227
  • Those lintian warnings look totally legitimate. There's no reason to suppress them, unless you are concerned that other, bigger issues, are hiding in the noise. There's no requirement to be lintian-clean, it's simply a sign that you are doing things well. – tumbleweed May 24 '13 at 16:02
  • The packaging is actually run as part of a makefile, meaning it'll fail (exit 1) if we don't suppress the errors. Using a `debian/lintian-overrides` file, the warnings and errors are still shown, but they don't cause the build to fail. – Stefano Palazzo May 24 '13 at 20:33
  • That sounds fragile. You can tell lintian to only report more serious issues, which is far better suited to an environment like that. Lintian warnings are entirely normal, your package is expected to collect new warnings from newer lintians, and you probably don't want those causing your builds to fail. – tumbleweed May 26 '13 at 23:48
  • Lintain only returns a non-zero exit status if there are errors, not warnings. I do want the build to fail in that case. Also, using lintian is the easiest way to ensure we build decent packages; ignoring those warnings and errors without good reason is a slippery slope I do not want to go down. So far, building packages without any warnings or errors has been reasonably easy. – Stefano Palazzo May 27 '13 at 06:16

1 Answers1

3

The warning/errors don't actually seem to have anything to do with the fact that you're installing them into a usr/share/<project>/node_modules directory. AFAICT, you'd be generating them wherever you install them.

As the docs mention, Lintian warning/errors can be overridden to silence them. Create a file called <package>.lintian-overrides in the debian directory of the source package. It should look something like:

<package> binary: wrong-path-for-interpreter *
<package> binary: extra-license-file *

Though the extra-license-file can be solved easily with this snippet for debian/rules:

override_dh_auto_install:
    find . -name "LICENSE" -delete
    dh_auto_install

There is a lintian-overrider tool that automates writing Lintian overrides. It can be used like so:

lintian -o <path/to/your/changes-file.changes> | \
      lintian-overrider --there-are-no-issues --source-dir <path/to/unpacked/source-tree>

More information can be found in the author's blog post.

andrewsomething
  • 37,262
  • 13
  • 93
  • 140
  • Exactly what I needed! Just hypothetically, would a package that pulls in lots of dependencies like this (and which silences lintain warnings and errors) be acceptable for universe? (assuming I'd generate a proper `debian/copyright` file with all the licenses in it) – Stefano Palazzo May 17 '13 at 08:37