Difference between revisions of "Packaging using gbp"

From LSDevLinux
Jump to: navigation, search
(Initial creation)
 
(Overview: Add a procedural description)
Line 17: Line 17:
  
 
There's usually also a ''pristine-tar'' branch that's used in conjunction with ''upstream'' to recreate exact copies of the original upstream tarballs.
 
There's usually also a ''pristine-tar'' branch that's used in conjunction with ''upstream'' to recreate exact copies of the original upstream tarballs.
 +
 +
== Adding a new patch ==
 +
 +
For a [http://manpages.debian.org/cgi-bin/man.cgi?query=dpkg-source quilt-format] package, differences from the upstream release are stored as a series of patches in <code>debian/patches/</code>. gbp can import these patches into a temporary branch called a ''patch-queue'' which is never pushed to the shared (remote) repository. The developer then makes new commit(s) on this branch, and uses gbp to export the branch back to <code>debian/patches/</code>. The updated <code>debian/</code> directory is then committed to the ''master'' branch.
 +
 +
The exact steps are as follows:
 +
 +
; <code>git checkout master</code>
 +
: Start from a known state
 +
; <code>gbp pq import</code>
 +
: Turn the patches into commits on a temporary branch and switch to it. You are now on ''patch-queue/master''
 +
; ''HACK, COMMIT, HACK, COMMIT, HACK, COMMIT ...''
 +
: Your commits will become new patches
 +
; <code>git checkout master</code>
 +
: Switch away from the patch-queue branch
 +
; <code>git status</code>
 +
: Check for extraneous files and uncommitted changes
 +
; <code>git clean -dxf</code>
 +
: Remove extraneous files
 +
; <code>gbp pq export</code>
 +
: Update <code>debian/patches/</code>
 +
; <code>git status</code>
 +
: Review the added/changed patches
 +
; <code>git add debian</code>
 +
: Stage everything under <code>debian/</code>
 +
; <code>git commit -m "Add patch(es): ..."</code>
 +
: List the patches in the commit message
 +
; <code>gbp dch -R -c</code>
 +
: Update the changelog and open it in an editor for final adjustment. You can usually just save and quit.
 +
; <code>gbp buildpackage --git-pristine-tar -nc -S</code>
 +
: Build a source package

Revision as of 16:13, 19 August 2014


Overview

gbp or git-buildpackage is a utility that supports maintaining a Debian/Ubuntu package in git. It takes care of a lot of the details and ensures consistency and correctness.

A gbp-compatible repository has two main branches:

  1. upstream
  2. master

The upstream branch is used to store the content of successive upstream ('orig') tarballs, and each upstream release is tagged.

The master branch is forked from upstream and adds the debian/ directory. It has tags for each package release.

When a new upstream version is integrated, the upstream branch is merged into master.

There's usually also a pristine-tar branch that's used in conjunction with upstream to recreate exact copies of the original upstream tarballs.

Adding a new patch

For a quilt-format package, differences from the upstream release are stored as a series of patches in debian/patches/. gbp can import these patches into a temporary branch called a patch-queue which is never pushed to the shared (remote) repository. The developer then makes new commit(s) on this branch, and uses gbp to export the branch back to debian/patches/. The updated debian/ directory is then committed to the master branch.

The exact steps are as follows:

git checkout master
Start from a known state
gbp pq import
Turn the patches into commits on a temporary branch and switch to it. You are now on patch-queue/master
HACK, COMMIT, HACK, COMMIT, HACK, COMMIT ...
Your commits will become new patches
git checkout master
Switch away from the patch-queue branch
git status
Check for extraneous files and uncommitted changes
git clean -dxf
Remove extraneous files
gbp pq export
Update debian/patches/
git status
Review the added/changed patches
git add debian
Stage everything under debian/
git commit -m "Add patch(es): ..."
List the patches in the commit message
gbp dch -R -c
Update the changelog and open it in an editor for final adjustment. You can usually just save and quit.
gbp buildpackage --git-pristine-tar -nc -S
Build a source package