dpkg-source is the program that generates the Debian source package when a new package version is built. It offers many interesting command-line options but they are often not used because people don’t know how to ensure that they are used every time the package is built. Let’s fill that gap!
It is possible to forward some options to dpkg-source by typing them on the dpkg-buildpackage command line but you’d have to remember to type them every time. You could create a shell alias to avoid typing them but then you can’t have different options for different packages. Not very practical.
The proper solution has been implemented last year (in dpkg 1.15.5). It is now possible to put options in
debian/source/options. Any long option (those starting with “
--“) can be put in that file, one option per line with the leading “
Here’s an example:
# Bzip2 compression for debian.tar compression = "bzip2" compression-level = 7 # Do not generate diff for changes in config.(sub|guess) extend-diff-ignore = "(^|/)config.(sub|guess)$"
Notice that spaces around the equal sign are possible contrary on the command line. You can use quotes around the value but it’s not required.
debian/source/options file is part of the source package so if someone else grabs the resulting source package and rebuilds everything, they will use the options that you defined in that file.
You can also use
debian/source/local-options but this time the file will not be included in the resulting source package. This is interesting for options that you want to use when you build from the VCS (Version Control Repository, aka git/svn/bzr/etc.) but that people downloading the resulting source package should not have. Some options (like
--unapply-patches) are only allowed in that file to ensure a consistent experience for users of source packages.
You can learn more about the existing options in the dpkg-source manual page. Read it, I’m sure you’ll learn something. Did you know that you can tell dpkg-source to abort if you have upstream changes not managed by an existing patch in debian/patches? It’s
--abort-on-upstream-changes and it’s only allowed in