Mailinglist Archive: opensuse-buildservice (116 mails)

< Previous Next >
Re: [opensuse-buildservice] Different spec files for different repositories
On Fri, Aug 15, 2014 at 7:39 AM, Srinidhi B <srinidhi@xxxxxxxxxx> wrote:

On Friday, 15 August, 2014 at 05:06 PM, Jeroen Ooms
<jeroen.ooms@xxxxxxxxxxxxx> wrote:
I would like to build and publish my software for both Fedora and
OpenSuse using OBS. However, the two spec files are slightly
different, because apache2 is called httpd in Fedora, and uses
somewhat different config structure.

Is it possible to use different spec files for different repositories
within a OBS (sub)project/package? Or do I need to create separate
subprojects for each repository, and copy all of the dependencies to
each of the subprojects?


If the specfiles are mostly similar, use %if statements to make the
minor adjustments needed between distros. Here's a couple sample %if

%if 0%{?suse_version} >= 1210
%if 0%{?sles_version} >= 11

If the result is just too messy, then Srindhi's reply is one way to do
it, or you can follow the kernel example.

Look at all the specfiles in

The question is how do they take advantage of all those specfiles.

First the normal specfile naming rule is, for project AAAA the normal
specfile must be named AAAA.spec. If you inadvertently name your
specfile AAAB.spec it won't be seen by the buildsystem and it won't
build a RPM. Thus in the kernel-vanilla package most of those
specfiles are ignored.

But, you can take advantage of that by having 2 linked packages AAAA
and BBBB. Then you have 2 specfiles: AAAA.spec and BBBB.spec. The
package named AAAA will build with specfile AAAA.spec. The package
named BBBB will build with BBBB.spec.

Thus if you look at you will see
that for each specfile there is a separate package with the
corresponding name. Each of those packages uses one of the specfiles
found in kernel-vanilla. All of those packages are linked together so
based on the name of each of the linked packages, OBS uses the
corresponding specfile.

This is the command line sequence used to create a set of linked
kernel packages in your home project

osc linkpac openSUSE:11.3 kernel-source home:$login
for p in kernel-{default,desktop,pae,xen,vanilla,syms}; do
osc linkpac -C copy home:$login kernel-source home:$login $p

From there you can figure out the rest.

To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse-buildservice+owner@xxxxxxxxxxxx

< Previous Next >
Follow Ups