Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm looking for the best way to maintain a patched version of an upstream ubuntu package. Here's the situation:

We have our own server running reprepro, which would host the modified package. Our other packages are managed using git and the git packaging tools (git-dch, git-buildpackage).

I have the .diff file that contains the patch to the upstream source, which I've applied before by doing apt-get source pkgname, applying it and running debuild. I'd like to track it properly this time using git.

What's the best process for managing this?

share|improve this question
You'd probably get more answers somewhere else... maybe or – Flimzy Jun 18 '11 at 11:32
up vote 2 down vote accepted

I'd suggest something a little different than Flimzy. Take a look at git-import-dsc and possibly git-debimport. They will auto-magically create separate upstream, debian, and prinstine-tar branches from at Debian source package. You could then create your own branch for your patch set. Each time a new upload to Ubuntu is made, you can just run git-import-dsc on the new package and merge with your branch.

Even simpler would be to use bzr if you are not wed to git. Each Ubuntu package can also be found in a bzr branch. bzr branch ubuntu:$PACKAGE_NAME will grab the source branch for you. Make your changes and commit. Then when ever a new Ubuntu upload is made, you can simply run bzr merge-package ubuntu:$PACKAGE_NAME

share|improve this answer

I hope I'm understanding your question fully...

Here's how I do it:

  1. Place the *.orig.tar.gz *.diff.gz and *.dsc files in a directory aptly named for your package
  2. Unpack the source (dpkg-source -x *.dsc). You'll now have three files and one sub-directory
  3. Commit this to your RCS (commit A)
  4. Apply your changes, and commit to your RCS (Commit B)
  5. Make any future changes, and commit (Commit N)

When a new upstream version comes out:

  1. Create a diff between Commit A and Commit N
  2. Repeat steps 1-3 above
  3. Apply your diff (created in step 1), and commit (new Commit A)
  4. Make any future changes and commit (Commit N)

Rinse, repeat.

share|improve this answer
Hm, that seems reasonable. I'll give that a try. – Daenyth Jun 18 '11 at 12:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.