Note: This web site is only kept up to date for OSG Software 1.2 (VDT 2.0.0). If you are looking for information for the most recent release, the RPM-based OSG Software 3.0, please see the OSG documentation web site

Debian Source Packaging Recipe

Initial Setup

  1. Get a clean copy of the original (aka “upstream”) source, preferably as a single source tarball
  2. Unpack the upstream source tarball
  3. Make sure that the resulting source code directory is named as follows:
    PACKAGE-VERSION

    Note: Use a hyphen to separate the package and version.

  4. If the source code directory was named correctly, then rename the upstream source tarball to fit the following format:
    PACKAGE_VERSION.orig.tar.gz

    Note: Here use an underscore to separate the package and version.

    Otherwise, repack the renamed source code directory into the correct tarball name:

    tar czf PACKAGE_VERSION.orig.tar.gz PACKAGE-VERSION
  5. If desired, make a backup of the source code directory for checking the accuracy of make clean:
    cp -pr PACKAGE-VERSION BACKUP_PACKAGE-VERSION
  6. Set up initial template directories
    [pkg dir:] dh_make --single --email YOUR-EMAIL-ADDRESS

    Note: Read the dh_make man page first to verify the command-line options used.

  7. Make sure the Debian tools recognize the orig.tar.gz file
    [root dir:] dpkg-source -b PKG-DIR

    This should result in messages like this:

    dpkg-source: building PACKAGE using existing PACKAGE_VERSION.orig.tar.gz
    dpkg-source: building PACKAGE in PACKAGE_VERSION-DEB-REVISION.diff.gz
    dpkg-source: building PACKAGE in PACKAGE_VERSION-DEB-REVISION.dsc

Debianizing the Package

The source code directory (pkg dir) now contains a debian directory, in which several template files have been placed. It is this directory and its contents that must be modified before constructing the final package. Also, if the source code itself requires changes for Debian, those changes are made directly to the source code files.

Notes on individual files:

*.ex, *.EX

Examples and/or templates of extra files that can be part of the Debian metadata. Delete any of these files that are not customized and used.

changelog

A required file that describes the history of changes to the packaging of the software. The file format is highly constrained and is described in section 4.4 of the Debian Policy.

compat

Just a version number of some Debian tools that may be used for packaging. Just leave this file alone.

control

Contains metadata for the source package and each resulting binary package. The format and contents are highly prescribed; see the Debian New Maintainer‘s Guide and the Debian Policy Manual.

copyright

Lists all copyright holders and licenses applicable to the software.

dirs

From the Debian New Maintainer‘s Guide: This file specifies the directories which we need but the normal installation procedure (make install) somehow doesn’t create. Optional.

docs

From the Debian New Maintainer‘s Guide: This file specifies the file names of documentation files we can have dh_installdocs install into the temporary directory for us. Optional.

README.debian

rules

The Package Build

  1. Remove all build products
    [pkg dir:] debian/rules clean
  2. Build the source package
    [root dir:] dpkg-source -b PACKAGE-NAME
  3. Build the software
    [pkg dir:] debian/rules build
  4. Build the binaries
    [pkg dir:] fakeroot debian/rules binary
  5. Make the changes file
    [root dir:] make-changes-file
    This file looks something like this:
    #!/bin/sh
    cd PKG-DIR
    SOURCE=$(dpkg-parsechangelog | sed -n 's/^Source: //p')
    VERSION=$(dpkg-parsechangelog | sed -n 's/^Version: //p')
    ARCH=$(dpkg --print-architecture)
    CHANGES=${SOURCE}_${VERSION}_${ARCH}.changes
    echo "making changes file '${CHANGES}'"
    dpkg-genchanges > ../$CHANGES
  6. Verify the package contents with lintian
    [root dir:] lintian CHANGES-FILE

Extra Packages Installed

For the Sun Java packages, go here and “Search package directories” for “java6”.