Packaging/Creating DEB Package files

From GEANT2-JRA1 Wiki

Contents

Debianizing your package

There are 2 ways of debianizing your source package.

Copy example files from SVN

The Flow S&A MA package is quite grown up and addressess almost all aspects of package creation, for example a startup script. Using these files is the most easiest, since all services are quite similar. You can copy the content of the example debian dir to your own debian folder in the extracted source.

It is _not_ a good idea to copy the debian files to your source folder, since the debian package files are not part of your source. The debian package process also creates debian sources packages, and you don't want debian package files in your debian source package.

running dh_make in your source folder

You can start all over if you want, but then you should start reading the debian maintainers guide.

Content of Debian folder


changelog

The changelog of the package. You are forced to use the changelog, since the version number of the package is derived from the changelog. It is generally a good idea anyway to keep the changelog up to date. You can generate a new changelog entry running 'dch -i' in the source folder (debian/..).

control

Here all meta data of the package is specified. Things like dependecies and description. Tomcat service packages should depend on:

tomcat5.5, java5-runtime | java6-runtime | java-virtual-machine

rules

This is the most complicated file. It is actually a makefile. Here the build, clean and install process is defined. all the dh_ macro's are used for internal debian package processess, for example copy the files defined in the 'install' file in your debian folder. In the case of a perfSONAR tomcat service most likely you only need to change the 'maven package' statement in the build section to any command that builds your project.

Note: This file is a makefile, so you should use ONLY tabs for indentation. Also the file should be 755 (chmod 755 rules)

copyright

dirs

The directories used in your package.

install

Double List of files, source destination. This file is used to specify which files dh_install should copy from your source directory to the virtual tree. If you have already have a makefile that installs files into the virtual tree you don't need to specify them again here.

conffiles

List of files that are marked as configuration files. These files are threaded specially during a package upgrade (read: not overwritten if changed manually).

docs (optional)

Files that are marked as documentation.


postinst (optional)

A script run after installation. We like the have some symlinks to the configuration files in /etc for easy access. This is done here.

postrm (optional)

A script run after package removal. Here you can cleanup data files.

preinst (optional)

A script run before package installation.

prerm (optional)

A script run before package removal.

Building the package

If you are building a package with any binary files in it, it is advised to build the package on the oldest debian compatible distribution available (now debian 4) since most binaries are forward compatible and not backwards. If you are building java only packages this doesn't matter.

Before you can build a package you need to install the debian package 'devscripts':

# apt-get install devscripts

To simply build the package run:

$ dpkg-buildpackage

This will build the package in a chroot, so no root permissions are needed. Also the package is signed with a key, if available.

Workflow

  • Create a working build folder
  • Download the package source release and put it in the working directory
  • extract the package
  • make sure the package is in the <package>-<version> format, and doesn't contain a _ or some other strange symbol
  • create a debian subfolder in the source package
  • copy the flow S&A MA debian files] to the debian subfolder
  • adjust all files to fit the package
  • run dpkg-buildpackage
  • If everything runs smoothly a package will be created in the parent directory
  • test the package:
    • Install (dpkg -i <package>)
    • Deinstall (dpkg -r <package>)
    • Purge (remove config files, dpkg -P <package>)
    • Upgrade (if possible)
    • Are all files included?
  • submit the package to the repository maintainer
  • upload the content of your debian files to https://svn.internet2.edu/svn/perfsonar/trunk/packaging/deb/<package>
  • from now on you should use these debian files to build this package.
Personal tools