[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: grouping of alternative depends



Rafael Laboissiere <rafael@debian.org> writes:

> Yes, the formulae are logically equivalent to each other. However, for
> some packages I would like to have (A B) | (C D), meaning ((A and B) or
> (C and D)).  This does not seem to be doable with the current Depends
> syntax.

You just need to do the expansion one more time:

    (A, B) | (C, D)
 -> A | (C D), B | (C D)
 -> A | C, A | D, B | C, B | D

Every expression involving AND / OR can be written in a 'two-level' form

    (A or B or ...) and (X or Y or ..) and ...

Thus, the Depends syntax is completely general, but not very convenient
for complicated expressions.  My feeling is that it is not worth
changing the syntax.  Too many tools depend on it, and complicated
dependencies should be avoided anyway.

Depending on what you want to do, you might create new packages and use
virtual packages to simplify your dependency expressions.  I.e., to
express (A, B) | (C, D), you would create two new packages X and Y where
X depends on A and B, and Y depends on C and D.  Both could provide the
virtual package V, and the original expression is then just "V".

This could give better modularity and better documentation: You make it
explicit that your package depends on 'someone' providing interface V,
and it is up to those interface providers to define what they need.
This is probably better than hard coding it all into a single
complicated dependency expression.


Reply to: