openSUSE / open-build-service

Build and distribute Linux packages from sources in an automatic, consistent and reproducible way #obs
https://openbuildservice.org
GNU General Public License v2.0
901 stars 437 forks source link

Mulitple spec files & _multibuild flavors #8847

Open DimStar77 opened 4 years ago

DimStar77 commented 4 years ago

Recently, openSUSE:Factory changed the 'policy' to allow multiple spec files AND a _multibuild in one package (as often asked for), so we started testing what we can achieve with that

Somehow, this does not do what I as a user would expect. I have a demo setup at

https://build.opensuse.org/package/show/home:dimstar:Factory/a

There is a.spec, a-foo.spec and a _multibuild

_multbuild contains:

<multibuild>
  <flavor>BAR</flavor>
  <flavor>a-foo.spec</flavor>
</multibuild>

in discussions, it was not clear what the expectation actually should be, but the result in OBS clearly did not match any. OBS builds out of this:

the package a, based on a.spec The package a-foo, based on a-foo.spec

The flavor 'BAR' is added to the scheduler as a:BAR - but excluded

By discussing, we came to the following variants of expectaions what should happen:

hennevogel commented 4 years ago

a is the package container (the object in the OBS). Inside this container you can have a _multibuild file that will tell the OBS to look for additional build descriptions to a.spec.

So in your case it looks for

When we display this _multibuild setup we prepend the container name (a:) to show to which package container this belongs to. BAR.spec is excluded because the build description is not found.

¹ In the a-foo case it might be a bit too clever and should actually barf (because there is no a-foo.spec.spec)...

DimStar77 commented 4 years ago

But if I only have one spec file plus a _multibuild, then it replaces @BUILD_FLAVOR@ inside the .spec file (see installation-images and many others)

hennevogel commented 4 years ago

News to me :wink: @mlschroe?

coolo commented 4 years ago

see https://build.opensuse.org/package/show/openSUSE:Factory/installation-images vs https://build.opensuse.org/package/show/openSUSE:Factory/000release-packages

StefanBruens commented 4 years ago

As far as I can see, @BUILD_FLAVOR@ is always substituted.

One can either use multple spec files (where the spec file name is the same as the flavor), or one spec file, where the spec file has to match the package/container name.

Two minimal examples for the cases above: https://build.opensuse.org/package/show/home:StefanBruens:multibuild_example/multispec https://build.opensuse.org/package/show/home:StefanBruens:multibuild_example/singlespec

A combination of both seems to be not possible, it behaves like in the "multiple spec files" case: https://build.opensuse.org/package/show/home:StefanBruens:multibuild_example/mixed

lnussel commented 4 years ago

The _multibuild file actually has two tags, "flavor" and "package". Maybe meanting of the two needs to be separated. Ie "package" acting like a local link, while "flavor" should use @BUILD_FLAVOR@ to build the same spec several times.

adrianschroeter commented 4 years ago

package is just obsolete, flavor is the successor, but package is there for backward compability.

adrianschroeter commented 1 year ago

not sure what exactly is open here, but

1) @BUILD_FLAVOR@ is always replaced 2) with a single build description file inside, this one is always used for all flavor builds. 3) if you have multiple build descriptions (a.spec and b.spec) they are used depending on the falvor name. If you have also defined a "c" flavor, but no "c.spec" that one gets no build.

All of that should be documented here: https://openbuildservice.org/help/manuals/obs-user-guide/cha.obs.multibuild.html

any open question here?

hramrach commented 6 months ago

package is just obsolete, flavor is the successor, but package is there for backward compability.

'obosolete' yet promoted as the way to implement mutibuild in place of package links