I recently had to create modified versions of some debian packages, to apply some custom patches and use some special compilation options for a scratchbox environment. It was time that I learnt something about actually making debian packages. These were packages that Daniel Holbach couldn’t do for me, but he did explain some stuff, which I’ll note here for my reference. He’s not to blame for my errors.
To get existing debian package stuff, make a directory and do this:
This gives you 3 files, of these types:
You don’t need to uncompress and apply all that manually. There are tools to help:
That should confirm that you can actually build the packages. If you are missing some dependencies, try “apt-get build-dep yourpackagname”.
Now you might want to change some things before building the packages again. For instance:
After you have changed the sources and the debian files appropriately, debuild (or dpkg-buildpackage – see above), should build the packages again, putting them in the parent directory. It will even create the .dsc and .diff.gz files, completing the circle.
Really nice quickstart tutorial.
A small note though: When packaging a new upstream release you can just do uupdate in the current source directory. uupdate will automatically produce a new directory with the debian directory and the correct version so that dch -i knows reliably which version to pick next.
In most Debian packages nowdays there’s also a debian/watch file which describes under which URL new upstream releases can be found. In this case you just have to run uscan to download the new release. uupdate will be called automatically.
Good concise summary. One point, I don’t think you need to have uid=0 for dpkg-source, just debuild/dpkg-buildpackage.
I’m not familiar with the new stuff that is being developed for Fedora which simulates some of this stuff: perhaps a follow-up article in the same vein? :)
Thanks!
was looking at how to build custom deb packages, but information was a bit scarce or too technical too really understand what i needed to do, but your little guide helped me heaps :)
I just corrected the “apt-get install build-dep yourpackagname” in this post to “apt-get build-dep yourpackagname”. It’s surprising that nobody mentioned it until now.