Bzr
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 the same name as a registred product (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)
apt-get source <package_name>
- lsdiff -z *.diff.gz
-> Ensure every files are listed in debian/ directory. If not, ping a ubuntu-desktop team member
mv package_name-<version> ubuntu
- cd ubuntu
- bzr init
- mkdir .bzr-builddeb
echo -e '[BUILDDEB]\nmerge = True' > .bzr-builddeb/default.conf
- bzr add debian .bzr-builddeb/default.conf
- bzr clean-tree
- Ensure that everything's correct:
- ls -A
- bzr .bzr-builddeb debian
bzr commit -m "initial <package_name> import"
=> 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
Ask for someone on #ubuntu-desktop for merging it into #ubuntu-desktop branch
Getting a package
- bzr branch lp:~ubuntu-desktop/package_name/ubuntu
Building a package
- bzr branch lp:~ubuntu-desktop/package_name/ubuntu
- cd ubuntu
- bzr-buildpackage or bzr bd
- If debian/watch is properly set, this will download the orig.tar.gz tarball for you.
you can add --builder pdebuild if you use pbuilder.
Building a source package
- bzr branch lp:~ubuntu-desktop/package_name/ubuntu
- cd ubuntu
- bzr-buildpackage -S or bzr bd -S
Updating a package
How updates works
The idea is to make one change = one commit. Just update one thing in the package and then commit it. The debian/changelog must have the "UNRELEASED" distribution pocket.
First update
if it's the first update just after the initial commit, you can proceed this step:
- bzr branch lp:~ubuntu-desktop/package_name/ubuntu
- Ensure that debian/watch is looking at unstable version if available. Otherwise, update it your debian/watch. (uscan --verbose --report to see what is the latest version corresponding to debian/watch regexp)
- add in debian/control.in:
Vcs-Bzr: https://code.launchpad.net/~ubuntu-desktop/<package_name>/ubuntu
generate debian/control from debian/control.in with DEB_AUTO_UPDATE_DEBIAN_CONTROL=yes fakeroot debian/rules clean (clean target normally has an instruction to generate debian/control from debian/control.ini)
- dch -vNewVersion -D UNRELEASED and edit changelog to reflect those changes:
* debian/control.in:
- add Vcs-Bzr tag
-re-generate debian/control
* Adapt debian/watch to get unstable version- bzr commit (copy and paste the previous part as a commentary)
Other updates / Following
Reminder: one change = one commit. Each time, make a change, edit the changelog (in UNRELEASED) and then commit it.
- bzr branch lp:~ubuntu-desktop/package_name/ubuntu
- Ensure that debian/watch is looking at unstable version if available. Otherwise, update it. (uscan --verbose --report to see what is the latest version corresponding to debian/watch regexp)
# do the traditionnal hack (One change!)
bzr status to ensure that everything that is listed is correct
dch -vNewVersion -D UNRELEASED and edit changelog. (if not already done. Otherwrise dch -{e,a})
Then, bzr commit and copy the change of this commit
- Hack again in the next change of the package and commit it
Final commits
Open debian/changelog with dch -{e,a} and put "New upstream version (LP: #BugNumber)" + copy the NEWS file
debcommit (it will copy then the changelog file and commit the branch)
dch -r and save. (it will replace UNRELEASED by <current development version>)
- debcommit -r (it will generate and commit message "releasing…" and add a tag corresponding to the version.
=> 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 (after having created the branch there): bzr push lp:~<userid>/<packgage_name>/ubuntu (--use-existing-dir if it is the first time)
Some tricks/tips
Access to the full tree of the current revision
If you want to see the full tree (with files coming from .orig.tar.gz) to retrieve automagically, for instance, the NEWS file from upstream, you can try: bzr bd-do. You will be dropped in a subshell
- there, you can patch the files with dpatch/quilt/simple-patch-sys.
- To exit :
- exit 1 to exit without any changes taken into account.
- exit 0 copy back changes in debian/ directory in the branch.
- Note: It will automatically download the new .orig.tar.gz the first time, accordingly to debian/watch
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:
- bzr bd -e -r -1 (if the last bzr commit is the previous version, otherwise, you can use -2, -3...)
- bzr bd-do
previous version is at ../<name_previous_version>
- Note for packages using autotools (many of ubuntu desktop package does)
diff -u <oldversion>/configure.in build-area/<new-version>/configure.in to see impacts in configure.in (dependencies, etc.)
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:
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.