Damn. This doesn’t work. Nor does it work with variations in %post. How in the hell did I do this before:
EDIT: WHERE did I do this. Too many repos. To many commits.
%install
rm -rf %{buildroot}
# >> install pre
# << install pre
%qmake5_install
# >> install post
# << install post
%if "%{sailfishos_version}" > "40200"
cp %{buildroot}%{_datadir}/%{name}/qml/pages/WebViewPage_4.qml \
%{buildroot}%{_datadir}/%{name}/qml/pages/WebViewPage.qml
%else
%endif
Afaik %{sailfishos_version} is only available on OBS and you have to hack it yourself elsewhere, at least I did for quazip on 4.5. But you can always use rpm --eval to test macros and there is also an option to get the demacroed spec but I forgot its name.
Now that you mention, it was on OBS that I was using it (3.4 vs. 4.x python PIL) and have since abandoned it. Hmmm. I’ll see if I can come up with a clean method. Maybe read /etc/sailfish-release in %post
I would implement it in app, but it’s a problem that also applies to code that I’m helping package but don’t maintain.
Ah, so I’ll need two macros then. Or check vendor, then define? EDIT, ummm. You need this at BUILD time. What I’m doing supplies < 4.2 qml version and just swaps it post install so it should work since it’s only required on install?
I prefer doing it at run time e.g. like this or this. Both pieces of code use HarbourSystemInfo for OS/package version detection. That way rpm may remain Harbour compliant (rpm scripts are not allowed in Jolla Store).
And another thing - if you have an rpm script that creates files during installation (not owned by any package) you better think how and when you’re going to delete those. My qrshare plugin was doing this, for example.
These days I think that perhaps it might be a better idea to install a dummy file and overwrite it during (after) the installation - that way it would remain owned by the package.
Of course it would be even better if the OS maintained compatibility between the releases, but that’s apparently is not an option😐
In the case this began with, I simply supply both files. I’m just copying one over the other. For most of these WebViews, there’s not much content. I’m thinking of adding a SilicaWebView compatibility view. But I have to go through all the source I’ve already made backward incompatible (maybe 6/7 apps). I had looked at your library long ago and just got distracted by other tasks. Maybe I can take this as an opportunity to finally go there.
I would also have thought that maintaining SilicaWebView as a wrapper on WebView wouldn’t have been such a big deal. Ah, well.