Backporting and git-buildpackage

For working with Debian packages, one method of maintaining them is to put them in git and use git-buildpackage to build them right out of the git repository.  There are a few pitfalls with it, notably around if you forget to import the upstream you get this strange treeish related error which still throws me at first when I see it.

Part of maintaining packages is to be able to fix security bugs in older versions of them that are found in stable and even sometimes old stable (jessie and wheezy respectively at the time of writing).  At first I used to do this outside git because to me there wasn’t a clear way of doing it within it.  This is not too satisfactory because it means you lose the benefits of using git in the first place, and for distributions you are more likely to need collaboration with, such as working with the security team or help with backporting.

So because I don’t think the details are easily found and also I’ll probably lose them again and need a central spot to find what I did last time.

Building the environment

The first step for a new distribution is to create the building environment.  You really only need to do this once when there is a new distribution with then possibly some updates from time to time. The command will create the environment in /var/cache/pbuilder/base-DIST.cow/

DIST=wheezy git-pbuilder create

You will find all the files in /var/cache/pbuilder/base-wheezy.cow/ which is then ready to do be used.

For more information about this useful tool, look at the git-builder entry on the Debian wiki.

Creating the branch

The master branch is generally where sid will located. For the other distributions, I use branches. For the initial setup you will need to create the branch and start it off from the right point.  For example, the last non-security update for wordpress in jessie was version 4.1+dfsg-1.  We then want the jessie branch to start from this point.

git branch jessie debian/4.1+dfsg-1
git checkout jessie

This will then create and put you on the jessie branch. You only need the first line once. You can switch between sid (master branch) and jessie (jessie branch).

At this point you have a working place to make all the updates you need to do. Nothing is terribly different from the usual workflow.

Building the package

Make sure you have checked in all your changes and now it is time to build your package!

git-buildpackage --git-pbuilder --git-dist=jessie --git-debian-branch=jessie

You may need two additional flags:

  • -sa Use this for the first security update so there is also the source included on the security servers.
  • –git-tag Once you are sure this is the latest changes for this version this will tag in git with the debian tag, such as debian/4.1+dfsg-1+deb8u1

 

Comments

6 responses to “Backporting and git-buildpackage”

  1. Carsten Avatar
    Carsten

    There are some (hopefully) useful information within the Debian Wiki for git-pbuilder.
    https://wiki.debian.org/git-pbuilder

    1. Craig Avatar

      That link (which I should have referenced, sorry) is where I got the git-pbuilder component from. It is a good reference when you need to go beyond the workflow I described. I have added a link to it. The problem is that there wasn’t to me a complete description of how the various tools (and there are options for each step) all work together.

Leave a Reply

Your email address will not be published. Required fields are marked *