Using openSUSE Build Service (OBS)

This is a small article is for programmers who want their application run on different Linux distributions.
OpenSUSE Build Service (OBS) offers such a service where  programmers can compile their applications for various Linux distributions. OBS offers a web client and command line tool.
In this article I only describe how to use the web client to compile a Qt application for some openSUSE versions.
The challenge for this job is to find the right Qt packages and define an appropriate spec file, because unfortunately a standard distribution by default does not deliver all the Qt packages needed for a compilation.

Create a package

The first step is to create a login and a project at OBS.
Done, the next step is to create a package for your application. After creating your package your should see it in the package list in the Overview section. In this example its … Example ūüėČ



Now you can select some repositories i.e. Linux distributions you want to build your application for.  As you can see there a already some repositories activated. This is why these repositories are defined in the 1st Package.

By clicking Add repositories a form appears where you can select and deselect the repositories your application should run on.

If the selected repositories provides all libraries your application needs for a compilation, all is done here.

Add an extra path to the repository

Sometimes a repository does not provide all the libraries needed by your application, in this case you have to add a special path where the build process can find all the libraries needed.

To add a new path to first click on  

A dialog form appears where  you can click   The form for adding an additional path appears. Adding a new path is a little bit tricky, because the root directory for looking for additional path is /repositories/ . For example if you need libraries from Qt5.9 you have put KDE:Qt5.9into the form.  This points to  Repository: is selected automatically. finally you can add the path to the repository.

Modify the .spec file

The next step is to modify the spec file.  In this section I only point to some pitfalls you may trap into if you want to use a remote repository.

A word on meta data tag  Version: this is tricky because you can define a variable %{version} by %define version 1.0.0  or setting the meta tag  Version:   1.0.0in which setting the meta tag is the appropriated way. Then you define your buildroot BuildRoot: %{_tmppath}/%{name}-%{version}-build
This works fine if your .tar.gz file follows the standard syntax myapp-1.0.0.tar.gz

This may not work if you omit a version number in your .tar.gz file or you load your package from a remote repository e.g. from github. In this cases %{version} is set automatically.

This means the build process will overwrite the %{version} variable defined by the Version: tag and this may cause some errors where it’s used: e.g.¬† build path is not found.

So, in this case you leave the tag Version:¬†¬†¬† ¬† empty but don’t leave if out.

If you want to make your package available for multiple distributions you normally have to set some conditions. Especially on openSUSE the distribution numbering is not very consistent so you better have look at this site to checkout how to make it.

Interesting links