Experimenting with Bazaar (bzr)

The desktop team is considering using Bazaar (bzr) for packaging work. Some packages have been added to bzr to evaluate the workflow, but things like editing patches are not easy enough yet so there is no requirement to update bzr when uploading a new revision of one of those packages. You are welcome to try using bzr for packaging though and let us know what you think about it and make suggestions on changes we could do there.

Ensure that you have Bazaar Builddeb, package bzr-builddeb, installed on your computer, in addition to bzr.

You need to be member of the ubuntu-desktop team on launchpad to commit. You need be a known contributor to be added to the team since it gives you commit rights. Only the debian/ directory is stored in bzr (merge mode of bzr-builddeb).

List of the desktop team packages

You can see the list of packages available in our Bazaar repository here.

Adding a package using bzr

Below, "package_name" is the name of the source package and "userid" your username on launchpad. Launchpad require to use name of a registred product (called product_name) here; those are often, but not always identical (for example, the product "eel" is packaged as "eel2" in Ubuntu).

Please don't start adding all the desktop packages now, we want to try how bzr is working for us on a given set of package before switching.

$ ls -A
.bzr  .bzr-builddeb  debian

If you are a member of the ubuntu-desktop team: you can push it to lp:~ubuntu-desktop/<package_name>/ubuntu

Otherwise push it somewhere like in your personal LP code page: bzr push lp:~<userid>/<packgage_name>/ubuntu

Open a sponsor bug or ask for someone on #ubuntu-desktop for merging it into #ubuntu-desktop branch.

Getting a package

Building a package

Building a source package

Updating a package

How updates work

The idea is to make exactly one coherent change per commit. The debian/changelog must have the "UNRELEASED" distribution pocket while the package is modified, but not uploaded yet.

Please avoid using bzr specific commit messages. Always use "debcommit", which extracts the message from debian/changelog and uses it as bzr commit message.

First update

Warning /!\ if it's the first update just after the initial commit, you can proceed this step:

  * debian/control.in:
    - add Vcs-Bzr tag
    - re-generate debian/control
  * Adapt debian/watch to get unstable version

Other updates / Following

Warning /!\ Reminder: one change = one commit. Each time, make a change, edit the changelog (in UNRELEASED) and then commit it.

(i) Modifying a package with a patch system is straightforward.

Final commits

Upload

If you are a member of the ubuntu-desktop team:

If you cannot upload the package yourself:

Some tricks/tips

Access to the full tree of the current revision

Diff configure files between 2 version

If you need to diff (for instance configure files) to the previous version of the package, you can do:

New files in bzr, or complains about missing patch (for instance) during the build

You can add some files to debian/ by bzr add ... or removing them executing bzr rm ...

quilt + bzr + autotools = <3

Let's imagine your machine is running a stable ubuntu version. When trying to autoconf, it tells you "hum... your version does not correspond to the one used for autoreconf, try autoreconf". But the requested version in only in the ubuntu unstable release!

Don't cry, there is a solution for you, using pbuilder and 2 tabs in your prefered terminal console. Here is a step by step process:

Warning /!\ This solution can appear as quite complexe for adding files using quilt instead of a classic find . -type f | xargs quilt add, but in some cases, autotools can create new file you will need in your patch and this method will not catch them contrary to the following - and more complicated - one.

pbuilder initialization

$ sudo pbuilder login
# echo "deb-src http://archive.ubuntu.com/ubuntu/ jaunty main restricted universe multiverse" >> /etc/apt/sources.list
# apt-get update
# apt-get install libtool gnome-common
# apt-get build-dep <your_package>
# useradd -u <your UID outside the chroot>
# su foo

-> the reason why of creating a user with your uid is that some autoconf tools use cache directories and they will belong to root, so, you will have some errors like: bzr: ERROR: [Errno 13] Permission denied: '../build-area/<package-version>/autom4te.cache/output.0'

And then, having to remove them manually.

outside the chroot, bindmount the full tree

$ export QUILT_PATCHES=debian/patches
$ echo "" > debian/patches/70_autotools.patch
$ bzr bd-do
$ quilt push -f 70_autotools.patch (or the autotools patch)
$ sudo mount --bind . /var/cache/pbuilder/build/<ID of your "pbuilder login" environment>/mnt/
$ touch ../dummy

inside the chroot, first autoconf launch

$ cd /mnt
$ autoconf / autoreconf
$ cd ..

outside the chroot, reset the environment

$ find . -type f -newer ../dummy > ../listquiltadd
(remove all cache files like autom4te.cache/* in this file)
$ sudo umount .
$ exit 1 (do not update anything!)

Go now for the true update!

$ bzr bd-do
$ quilt push -f 70_autotools.patch
$ sudo mount --bind . /var/cache/pbuilder/build/<ID of your "pbuilder login" environment>/mnt/
$ cat ../listquiltadd  | xargs quilt add

inside the chroot, second and final autoconf launch

$ cd /mnt
$ autoconf / autoreconf
$ cd ..

outside the chroot, refreshing the patch

$ quilt refresh
$ quilt pop -a
$ sudo umount .
$ exit 0

inside the chroot, exiting it

$ exit 0

Never forget listing missing files

dh_install --list-missing to see files that may miss you in the debian package if you don't handle them properly

Uploads to the team archive for sponsoring

You can read https://help.launchpad.net/PPA about how to use the team archive; we will use this for sponsoring.

DesktopTeam/Bzr (last edited 2010-12-07 23:38:55 by 71-208-179-99)