Creating Debian Packages

From IHRIS Wiki
Revision as of 23:02, 6 October 2007 by MarkAHershberger (talk | contribs)

From Scratch

This part of the document, describes the decisions made in packaging and descrbes the steps taken.

For the purpose of this discussion, we'll consider the build directory to be at ~/build.

Bazaar

$ sudo aptitude install bzr

If you are creating a new project, then make a directory for the project and put it under version control. For example:

$ bzr init ihris-qualify-debian

Since you are probably dealing with code already under version control, you can just check it out. For example, to check out the my build scripts for the i2ce project from Launchpad:

$ bzr co lp:~hexmode/i2ce/debian-dev i2ce-debian
$ ls
i2ce-debian

bzr-builddeb

$ sudo aptitude install bzr-builddeb

The build scripts are kept separate repository and kept under version control. To enable this (and keep the number of revision control systems in use to a minimum), I use bzr-builddeb to build packages directly from the bzr repository.

This package generation tool can keep the debian directory under revision control. If you look at my debian repositories, you'll see that the repositories are the contents of the debian directory. During the build process, bzr-builddeb merges the directory with the pristine source tree and performs all build operations there.

bzr-builddeb uses several configuration files to control its operation. The only one we're concerned with here is the default.conf file under the .bzr-builddeb directory. This stores the defaults for this package. The contents of ~/build/i2ce-debian/.bzr-debbuild/default.conf:

[BUILDDEB]
merge = True
export-upstream = http://bazaar.launchpad.net/%7Eintrahealth%2Binformatics/i2ce/main/

The first line just confirms that this is a bzr-builddeb configuration package.

The second line (merge = True) tells bzr-builddeb to merge this directory (in this case, ~/build/i2ce-debian with the the upstream source.

The third line (export-upstream = …) gives the location of the original source in Bazaar to check out.

Running bzr builddeb from within the i2ce-debian directory will create a ~/build/build-area/i2ce-2.0 directory, check out the code from Launchpad, put the contents of the current directory in the debian subdirectory, and build the package. After the package is built, the ~/build/build-area/i2ce-2.0 directory will be removed.