4

I'm looking into a fast way to verify that the debian/control files of my projects are syntactically valid before I send them to the build server. (i.e. an equivalent of apache2ctl configtest but for debian control files.)

For example, once in a while, I update a list of dependencies and miss a comma. The build system takes forever so I was hoping I could just run a quick check to at least make sure the file can be loaded.

Is there a tool I can run from my Makefile before I check things in?

(P.S. whether the list of dependencies is correct is a problem only the build system can check, I'm looking to just check that the syntax is correct.)

Alexis Wilke
  • 19,179
  • 10
  • 84
  • 156

1 Answers1

4

Depends on what control file you'd like to check, and which parts. I'm assuming from the context that you are referring to the debian/control in the source tree.

If you want to check the build-dependencies then running dpkg-checkbuilddeps on the source tree, would do it. If you want to check the dependencies for each binary package stanza, then the options are a bit cumbersome. In that case I'd recommend just building the source and running lintian on it, something like:

dpkg-source -b source-dir
lintian source-name*.dsc

Alternatively you could also check cme with its libconfig-model-dpkg-perl support.

The syntax for most (if not all) fields will end up being verified by the various dpkg-dev tools at build time, but as you say that might be "too late".

Guillem Jover
  • 2,090
  • 2
  • 11
  • 16
  • Yeah, I'm really interested in something that runs in the Makefile as a quick verification check (something that's close to "instantaneous"). Opposed to running the build to know whether it works... Especially for something as basic as knowing whether I missed a comma or misspelled a field name... I put an example in my question now, I know of `apach2ctl contfigtest` that does that sort of check before you attempt to reload/restart. That way you can make corrections if there are any big mistakes. – Alexis Wilke Sep 20 '16 at 18:59