Alexis Wilke
Alexis Wilke

Reputation: 20720

What tool do I use to make sure my debian/control file is valid?

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.)

Upvotes: 5

Views: 756

Answers (1)

Guillem Jover
Guillem Jover

Reputation: 2238

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".

Upvotes: 4

Related Questions