Blog - /Tech
Part of my work as an HCoop sysadmin is to make custom Debian packages
which contain some site-specific changes to the standard packages.
After trying an approach on around 10 different packages, I've come up
with a reasonable approach. It is documented at
HCoop Wiki: Debian Packaging. I'm particularly pleased with the git
merge -s ours trick for handling a Debian package with a new upstream
version.
This approach is great for following Debian packages which may or may not be managed with other tools, but it is not optimal for Debian packages that I maintain myself. I took a look at madduck's blog post on the issue of packaging with git for inspiration. I didn't much care for the separate "upstream-repo" repository, the use of the "/" character in branch names, or the mapping of one patch per branch. It seems like overkill to have all of those branches, and their names are way too long.
I do like his idea of doing the build in a separate branch, which is
based on the merging of several other branches. I also like the idea
of separating source patches from the Debian packaging, but I prefer
to place all patches in just one branch. I also prefer to use
git-buildpackage to do the build, though I wish it would not complain
about not being in the "master" branch — there seems to be no point
to that.
My preferred Debian+git packaging scheme is as follows. The
particular Debian package in this example is jde.
There are several different branches involved:
upstream: The pristine upstream sources.patches: The upstream source, with some patches applied. This
branch may be rebased.master: The upstream source, plus the debian/ directory. This
branch may not be rebased.build: This branch should only exist locally. It contains the
current build for this package.Before building for the first time, do the following.
$ mkdir jde ; cd jde $ aptitude install git-buildpackage $ git clone git://git.hcoop.net/git/mwolson/debian/jde.git $ cd jde $ git branch --track upstream origin/upstream $ git branch --track patches origin/patches $ git checkout -b build $ git checkout master
The process for building this package using just these git branches is as follows.
$ git checkout build $ git add . ; git reset --hard patches $ git merge master $ git-buildpackage --git-debian-branch=build
The maintainer will run git-buildpackage --git-tag --git-ignore-new
instead of the last command so that a tag is made representing that
version of the Debian package.
The above has been placed into the header for debian/rules, so that
potential contributors can easily find it.
I modified debian/control to add the following directives, which tell
people where to browse and check out the packaging.
Vcs-Browser: http://git.hcoop.net/?p=mwolson/debian/jde.git Vcs-Git: git://git.hcoop.net/git/mwolson/debian/jde.git
I'm interested in hearing what people think about this scheme.
Posted by Anonymous at Sat Feb 23 09:33:38 2008
Tracking bleeding edge upstream packages and maintaining your own local patches is a serious weak point of Debian packaging. Portage is at least somewhat sane about it. When you mention this issue to Ubuntu or Debian developers all you get is apologists: "Making it difficult is a feature! You need to do everything manually to ensure the new packages are correct." "Why would you want to do that? Why don't you just convince upstream or Debian to incorporate your patches?" "Running bleeding edge packages are going to make your system unstable. Just wait for us to package it." I should be able to fetch from VCS patch build with one command. Portage can do it, it should be possible to do it Debian/Ubuntu.Posted by Michael Olson at Sat Feb 23 12:17:07 2008
Piffle. If you want one command, just make a script.Posted by Anonymous at Sat Feb 23 20:10:19 2008
Aw common. This sort of thing is a standard problem experienced by many people. It shouldn't be necessary and negates collaboration for everyone to solve it themselves. If I argued in favor of package managers you wouldn't tell me to "just write a script" would you? You can't seriously be arguing that a 'standard' tool to do this is worse than everyone writing their own hack-job scripts?Posted by Anonymous at Sat Feb 23 20:14:18 2008
Or was that humor that went over my head?Posted by Michael Olson at Sat Feb 23 20:29:15 2008
Anonymous, I don't care about the way other distros do things in the context of this post. The conversation that I want to join/continue with this post is one about packaging for Debian in ways that involve git. Nothing else.Add a comment