Wednesday, 17 June 2009

A Debian packaging workflow

The workflow I used earlier to generate the test package was:

1 ) Develop the scripts/binaries/whatever.

2 ) Create a directory {package-name} that has the following structure (where + indicates a directory):

+{package-name}
    +DEBIAN
        control
        postinst
        prerm
    +{mirror-of-file-system-with-binaries-etc}

3 ) Make sure the package files are owned by root:

sudo chown root:root -R {package-name}

4 ) Create a package with:

sudo dpkg -b {package-name} {package-name}_{major.minor.version}-{debian-package-version}_{all|{platform}}.deb

Example:

sudo dpkg -b foobar foobar_0.9.0-2_all.deb

5 ) Test package with lintian:

lintian {package-name}_{major.minor.version}-{debian-package-version}_{all|{platform}}.deb

Example:

lintian foobar_0.9.0-2_all.deb

6 ) Copy package to {repository}/binary and delete old version (You don’t need to be root to do this.)

7 ) Recreate Packages.gz for repository:

cd {repository}
dpkg-scanpackages binary /dev/null | gzip -9c >> binary/Packages.gz

8 ) Upload/sync changes to online repository.

Note: I am using {} in place of angled brackets because Flatpress is making angled brackets difficult.