YaSt when running in a container fails installing the needed packages
The problem is that it uses the repositories configured in the container, not the repositories from the host
Details
It turned out that the problem is in the Pkg.GetSolverFlags call which is called before initializing libzypp. In that case libzypp automatically initializes itself, but it uses by default the system root (/) which is the container. The libzypp initialization later done from YaST does not change anything as libzypp is already initialized.
Also it initialized the libzypp in a wrong order. The libzypp target always needs to be initialized before initializing the libzypp sources. The reason is that the target defines which GPG keys and config file (zypp.conf) are used. When initializing in wrong order you might get GPG signature errors.
Solution
Explicitly initialize libzypp before setting the solver flags
Additionally I added some missing target initialization calls to ensure the target is always properly initialized.
Testing
Tested manually, now running yast2-kdump properly finds and installs the kdump package into the host system
Also manually tested the Available and PackageAvailable calls in the debugger session
Coverage decreased (-0.0008%) to 41.636% when pulling e1b1c7f6eb140ca8a582f019ad348cbd29eb1489 on packages_in_container into 03e8ef6deed3e348cd631622d827234bd94e0c70 on master.
Problem
Details
It turned out that the problem is in the
Pkg.GetSolverFlags
call which is called before initializing libzypp. In that case libzypp automatically initializes itself, but it uses by default the system root (/
) which is the container. The libzypp initialization later done from YaST does not change anything as libzypp is already initialized.Also it initialized the libzypp in a wrong order. The libzypp target always needs to be initialized before initializing the libzypp sources. The reason is that the target defines which GPG keys and config file (
zypp.conf
) are used. When initializing in wrong order you might get GPG signature errors.Solution
Testing
yast2-kdump
properly finds and installs thekdump
package into the host systemAvailable
andPackageAvailable
calls in the debugger session