Thursday, December 27, 2012

A script for supporting multiple Ubuntu releases in a PPA

Something I find time consuming is uploading to a PPA when you want to support multiple Ubuntu releases. For my projects I generally want to support the most recent LTS release, the current stable release and the current development release (precise, quantal and raring when this was written).

I have my program in a branch and release that with make distcheck and lp-project-upload. The packaging is stored in another branch.

For each release I update the packaging with dch -i and add a new entry, e.g.

myproject (0.1.5-0ubuntu1) precise; urgency=low

  * New upstream release:
    - New exciting stuff

 -- Me <>  Thu, 27 Dec 2012 16:52:22 +1300

I then run and this generates three source packages and uploads them to the PPA:

RELEASES="raring quantal precise"

VERSION=`head -1 debian/changelog | grep -o '[0-9.]*' | head -1`
ORIG_RELEASE=`head -1 debian/changelog | sed 's/.*) \(.*\);.*/\1/'`
  cp debian/changelog debian/changelog.backup
  sed -i "s/${ORIG_RELEASE}/${RELEASE}/;s/0ubuntu1/0ubuntu1~${RELEASE}1/" debian/changelog
  bzr-buildpackage -S -- -sa
  dput ${PPA} ../${NAME}_${VERSION}-0ubuntu1~${RELEASE}1_source.changes
  mv debian/changelog.backup debian/changelog

Hope this is useful for someone!

Note I don't use source recipes as I want just a single package uploaded for each release.


Anonymous said...

Wouldn't backportpackage be suited better ?

Anonymous said...

Why not backportpackage ?

Anonymous said...

You could use backportpackage to distribute one source package to multiple Ubuntu releases in one PPA.

Dmitrijs said...

How is this different from a recipes? Or from running $ bzr daily-deb which can generate source packages locally for you?
(with recipes one should merge original tarball into the branch, locally just place it in the same dir if you want one pristine tarball)

Robert Ancell said...

Looks like backportpackage would do the job too.