teemtee / fmf

Flexible Metadata Format
GNU General Public License v2.0
22 stars 28 forks source link

Skipping axes with CannotDecide makes boolean operations act nothing like boolean operations. #117

Closed t184256 closed 3 years ago

t184256 commented 3 years ago
>>> fmf.context.Context(package='pkg-1').matches('package <= pkg-2')
True
>>> fmf.context.Context(distro='fedora-33').matches('distro <= centos-7.7')
...
fmf.context.CannotDecide
>>> fmf.context.Context(package='pkg-1', distro='fedora-33').matches('package < pkg-2 and distro <= centos-7.7')
True

This is documented:

Expression skipping When a dimension or outcome of the operation is not defined, the expression is skipped over.

But it's absolutely counterintuitive.

Consequential weird things:

Counter-proposal:

CannotDecide and True = True and CannotDecide = CannotDecide CannotDecide and False = False and CannotDecide = False CannotDecide or True = True or CannotDecide = True CannotDecide or False = False or CannotDecide = CannotDecide

t184256 commented 3 years ago

Rationale for the counterproposal:

jscotka commented 3 years ago

HI, I can imagine, also some command line option what will do some tweaking of some default values.

I can imagine, some fallback syntax, eg. when you will have e.g. filter: X and Y or Z, I can imagine some syntax like

What will add very powerful tooling. and will be nice

lukaszachy commented 3 years ago

@jscotka Thanks for the idea, lets discuss it there and leave this issue just for CannotDecide problem