Start building Ubuntu/Debina packages

Hans asked a while ago about packaging software for Ubuntu/Debian. Here are some hints and good pointers, I hope.

I have for a long time build RPM-packages for various distributions. When I began to create .debs this was booth good and bad to have a good knowledge about RPMs. Debian has a lot of utilities that makes things very smoothly, there are a lot of these tools I miss when creating RPM:s now days. On the other hand when you are used to describe your package in one .spec-file you may be a bit scared of all files you got in your debian-directory. Briefly described, the debian directory and .spec file has the same goal. They describe how to build the package from the source. I would say that if you are building a very simple package RPM:s are easier but as soon as you want to do more complex things deb:s are easier. for instance one thing you get help with creating debs is restarting daemons correct after upgrades etc, this is a mes for RPMs.

I will not describe exactly what to do when creating a package, instead I want to point out good sources and give some hints from my own experience.

Debian New Maintainers' Guide as well as Debian Policy Manual are must to use as a references. Ubuntu also has its own The Ubuntu Packaging Guide.

One thing that made it hard for me in the beginning were that there are so may ways that you can create packages in. Today, I think the easiest way to get a kick start in packaging is to follow the Debian New Maintainers' Guide. Start the from the beginning and create your package when you read it. Remember, the first one is the hardest.

You may need to install some packages before you start:
  • build-essential, which is a meta packages that install development tools.
  • dh-make, converts source archives into debian package source.
  • fakeroot, gives a fake root environment. I think it is much easier to work with than be in a change rooted environment.
  • dpkg-dev, several tools to maintain build debs.
  • dpkg-dev-el, a must if you use Emacs. Helps you edit the debian files.
  • module-assistant, if you will create kernel module packages. This packages also include a good how to.
As always, you want to use a version control system to trace your changes. It had been a discussion on the Ubuntu-devel-list about how to do it. I interpreted it as the most common and convenient way is to only have the debian directory under revision control and use dpatch and the patches subdirectory to handle your changes in the code. You should of course also submit the patches back to upstream, the project that develop the software you are building a package for. If you are responsible for the source your self, you may have the debian directory in the same repository as the rest of the source.

You may also take advantage by look how other packages are done. Download the source for packages with apt-get source sourcepackage.

When you are ready and your package may be of interest for others, please upload it to REVU.

Comments

Popular posts from this blog

Circles in PostGIS

Create your own CA with TinyCA2 (part 1)

Create your own CA with TinyCA2 (part 2)