debianpackagingdpkgdebhelperquilt

How to modify a Debian source package to include an additional executable script?


Goal: I want to create a modified Debian source package, namely the official rrdtool package + "some changes". One of these changes is the addition of an executable script.


I have this recipe for patching packages that I've used for many years:

dget http://bla/bla/bla.dsc
cd bla-1.0
(hack hack hack...)
dpkg-source -b .

That works if the patches don't chmod any files, but with a patch that introduces an executable file, following the recipe above produces this message:

dpkg-source: warning: executable mode 0755 of 'foobar' will not be represented in diff

And sure enough, when I unpack my new source package foobar exists but is not executable.


As I understand it, quilt handles patches based on GNU diff+patch. GNU diff+patch don't handle file permissions. Hmm...

So how do I introduce an executable script into a source package maintained by quilt?

Googling has not been helpful. It seems others have asked, but without replies.

I'm aware that I could simply make my modifications to the *.orig.tar.gz archive, but I'd like to avoid that if at all possible. I'm just amazed that this has been so difficult...


Solution

  • As with most things involving Debian packaging, I believe there are most likely several methods one could employ to accomplish your goal. As I'm still a novice at the process, the one I'm going to suggest is rather inelegant, but also very easy to implement.

    The Debian Maintainers' Guide tells us that the debian/install file...

    has one line per file installed, with the name of the file (relative to the top build directory) then a space then the installation directory (relative to the install directory). One example of where this is used is if a binary src/bar is left uninstalled; the install file might look like:

    src/bar usr/bin
    
    

    This means when this package is installed, there will be an executable command /usr/bin/bar.

    Which leads me to think that if you created such a debian/install file for your package's new executable script produced by the quilt patch, listing its path relative to the build dir root and the bindir you wish it to reside in, you'll have the package performing as desired.

    Another approach might be to make use of the postinst script as outlined in this section of the DMM.