On Tue, Apr 25, 2017 at 4:30 AM, Dave Plater dplater.list@gmail.com wrote:
OOC, is there any reliable way outside RPM to get access to the version that RPM would use? Something other than /etc/os-release?
Apart from macros under /etc/rpm and /usr/lib/rpm there's nothing AFAIK.
As in
$ grep suse_version /usr/lib/rpm/suse_macros %suse_version 1315
But be very careful with it too. 1315 is for Leap 42.1. 1320 was openSUSE 13.2
spec file logic can be quite convoluted due to one-off decisions in setting the macros.
openSUSE - the pathological distro. Can't decide if it is coming or going!
As I read Richard's comments: === We screwed up the rpm macros for packagers when we released Leap. But it doesn't seem fair to keep that pain for only the packagers, so we are going to do a back jump for non-packagers as well. ===
You have suse_version, sle_version, and leap_version. To figure out what release you are in, you have to know which one to check:
openSUSE Factory %if 0%{?suse_version} > 1320 openSUSE Leap 42.3 %if 0%{?leap_version} == 420300 openSUSE Leap 42.2 %if 0%{?leap_version} == 420200 openSUSE Leap 42.1 %if 0%{?sle_version} == 120100 openSUSE Leap 42.x %if 0%{?suse_version} == 1315 openSUSE 13.2 %if 0%{?suse_version} == 1320 openSUSE 13.1 %if 0%{?suse_version} == 1310
fyi: the logic was pretty sane before Leap came out
Greg