Git buildpackage Rectification

From gnewarchaeology wiki
Jump to: navigation, search
GitHub > Git buildpackage Rectification

At the moment this page is just a log of my first Debian package builded for ArcheOS using git-buildpackage. Thanks to ORNis for his teaching, I've built a Rectification .deb package. Rectification is an abandoned module from e-foto photogrammetry suit. A complete tutorial will follow.


Packaging workflow

If you are making a Debian package with an upstream program, the typical workflow of Debian package building involves generating several specifically named files for each step as follows.
  • Get a copy of the upstream software, cloning the source code with git clone. You may need to adjust package name and upstream version by renaming the upstream source to follow Debian Policy and existing convention.
    • package-version
  • Create a non-native source package in 3.0 (quilt) format with dh_make.
    • package_version.orig.tar.gz: the original upstream source code tarball.
  • And add Debian-specific packaging modifications to the upstream program under the debian directory.
  • Init a Git repository with:
    • master branch holds the current development work
    • upstream branch holds the upstream releases
    • pristine-tar branch holds the necessary additional information to recreate the original tarball from the upstream-branch
    • debian/version tags for each upload
  • Build with git-buildpackage the Debian binary packages, which are ordinary installable package files in .deb format.
    • package_version-revision_arch.deb: the completed binary package.
    • package_version-revision.debian.tar.gz: tarball with the debian changes.
    • package_version-revision.dsc: a summary of the contents of the source code.
  • Test the package with lintian
  • Upload the package


Before you start anything, you should make sure that you have properly installed some additional packages needed for development. [...] The most important package to install on your development system is the build-essential package. Once you try to install that, it will pull in other packages required to have a basic build environment. [...] However, there is another set of packages that while not essential for all package builds are useful to have installed or may be required by your package:
$ sudo apt-get install build-essential debhelper dh-make fakeroot quilt lintian pbuilder git-buildpackage


Set up dh_make.

$ cat >>~/.bashrc <<EOF
DEBFULLNAME="Firstname Lastname"
$ . ~/.bashrc

Edit the file ~/.gbp.conf.

Configure git-buildpackage to use pristine-tar. Pristine-tar allows you to store the upstream tarball directly in Git in an extremely space-efficient way, which means that the Git repository is then all you need to build a Debian package.
builder = git-pbuilder
cleaner = fakeroot debian/rules clean
pristine-tar = True

export-dir = ../build-area/
#tarball-dir = ../tarballs/
builder = /usr/bin/git-pbuilder -sa
dist = wheezy
pbuilder = True

filter = .git
filter = .gitignore
#filter = .svn
#filter = .hg

Prepare the development environment

To create a work environment for ArcheOS development work:

$ mkdir ~/archeos-dev
$ cd ~/archeos-dev

To create the necessary cowbuilder chroot for Wheezy use:

sudo DIST=wheezy git-pbuilder create

Clone the source code

$ mkdir rectification
$ git clone
$ cd rectify/

Rename the upstream source

$ mv -v rectigfication rectification-1.2
$ cd rectification-1.2/


$ dh_make --createorig --copyright gpl2

You should see some output asking you what sort of package you want to create.This execution of dh_make creates a copy of the upstream tarball as rectification_1.2.orig.tar.gz in the parent directory and many template files are created in the source under the debian directory.

Done. Please edit the files in the debian/ subdirectory now. You should also
check that the rectification Makefiles install into $DESTDIR and not in / .

Add Debian-specific packaging modifications

Now you will need to modify the upstream source for Debian.

$ cd debian
$ rm -v *.ex *.EX

Edit the files in debian/ directory. control, changelog, copyright, and rules are required for all packages. If you accidentally erased some template files while working on them, you can recover them by running dh_make with the --addmissing option again in a Debian package source tree.

Init an empty git repository

$ mkdir ~/archeos-dev/rectification/rectification-archeos
$ cd ~/archeos-dev/rectification/rectification-archeos/
$ git init
$ git commit --allow-empty -m "Initialized empty Git repository"
$ git branch upstream
$ git checkout upstream

Import the original tarball in upstream branch

$ git import-orig ../rectify/rectification_1.2.orig.tar.gz
What will be the source package name? [rectification] 
What is the upstream version? [1.2]

Work on master branch

$ git checkout master
$ cp -rv ../rectify/rectification-1.2/debian ./
$ git add .
$ git commit -m "Initial Debian directory"
$ git remote add origin
$ git push -u origin --all
$ git push --tags

Edit control

This file contains various values which dpkg, dselect, apt-get, apt-cache, aptitude, and other package management tools will use to manage the package.

Source: rectification
Section: graphics
Priority: extra
Maintainer: Domenico Giusti <>
Build-Depends: debhelper (>= 9.0.0), libqt4-dev (>=4.8.0) 
Vcs-Git: git://

Package: rectification
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: ArcheOS rectification module from e-foto photogrammetry suite.
 Rectification is a module from e-foto photogrammetry suite. Rectification 
 aims to make the correction of a digital photographic image originally
 distorted, projecting it onto a horizontal plane through geometric
$ git add .
$ git commit -m "Edited debian/control"
$ git push

Edit copyright

This file contains information about the copyright and license of the upstream sources. dh_make can give you a template copyright file. You must fill in missing information to complete this file, such as the place you got the package from, the actual copyright notice, and the license.

Upstream-Name: rectification

Files: *
Copyright: 2012 E-Foto Project <>
License: GPL-2.0+

Files: debian/*
Copyright: 2013 Domenico Giusti <>
License: GPL-2.0+

License: GPL-2.0+
$ git add .
$ git commit -m "Edited debian/copyright"
$ git push

Edit changelog

Changes in the Debian version of the package should be briefly explained. This includes modifications made in the Debian package compared to the upstream one as well as other changes and updates to the package.

rectification (1.2-0archeos1) unstable; urgency=low

  * Initial release (Closes: #nnnn)  <nnnn is the bug number of your ITP>

 -- Domenico Giusti <>  Wed, 13 Mar 2013 21:33:18 +0100
$ git add .
$ git commit -m "Bumbed ArcheOS version number"
$ git push && git push --tags

Edit rules

Other files under the debian directory

Edit README.Debian

Documents any extra details or discrepancies between the original package and your Debian version. If you have nothing to be documented, remove this file.

Edit README.source

rectification for ArcheOS

Rectification is an abandoned module from e-foto photogrammetry suite.
Upstream page:

Rectification has been packaged by Domenico Giusti for ArcheOS.

Edit compat

Defines the debhelper compatibility level.


Edit debian/rectification.install

Most third-party software installs itself in the /usr/local directory hierarchy. On Debian this is reserved for private use by the system administrator, so packages must not use directories such as /usr/local/bin but should instead use system directories such as /usr/bin, obeying the Filesystem Hierarchy Standard (FHS).
rect /usr/bin

Edit menu

X Window System users usually have a window manager with a menu that can be customized to launch programs. If they have installed the Debian menu package, a set of menus for every program on the system will be created for them.

?package(rectification):needs="X11" section="Applications/Graphics"\
  title="rectification" command="/usr/bin/rect"

Build package

$ git-buildpackage --git-pbuilder

Check errors and warnings

The lintian command runs many test scripts to check for many common packaging errors.

$ lintian rectification_1.2-0archeos1_i386.deb
W: rectification: wrong-bug-number-in-closes l3:#nnnn
W: rectification: binary-without-manpage usr/bin/rect

rect command error output:

QPixmap::fromMimeSource: Cannot find pixmap "images/identity.png" in the mime source factory
QPixmap::fromMimeSource: Cannot find pixmap "images/limpar.png" in the mime source factory
QPixmap::fromMimeSource: Cannot find pixmap "images/gnome-dev-floppy.png" in the mime source factory
QPixmap::fromMimeSource: Cannot find pixmap "images/identity.png" in the mime source factory

Modifying the source

$ mkdir debian/patches
$ dquilt new 001-update_about.ui.patch
$ dquilt add about.ui
$ editor about.ui
$ dquilt diff
$ dquilt refresh
$ dquilt header --dep3 -e
Description: <short description, required>
 <long description that can span multiple lines, optional>
Author: <name and email of author, optional>
Origin: <upstream|backport|vendor|other>, <URL, required except if Author is pr$
Bug: <URL to the upstream bug report if any, implies patch has been forwarded, $
Bug-<Vendor>: <URL to the vendor bug report if any, optional>
Forwarded: <URL|no|not-needed, useless if you have a Bug field, optional>
Applied-Upstream: <version|URL|commit, identifies patches merged upstream, opti$
Reviewed-by: <name and email of a reviewer, optional>
Last-Update: <YYYY-MM-DD, last update of the meta-information, optional>
This patch header follows DEP-3:

Patches are applied incrementally on top of the base tree plus all preceding patches. They can be pushed on top of the stack (quilt push)

$ dquilt push

and popped off the stack (quilt pop)

$ dquilt pop -a