Different spec files for different repositories

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Different spec files for different repositories

Jeroen Ooms
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?
--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Different spec files for different repositories

Srinidhi B
Hi,

>>> On Friday, 15 August, 2014    at 05:06 PM, Jeroen Ooms
<[hidden email]> 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?

http://en.opensuse.org/openSUSE:Build_Service_Tips_and_Tricks#Using_different_spec_files_for_different_platforms

HTH,
Srinidhi.

--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Different spec files for different repositories

gregfreemyer
On Fri, Aug 15, 2014 at 7:39 AM, Srinidhi B <[hidden email]> wrote:

> Hi,
>
>>>> On Friday, 15 August, 2014    at 05:06 PM, Jeroen Ooms
> <[hidden email]> 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?
>
> http://en.opensuse.org/openSUSE:Build_Service_Tips_and_Tricks#Using_different_spec_files_for_different_platforms
>
> HTH,
> Srinidhi.

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

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

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
https://build.opensuse.org/package/show/Kernel:stable/kernel-vanilla

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
https://build.opensuse.org/project/show/Kernel:stable 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
done

From there you can figure out the rest.

Greg
--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Different spec files for different repositories

Jeroen Ooms
On Fri, Aug 15, 2014 at 3:51 PM, Greg Freemyer <[hidden email]> wrote:
>> http://en.opensuse.org/openSUSE:Build_Service_Tips_and_Tricks#Using_different_spec_files_for_different_platforms
>>
> If the specfiles are mostly similar, use %if statements to make the
> minor adjustments needed between distros.  Here's a couple sample %if
> statements.

Thanks both, this was very helpful. I started with renaming some spec
files which seems like the easiest approach for now. Perhaps I'll try
to see if I can merge some of the spec files into a unified one in a
next iteration.
--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]