[8329] in athena10
[RFC] dh_ifexists: support for Depends-If-Exists
daemon@ATHENA.MIT.EDU (Geoffrey Thomas)
Thu Aug 25 03:59:20 2011
Date: Thu, 25 Aug 2011 03:59:10 -0400 (EDT)
From: Geoffrey Thomas <geofft@MIT.EDU>
To: debian-derivatives@lists.debian.org
cc: debathena@mit.edu
Message-ID: <alpine.DEB.2.00.1108250320510.2015@tyger.mit.edu>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII
Hi all,
I'd like some feedback on a Debhelper command I wrote, dh_ifexists, to
parse lines of the form
Depends-If-Exists: foo, bar, baz (>= 2.5)
and add all the satisfiable dependencies in ${misc:Depends}. So, if a
release has foo 1.0-1 and baz 1.0-1 and no bar, then ${misc:Depends} will
expand to just foo.
The intended use case is to allow using the same source package to build
on multiple releases, and depend on packages as appropriate. For instance,
if we want a metapackage to depend on whichever soname of libthing exists
on the current release (because we have non-Debian network-installed
software, compiled for each release, that uses libthing), we could write
Depends-If-Exists: libthing4, libthing5, libthing6
run sbuild once for each upstream Debian or Ubuntu release, and have the
resulting binary packages depend on whichever of those is available.
I figured I'd ask debian-derivatives for feedback on this, since this is
likely to be useful for people who build on top of the other apt
repositories (such as Debian's or Ubuntu's) and useless for packages in
Debian itself. Debathena builds for all supported Debian and Ubuntu
releases, and has so far managed not to need to branch source packages for
multiple releases; I imagine this is not an uncommon desire.
You can get dh-ifexists from my git repo:
git clone git://geofft.mit.edu/dh-ifexists.git
You can also poke around my checkout on the web via
http://web.mit.edu/geofft/debathena/dh-ifexists/
If this looks reasonable, my plan is to see about getting it integrated
into Debhelper upstream. The current packaging inspired by dh-autoreconf.
In order to use it, add Build-Depends: dh-ifexists and the appropriate
Foo-If-Exists: lines to debian/control, and make sure that you have Foo:
${misc:Foo} also in debian/control. (For the common case, you probably
already depend on ${misc:Depends}.) Then make sure dh_ifexists gets
called. If using CDBS, add "include /usr/share/cdbs/1/rules/ifexists.mk"
to debian/rules. If using Debhelper >= 7 pass "--with=ifexists" to dh, and
if using traditional Debhelper call dh_ifexists somewhere before
dh_gencontrol.
--
Geoffrey Thomas
geofft@mit.edu