I am writing a script that installs some packages and does some configuration work. I want the script to install a specific major version of a package, but I do not care which minor version of the package it is.
More to the point, I want it to install the latest 2.y.z release of the package, but not 1.y.z or 3.y.z (or any other major version number).
I have tried (without success)
zypper install 'mypackage=2'
zypper install 'mypackage>1<3'
zypper install 'mypackage>1' 'mypackage<3'
zypper install 'mypackage>=2.0.0' 'mypackage<3.0.0'
The last one seems promising, because then zypper complains:
'mypackage>=2.0.0' not found in package names. Trying capabilities. No provider of 'mypackage >= 2.0.0' found.
However, after that message, it still proceeds with installing mypackage-1.5.0, because that satisfies the second package-edition specified.