obs-build icon indicating copy to clipboard operation
obs-build copied to clipboard

kiwi-packagemanager:zypper in image deps unnecessary

Open Vogtinator opened this issue 4 years ago • 10 comments

Currently, every kiwi build in OBS includes kiwi-packagemanager:zypper (or whatever you use as package manager) in its image deps: https://github.com/openSUSE/obs-build/blob/7ec117e1cdc73fb5f55f2871a250c22a9de6d800/Build/Kiwi.pm#L449

This is not necessary though, as the used packagemanager has to be mentioned explicitly in the image configuration's <packages type="bootstrap"/> section if necessary.

Only for sysdeps this is needed, as kiwi runs zypper --root ... natively for bootstrapping.

Vogtinator avatar May 06 '20 10:05 Vogtinator

kiwi-image:docker is also unnecessary in image deps. In fact, image deps should only be the explicitly listed packages.

Vogtinator avatar May 06 '20 10:05 Vogtinator

This is not necessary though, as the used packagemanager has to be mentioned explicitly in the image configuration's section if necessary.

Actually, that's not fully true, kiwi does that automatically if there is a relevant non-empty <packages type="image"/> section: https://github.com/OSInside/kiwi/blob/816ddb950f327b55ebf74222a14b36ad98f4d4ce/kiwi/xml_state.py#L399

OBS needs to do the same check here.

Vogtinator avatar Aug 20 '20 11:08 Vogtinator

But doesn't kiwi always use the package manager from the image if it needs to install packages (except for bootstrapping, of course)? I.e. do we have images where this is not the case?

mlschroe avatar Nov 19 '20 14:11 mlschroe

But doesn't kiwi always use the package manager from the image if it needs to install packages (except for bootstrapping, of course)?

Yes.

I.e. do we have images where this is not the case?

You mean images where e.g. zypper.rpm isn't needed? There are container images which don't have any package manager installed (and thus also don't have any <packages type="image"/>), e.g. https://build.opensuse.org/package/show/openSUSE:Factory/tumbleweed-busybox-image and images derived from that, e.g. https://build.opensuse.org/package/view_file/openSUSE:Factory/opensuse-bind-image/opensuse-bind-image.kiwi

Vogtinator avatar Nov 19 '20 15:11 Vogtinator

But those images also do not define a packagemanager in the kiwi xml, right?

mlschroe avatar Nov 25 '20 10:11 mlschroe

The attribute is mandatory (IIRC) and also used for bootstrapping. So kiwi-packagemanager:$packagemanager is always needed for sysdeps. About image deps I wasn't actually not sure, so I did a quick test:

  <packages type="image">
    <package name="nano"/>
  </packages>
  <!-- no bootstrap -->

This failed with zypper: command not found, as it wasn't explicitly installed.

~~Explicitly adding an empty bootstrap section didn't work either. So it seems like the recipe is responsible for listing the package manager here, which means that kiwi-packagemanager:$packagemanager has to be in sysdeps, but is never needed in image deps.~~

This actually seems to be weird behaviour or a bug on the kiwi side. https://github.com/openSUSE/obs-build/issues/562#issuecomment-677540621 is correct, but it needs a non-empty bootstrap section, e.g.

  <packages type="image">
    <package name="nano"/>
  </packages>
  <packages type="bootstrap">
    <package name="nano"/>
  </packages>

This installs nano zypper for bootstrap.

So for image deps the conclusion is that kiwi-packagemanager:$packagemanager is only needed if there are <packages type="image"/>.

Vogtinator avatar Nov 25 '20 10:11 Vogtinator

Ping - this is the only missing piece for openSUSE:Factory to switch over to ExpandFlags: kiwi-nobasepackages.

Vogtinator avatar Jan 25 '21 13:01 Vogtinator

Ping - this is the only missing piece for openSUSE:Factory to switch over to ExpandFlags: kiwi-nobasepackages.

FTR, openSUSE:Factory switched over to kiwi-nobasepackages. While this bug here still needs a workaround, it actually required less than not using kiwi-nobasepackages did before...

Vogtinator avatar Feb 01 '21 11:02 Vogtinator

This issue can be closed now or is there something else to do?

AdamMajer avatar Aug 23 '22 21:08 AdamMajer

https://github.com/openSUSE/obs-build/issues/562#issuecomment-733614726 isn't implemented yet.

Vogtinator avatar Aug 24 '22 06:08 Vogtinator