yast / yast-packager

YaST module packager
http://en.opensuse.org/Portal:YaST
GNU General Public License v2.0
7 stars 22 forks source link

Don't rely on /etc/install.inf being available [master] #615

Closed shundhammer closed 2 years ago

shundhammer commented 2 years ago

This merges both #613 and #614 to master.

Merge of #613

Bugzilla

https://bugzilla.suse.com/show_bug.cgi?id=1198560

Trello

https://trello.com/c/AXWDv2jh/

Problem

When migrating from Leap 15.4 to SLE-15 SP4 on the installed system, YaST crashes with an exception "The installation URL is not set" in https://github.com/yast/yast-packager/blob/master/src/lib/y2packager/installation_medium.rb#L48-L50 .

Cause

It tried to read /etc/install.inf (the config file that linuxrc writes for YaST to consume) to check if the installation media has several products or just one. But in this scenario, the migration started from the installed system, not from an inst-sys on installation media; so there was no /etc/install.inf.

Fix

Check if there is an install.inf; more precisely, if any data from that could be read, i.e. if there was any content at all from such a file.

If there is none, read the products from libzypp: In this scenario, the old repos from the system that we want to migrate away from were just removed, and the ones from the new one (that we want to migrate to) were added. Those repos are what we need here.

Notice that in this scenario it does not make sense to read a repo URL from a control.xml file: While there is one in /etc/YaST2/control.xml, that is not the default path on installation media, so it won't be found; and, worse, that file contains the URL of the old repo, the system that we are migrating away from.

Related PR

PR for master: #613 (the same for SLE-15-SP4)

yast-bot commented 2 years ago

:heavy_check_mark: Public Jenkins job #188 successfully finished :heavy_check_mark: Created OBS submit request #973223

coveralls commented 2 years ago

Coverage Status

Coverage increased (+0.02%) to 36.827% when pulling 574d2ffd350fd4d3f5bfac4141a5792d92cf22df on huha-install-inf-master into fb65bf8549241eb6f4be57d54bc7f7598a088158 on master.