How to merge unreleased upstream changes to a Debian package using git-buildpackage

Publikováno

v

,

I use bspwm as a window manager of choice and the latest official release 0.9.10 was created more than 4 years ago. Overall I am happy with it, but there is one bug that’s been driving me crazy lately.

Sometimes new dialogs (for example a file chooser) don’t appear until click or another event occurs. This bug has already been fixed in the master branch, but the Debian/Ubuntu package is still stuck at 0.9.10. How can I fix this?

I first wanted to follow my tutorial for patching an existing package. apt source bspwm prints:

NOTICE: ‚bspwm‘ packaging is maintained in the ‚Git‘ version control system at: https://salsa.debian.org/debian/bspwm.git
Please use:

git clone https://salsa.debian.org/debian/bspwm.git

to retrieve the latest (possibly unreleased) updates to the package.

It seems like the package is maintained the git-buildpackage toolkit, so it may be better to use that. debian/gbp.conf contains the following:

[DEFAULT]
upstream-branch = upstream
debian-branch = master
upstream-tag = %(version)s
compression = xz

[buildpackage]
export-dir = ../build-area/

1. Clone the Debian repository

git clone https://salsa.debian.org/debian/bspwm.git
cd bspwm

2. Pull the upstream master as the upstream branch

The package uses non-standard gbp.conf which says that the upstream branch is named upstream and the debian branch is master (the default is that the upstream is master and debian is debian). The following commands pull the upstream master branch (with the unreleased changed) as the local upstream branch.

git remote add upstream https://github.com/baskerville/bspwm
git fetch upstream master
git checkout upstream/master
git checkout -b upstream

Now we can create a new upstream release and return back to the Debian branch:

git tag 0.9.11
git checkout master

3. Merge upstream changes and create a new Debian release

git merge --no-ff upstream

We use dch -i to create a new Debian release as normal. The version is automatically filled from the tag created earlier.

bspwm (0.9.11-1) unstable; urgency=medium

  * Merge latest upstream changes.

 -- Martin Prokopič <martin@prokopic.net>  Fri, 03 Jan 2025 22:08:29 +0000

Commit the changelog:

git add debian/changelog
git commit -m "Release 0.9.11-1"

Tag the new Debian release:

gbp buildpackage --git-tag-only

4. Install dependencies and build the package

Install the build dependencies

sudo apt build-dep bspwm

Build the package using git-buildpackage:

gbp buildpackage --git-builder=debuild --no-sign

The package is built into the export-dir specified in gpb.conf, in this case it is ../build-area.

I’ve published the merged bspwm repo on my GitHub, where I’ve also uploaded the binary packages as a release (use at your own risk).