[pacman-dev] Alternative dependencies.

Nagy Gabor ngaba at bibl.u-szeged.hu
Fri Dec 10 12:51:41 EST 2010

> Hi,
> Would it be possible to implement support for alternative dependencies, e.g. a
> package that could use either wget or curl to handle downloads?
> I'm not asking for this to be implemented. I'm just asking whether there are
> any technical limitations to such an approach.
> I know that "provides" can be used to do this, e.g. openjdk6 and jre both
> provide java-runtime to satisfy that dependency in other packages. The approach
> is limited though. Using the example above, we couldn't simply add
> "provides=('download-client')" to both curl and wget because they are not
> interchangeable.
> The basic usage case is when an application is capable of detecting any one of
> a number of different external apps that it can use to satisfy a given
> dependency. There is currently no way to depend on "at least one" of those.
> I can imagine a very simple syntax for this too, e.g. "depends=('curl ||
> wget')" so the question is whether the dependency-handling mechanism could be
> adapted to check for alternatives. If none are found, it could probably use the
> upcoming "provides" selection dialogue to allow the user to choose the desired
> dependency.
> So, would that be possible?
> Also, would that be acceptable?
> Again, I'm not asking anyone to do this. I'm just inquiring about the
> possibility.

Well, I am not against it neither. In fact, your concept is identical to
"provides" imho, with one important difference: With provides, the
dependency packages also must be modified (in your example: curl and
wget by adding provides=download-client [*]), which simply doesn't work
always (see AUR packages, for example). With alternative dependencies,
the packager needn't modify wget or curl, so he gets more freedom. In
addition, less crap is added to sync database (no ugly provisions).

It should be straightforward to implement, if needed. However,
provision-like problems would appear (see the pactests):
How to resolve "curl || wget" in resolvedeps? Pick one
"satisfier"-package randomly, select the first one, ask user etc.? 


[*] Btw, download-client provision is acceptable imho (if alternative
dependencies won't be implemented).

More information about the pacman-dev mailing list