[Rpm-ecosystem] Rich deps syntax finalization
Neal Gompa
ngompa13 at gmail.com
Tue Aug 25 16:58:07 UTC 2015
On Tue, Aug 25, 2015 at 12:01 PM, Florian Festi <ffesti at redhat.com> wrote:
> On 08/25/2015 05:54 PM, Pavel Odvody wrote:
> >> Technically a NOT operator should not be needed. So we are basically
> >> looking for real life examples where it would be really handy or even a
> >> pain if it was missing. What would you do with a NOT operator?
> >>
> >
> > Requires: (PkgA AND (PkgB IF NOT PkgC)
>
> > But I'm really not sure whether it isn't just easier (correct) to handle
> > this through conflicts / virtual provide.
>
> Well, as Requires are (logically) all connected with an AND this is
> equivalent to:
>
> Requires: PkgA
> Requires: (PkgB IF NOT PkgC)
>
> And as IF is equivalent to OR NOT this is equivalent to
>
> Requires: PkgA
> Requires: (PkgB OR PkgC)
>
> That's why I am interested in *real world* examples where we can at
> least argue that writing it in a given way is more clear and the one
> without using NOT.
>
> >> [2] We are talking about Boolean operators here - not if statements.
> >> Those variants are identical to the forward and backward implication
> >> which are identical to (NOT . OR .) and (. OR NOT .)
>
>
> Florian
>
> --
>
> Red Hat GmbH, http://www.de.redhat.com/ Registered seat: Grasbrunn,
> Commercial register: Amtsgericht Muenchen, HRB 153243,
> Managing Directors: Charles Cachera, Michael Cunningham, Michael
> O'Neill, Charles Peters
>
From my point of view, I prefer the expressive syntax (IF, ELSE, THEN,
OR, AND, NOT), though I'm not sure if making it case sensitive really
helps anything. Because they have to be grouped in parenthesis anyway, I
don't think the enforced all-caps is really necessary. That said, as a
C/C++, Java, and now Python programmer, I feel quite at home with boolean
logic symbols ( "||", "&&", "!") . I really don't think it would hurt
anything if we supported both kinds.
I consider the NOT evaluation to be useful for intent more than anything
else.
For example: "Requires: (pkgA IF NOT pkgB)" or "Requires: (IF NOT pkgB THEN
pkgA)"
That lines says two things to me:
- The package prefers pkgB over pkgA
- Either option works (functionally an OR operation)
This could be handy for declaring priority of dependencies based on what
functionality it provides.
For a more concrete example, suppose I have a package that has a runtime
dependency on a kmod package. However, the kmod package is available in
several forms (akmod, dkms, and finally kmod). I could set up something
like this:
"Requires: (IF NOT (IF NOT module-kmod THEN module-akmod) THEN
module-dkms)"
If read with the intent given, then that means that if module-kmod isn't
installable, then use module-akmod. If that's not installable, then use
module-dkms.
Or maybe I'm misreading how this would work, but that's how I interpret it.
--
真実はいつも一つ!/ Always, there's only one truth!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-ecosystem/attachments/20150825/19d9237e/attachment.html>
More information about the Rpm-ecosystem
mailing list