0%{?suse_version} toggles seem not to work as expected

Hey there it’s me again ^^"

I had this issue multiple times now and still do not understand what’s going on.

If have a spec file where I try to toogle a few BuildRequires instructions based on the trageted openSUSE version.


%if 0%{?suse_version} > 150200 && 0%{?is_opensuse} 
BuildRequires:  pkgconf-pkg-config
BuildRequires:  wildmidi-devel
%else
BuildRequires:  pkg-config
%endif

By also checking the openSUSE:Build Service cross distribution howto guideI understand the toggle as follows:

If the package is to be build for any suse version above 15.2 and is it openSUSE (not SLE) than it should include

  • pkgconf-pkg-config
  • wildmidi-devel

As additional build dependencies otherwise it should not do this as well as using pkg-config instead of pkgconf-pkg-config

However if I run the build localy using:

osc build openSUSE_Leap_15.1 x86_64 --clean

I get this output:


Building OpenTESArena.spec for openSUSE_Leap_15.1/x86_64
Getting buildconfig from server and store to /z004/sdd1/user/vortex/Projekte/External/Software/open-build-service/home:VortexAcherontic/OpenTESArena/.osc/_buildconfig-openSUSE_Leap_15.1-x86_64
Getting buildinfo from server and store to /z004/sdd1/user/vortex/Projekte/External/Software/open-build-service/home:VortexAcherontic/OpenTESArena/.osc/_buildinfo-openSUSE_Leap_15.1-x86_64.xml
buildinfo is broken... it says:
unresolvable: nothing provides libWildMidi.so.2()(64bit) needed by OpenTESArena
      nothing provides openal-soft-data needed by OpenTESArena

And I just don’t understand this because this unresolvable error is exactly what I want to circumvent because wildmidi is not available for any Leap release offically.
But also I confuses me that openal-soft-data should not be availabe as well becasue I am 99% sure it is available for Leap otherwise close to zero games would build for Leap.

If this matters my host system is openSUSE Tumbleweed, in case it tries to determine the current openSUSE version by asking the host what he is.

Also I am confused by the amounts of zeros to add to a version number

For all the 13.x releases it is:

  • 1310
  • 1320

While for all 15.x releaes it is suddenly:

  • 150000
  • 150100
  • 150200

And Tumbleweed is everything larger than: 1500 which in my eyes would also apply for 150000 and onwards?
But still the greater than 150200 toggle seems not to work if the targed openSUSE release is 15.2 or 15.1

Furthermore I am confused about the 0%{?is_opensuse} instructions in combination with the rest I would expect this spec file to not use any of the described packages for Tumbleweed
because it IS openSUSE and above 150200 but the %else should only be reach if the current target is neither openSUSE nor any suse version below 150200?

Are these typos or is it used to be this inconsitent or do these toggles just plain not work or is my home repo somehow messed up or maybe some local configs?

Kind regards and thank you for your help :slight_smile:

Hi
It’s to allow synergy with SLE building on OBS. Any E.o.L release may not necessarily follow recent release changes to build macros etc, if you want to build (not sure why) then you would need to craft your own requirements in the project config. https://build.opensuse.org/projects/home:VortexAcherontic/prjconf

Example to confuse you even more: https://build.opensuse.org/projects/openSUSE:Factory/prjconf

Ignore Leap 15.1 as a build target would be my suggestion since it’s dead.

Alright but I don’t get how these changes to the project settings allow for openSUSE version specific build requirements in a single spec file of one specific package?
And how this would make the %if 0%{?suse_version} > 150200 toggles work :confused:

Also I have the same issue with 15.2 btw:


osc build openSUSE_Leap_15.2 x86_64 
Building OpenTESArena.spec for openSUSE_Leap_15.2/x86_64 
Getting buildconfig from server and store to /z004/sdd1/user/vortex/Projekte/External/Software/open-build-service/home:VortexAcherontic/OpenTESArena/.osc/_buildconfig-openSUSE_Leap_15.2-x86_64 
Getting buildinfo from server and store to /z004/sdd1/user/vortex/Projekte/External/Software/open-build-service/home:VortexAcherontic/OpenTESArena/.osc/_buildinfo-openSUSE_Leap_15.2-x86_64.xml 
buildinfo is broken... it says: 
unresolvable: nothing provides libWildMidi.so.2()(64bit) needed by OpenTESArena 
      nothing provides openal-soft-data needed by OpenTESArena

That’s why I want to use:

BuildRequires: pkgconf-pkg-config
BuildRequires: wildmidi-devel

only if it is build for Tumbleweed and just leave it out for anything Leap since the make process will detect the absence of wildmidi and will compile the software without Midi support.

This won’t because this is the wrong macro name. Read link you yourself posted once more carefully, as well as table linked from it: openSUSE:Packaging for Leap - openSUSE Wiki

Ooouh! Now I got it, thanks for telling me to re-read the docs.

I missed the slight difference between suse_version and sle_version and now also the “random” amount of zeroes make a lot more sense.

Now I feel a little bit embarrassed for not noticing this earlier!

Sorry for bothering you guys just because I’m blind :smiley:

Edit: Surprise now it works xD