Recently, however, I have applied a completely new strategy: I start with nothing, call
debuild
, fix the error, retry, until it works. This might sound pretty bizarre, but it works pretty well and enhances your understanding of how the packaging tools work.Here is about how it works:
Start with nothing, call
debuild
, it complains:cannot find readable debian/changelog anywhere!Call
dch --create
, which says:Cannot find debian directory!OK,
mkdir debian
, call dch --create
again, fill in the template. Call debuild
again, now it says:but there's no debian/rules there!Create a
debian/rules
, that's easy to do by heart nowadays, at least as a start:#!/usr/bin/make -f %: dh $@Call
debuild
again, now dpkg-buildpackage
actually starts, but stops with:dpkg-source: error: cannot read mypackage/debian/control: No such file or directoryAt this point I'm too lazy to figure out what is necessary to put into
debian/control
, so let's just keep it simple and touch debian/control
. At this point dpkg-source gets into a bit of trouble:Use of uninitialized value $sourcepackage in sprintf at /usr/bin/dpkg-source line 290.So let's put that in and also follow the subsequent advice to add
debian/source/format
and the Maintainer
and Standards-Version
fields. So far we have:Source: mypackage Maintainer: Peter Eisentraut <petere@debian.org> Standards-Version: 3.9.2The next hint of a message is:
dh: No packages to build.This means we need a binary package stanza, so I'll just add
Package: mypackage Architecture: anyNow
debhelper
complains:dh: Compatibility levels before 5 are deprecated.Not sure why it didn't complain about that earlier. Let's stick 8 in there.
At this point I had to do actual work and mess around with
debian/rules
a bit to get the package to actually build, but a few minutes later I had a functioning provisional package.The next step is to clean up the warnings from the various
dpkg-*
workers:dpkg-gencontrol: warning: missing information for output field Description dpkg-gencontrol: warning: package mypackage: unused substitution variable ${shlibs:Depends} dpkg-deb: warning: parsing file 'debian/mypackage/DEBIAN/control' near line 6 package 'mypackage': missing description dpkg-genchanges: warning: missing Section for binary package mypackage; using '-' dpkg-genchanges: warning: missing Priority for binary package mypackage; using '-' dpkg-genchanges: warning: missing Section for source files dpkg-genchanges: warning: missing Priority for source filesSo we add
Description
, Depends
, Section
, and Priority
.And finally we have a list of complaints from Lintian to address:
W: mypackage source: debhelper-but-no-misc-depends mypackage E: mypackage source: package-uses-debhelper-but-lacks-build-depends W: mypackage source: package-needs-versioned-debhelper-build-depends 8 W: mypackage source: debhelper-overrides-need-versioned-build-depends (>= 7.0.50~) E: mypackage source: temporary-debhelper-file debhelper.log E: mypackage: no-copyright-fileThe only things I added manually after that were
Vcs-*
, Homepage
, and Enhances
.Now the only things left to do are running the thing through
cowbuilder
a few times and putting in all the necessary build dependencies, and writing a nice changelog entry.Note, this method does not replace putting in some thought. But it's an interesting way to get a relatively clean package.