Add %sailfishos and %sailfishos_version to development environment

As we can develop our applications in cross-platform way to accommodate different Linux distributions, it would be helpful to have few macros defined that could be used in RPM SPEC. In line with other RPM-based distros, such as Fedora and Suse, please add

  • %sailfishos equal to 1 or some other non-zero value
  • %sailfishos_version equal to the corresponding SFOS version: 3.4.0.24 for the latest

Please make them available in downloadable SDK and OBS.

This will make it possible to check whether the build is running for SFOS and its version.

14 Likes

Piggybacking on this, as a more general approach, support the %{dist}/%{?dist} macros and conditionals which is already well defined and widely used.

https://docs.fedoraproject.org/en-US/packaging-guidelines/DistTag/

1 Like

There is %{_vendor} macro that has value “meego” for Sailfish OS, and for version there is version command.

%if "%{?_vendor}" == "meego"
%global sailfishos 1
%global sailfishos_version %(version | awk '{print $3}')
%endif

Kind of hacky, but it works.

3 Likes

“hacky” is a good word. Also, I would expect that will all these changes that “have to be done”, meego will disappear. While it would work, I would prefer to keep app SPEC clean from such macro definitions.

2 Likes

As some dependencies change with SFOS releases, having %sailfishos with the version info is requirement to support different SFOS versions in the software. Recent example:

pkgconfig(libsystemd-daemon)

was available before, not in SFOS 4.0 where it is replaced with

pkgconfig(libsystemd)

If I would have access to version info from RPM SPEC, it would be simple to adjust the dependencies accordingly. Now, not sure how to implement it now.

5 Likes

To determine the SFOS version, I used the “org.nemomobile.systemsettings 1.0” module
It also uses /usr/share/jolla-settings/pages/about/about.qml
But when posting the application to harbor.jolla.com got a rejection:

App rejected

… Unfortunately your update did not pass the StoreQA tests because of the following reason.

  1. RPM-validation has error:

QML files

ERROR [/usr/share/harbour-…/qml/harbour-…qml] Import ‘org.nemomobile.systemsettings 1.0’ is not allowed
INFO [harbour-…] Please see our FAQ here: FAQ
FAILED

Is there another way to find out the SFOS version?

/etc/sailfish-release seems to contain the data you are after.

2 Likes

I use QSysInfo::productVersion() does the job

Full function:

QString QMLUtils::getOSVersion(){QString str = QSysInfo::productVersion().remove(3, 8);return str;}

To trim it down to a simple 3.4, 4.0 ect

2 Likes