[7972] in athena10
dh_ifexists: depend on a package iff it exists
daemon@ATHENA.MIT.EDU (Geoffrey Thomas)
Fri Jul 29 08:53:09 2011
Date: Fri, 29 Jul 2011 08:53:00 -0400 (EDT)
From: Geoffrey Thomas <geofft@MIT.EDU>
To: debathena@mit.edu
Message-ID: <alpine.DEB.2.00.1107290838520.9414@tyger.mit.edu>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII
I'd like some initial review/feedback for dh_ifexists, which takes
debian/control fields of the form Depends-If-Exists: foo, bar, and adds
foo and bar to ${misc:Depends} (and thus the Depends: field) if it's
available in the current apt cache.
This can simplify a lot of the logic in our metapackages, both stuff like
thirdparty (where we have release-specific dependencies) and the
debathena-maybe-* packages. I'm curious if this is useful as is, or we
want different syntax. Evan and I once discussed something way more
expressive, I believe involving putting aptitude search patterns as
dependencies or something similarly awesome, but that seems overkill. We
may, however, want the ability to do dependencies specific to a distro, or
some other condition than simply whether the dependency is satisfiable.
However, I think we can replace most of the ugliness in our packages with
just this much.
In order to use it, you add the appropriate Foo-If-Exists: lines to
debian/control, make sure that you have Foo: ${misc:Foo} also in
debian/control. Then you make sure dh_ifexists gets called. If using
CDBS, add to debian/rules
include /usr/share/cdbs/1/rules/ifexists.mk
If using Debhelper 7 pass "--with=ifexists" to dh, and if using
older Debhelper call dh_ifexists somewhere before dh_gencontrol.
It's available in git:
git clone /mit/geofft/debathena/dh-ifexists.git
There's also a checkout at /mit/geofft/debathena/dh-ifexists that you can
browse.
I'm planning on sending this upstream (either getting this sponsored into
Debian, or incorporated into Debhelper itself), but there's no reason we
can't build this for all our releases and use it immediately if we're
happy with it.
--
Geoffrey Thomas
geofft@mit.edu