Simplifying dput.cf for multiple PPAs
If you’ve ever contributed to a Debian-based distribution or used the neat Launchpad PPA services then you’ve probably used dput before. We use dput to upload packages to a Debian repository such as the Debian Archive, Ubuntu Archive, or personal archives such as a Personal Package Archive on Launchpad. Getting the hard work you’ve done to the archive for the whole world to enjoy is an important part of a packager’s work flow and should be easy as possible. This is probably why dput is so popular – it does its job and stays out of the way.
However, recently while adding support to dput for uploading packages via sftp, I realized that one’s dput configuration file can get rather lengthy and messy. Being the Lazy Engineer (TM) that I am, I decided to fix this problem. What I noticed was that you needed to configure an upload target (aka host) for each PPA you might want to upload to but all the configuration stanzas for PPAs were exactly the same except for a part of the path. In fact, it seemed like a number of the stanzas for other archives in my dput configuration file were the same except for the same spot. Wouldn’t it be nice if I could just have a single configuration stanzas for these cases and only need to supply an argument for dput to automagically do the right thing? I thought so which is why I’ve added a new feature to dput that allows you to have an upload target “template” where you can pass a single argument to the target specified that will be used to fill in the missing pieces.
So, instead of having a .dput.cf file in your home directory that looks like the following:
[my-ppa]
fqdn = upload.launchpad.net
method = ftp
incoming = ~cody-somerville/ppa/ubuntu
login = anonymous[xubuntu-ppa]
fqdn = upload.launchpad.net
method = ftp
incoming = ~xubuntu-dev/ppa/ubuntu
login = anonymous….
I can simply have the following:
[ppa]
fqdn = upload.launchpad.net
method = ftp
incoming = ~%(ppa)s/ubuntu
login = anonymous
To upload to my PPA now, I’d type: dput ppa:cody-somerville/ppa <changesfile>
To upload to the Xubuntu Developers’ ppa, I’d type: dput ppa:xubuntu-dev/ppa <changesfile>
Once Launchpad supports multiple PPAs per user or team, simply replace “ppa” with
the name of the PPA. If you’re lazy, you can modify your .dput.cf to have the
ppa part automatically entered for you until then.
Anyhow, I hope you enjoy. Cheers!
February 10th, 2009 at 10:34 am
Nice work Cody!
February 11th, 2009 at 5:18 pm
Cool. Will this be in the default dput.cf in Jaunty?
February 11th, 2009 at 6:12 pm
It is yup! 🙂
April 3rd, 2009 at 1:15 am
Thanks, this looks great! I didn’t seem to have a .dput.cf by default in Jaunty but I created one and put it there.
May 27th, 2013 at 10:40 pm
[…] Somerville gave a good summary of the problem: “We use dput to upload packages to a Debian repository such as the Debian […]