openSUSE / obs-build

OBS build script, can be used with OBS or stand alone
GNU General Public License v2.0
132 stars 184 forks source link

kiwi-packagemanager:zypper in image deps unnecessary #562

Open Vogtinator opened 4 years ago

Vogtinator commented 4 years ago

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 commented 4 years ago

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

Vogtinator commented 4 years ago

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.

mlschroe commented 3 years ago

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?

Vogtinator commented 3 years ago

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

mlschroe commented 3 years ago

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

Vogtinator commented 3 years ago

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 commented 3 years ago

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

Vogtinator commented 3 years ago

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...

AdamMajer commented 2 years ago

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

Vogtinator commented 2 years ago

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