Bug 1090193

Summary: yast online repo module does not support $releasever
Product: [openSUSE] openSUSE Distribution Reporter: Ludwig Nussel <lnussel>
Component: YaST2Assignee: Josef Reidinger <jreidinger>
Status: RESOLVED FIXED QA Contact: Jiri Srain <jsrain>
Severity: Normal    
Priority: P2 - High CC: igonzalezsosa, jreidinger, lslezak, ma, zypp-maintainers
Version: Leap 15.1   
Target Milestone: ---   
Hardware: Other   
OS: Other   
URL: https://trello.com/c/C9qg20xz
Whiteboard: https://openqa.opensuse.org/tests/658685/modules/upgrade_select_opensuse/steps/9
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Ludwig Nussel 2018-04-19 09:55:25 UTC
## Observation

openQA test in scenario opensuse-15.0-DVD-x86_64-update_Leap_42.2_cryptlvm@uefi fails in
[upgrade_select_opensuse](https://openqa.opensuse.org/tests/658685/modules/upgrade_select_opensuse/steps/9)

I changed the urls in repo files to include $releasever to simplyfy upgrades. So I also changed the xml file on download.o.o for extra repos. The yast module to add online repos cannot deal with that though apparently. It seems to contact the url with $releasever not expanded.
Comment 1 Ludwig Nussel 2018-04-19 09:56:04 UTC
we need a solution in yast or drop $releasever in repos again
Comment 2 Steffen Winterfeldt 2018-04-19 11:01:52 UTC
Ladislav, please have a look.
Comment 3 Ladislav Slezák 2018-04-19 11:43:56 UTC
We need to expand the URL first, use the expanded URL when adding the repository and then set the original unexpanded URL for the repository.

We already do this in the AutoYaST addons: https://github.com/yast/yast-add-on/blob/abd675fa8b1c0f344fee401630be13d2a450d582/src/clients/add-on_auto.rb#L193-L203
Comment 4 Steffen Winterfeldt 2018-04-19 11:46:23 UTC
Tracking in YaST scrum board.
Comment 5 Lukas Ocilka 2018-04-19 13:40:51 UTC
(In reply to Ladislav Slezák from comment #3)
> We need to expand the URL first, use the expanded URL when adding the
> repository and then set the original unexpanded URL for the repository.

Without an explanation, this rather sounds like a hack. Could you PLS tell us
what is the real reason? We set the unexpanded URL later, so libzypp should
be able to work with it. Isn't this rather a workaround then?
Comment 6 Lukas Ocilka 2018-04-20 13:22:52 UTC
zypp-maintainers: It seems that registering a new repository that contains
$releasever (and freinds) does not work via pkg-bindings, so we always

- Expand the URL to a full path
- Register it
- and THEN we change the URL to non-expanded one

See https://github.com/yast/yast-add-on/blob/abd675fa8b1c0f344fee401630be13d2a450d582/src/clients/add-on_auto.rb#L193-L203

Is this an expected workflow? Do we have a better way?
IMO this rather sounds like a hack (which works BTW, but maybe likely to break
one day).

Please advise.
Comment 7 Michael Andres 2018-04-20 14:16:36 UTC
(In reply to Lukas Ocilka from comment #6)
> Is this an expected workflow? Do we have a better way?

I don't know in detail what AddOnProduct.SetRepoUrlAlias or Pkg.SourceCreate are doing. pkg-bindings have their own source management on top of ZYPP.

It will mainly depend on where and why the unexpanded url is actually needed.

In theory it should be possible for pkg-bindings to place a (raw-)url argument passed to SourceCreate in a zypp::RepoInfo class and let the RepoInfo hand out 'url()' or 'rawUrl()' as needed (i.e. let the RepoInfo do the replacement and no need to exchange the url later).

If AddOnProduct.SetRepoUrlAlias requires an expanded url, you have to check why and whether this can be somehow be changed..


OTOH Pkg.ExpandedUrl uses the zypp::RepoVariablesReplacedUrl class, which is also used by the RepoInfo and which is expected to deliver back a correct value. As long as pkg-bindings don't implement their own replacement, it should be ok. It's just some overhead.
Comment 8 Ladislav Slezák 2018-04-23 13:24:01 UTC
Well, I think the better solution would be fixing Pkg.SourceCreate to do the expansion internally, but I'm not sure about all the consequences it could have.

And it is a bit tricky as we must not forget to store the original unexpanded URL for later.


On the other hand fundamentally changing the behavior of Pkg.SourceCreate just shortly before the release is also not nice :-/
Comment 9 Lukas Ocilka 2018-04-23 13:47:22 UTC
I as a PO would say: Fix the pkg-bindings, it's cleaner

But as TL I say: Fix all occurrences that we know and test them

We can't fix the API now
Comment 10 Ludwig Nussel 2018-04-24 06:45:39 UTC
So is there any chance to get a solution anytime soon? I'm about to remove the beta tags to declare RC. So if this is not solvable I have to remove $releasever from the default repos in the product file again.
Comment 11 Ludwig Nussel 2018-04-26 12:20:09 UTC
skelcd reverting the $releasever use checked in
Comment 12 Lukas Ocilka 2018-04-26 14:07:38 UTC
Imo works on that, so looks like "soon"
Comment 13 Imobach Gonzalez Sosa 2018-04-27 10:31:22 UTC
I've been working on a solution without modifying pkg-bindings. However, it looks like we need to adapt more stuff (like RepositoryProbe and RepositoryAdd) and, to be honest, the solution is basically a workaround. So I feel like I am adding just more technical debt.

After some discussion on IRC with Lukas and Ladislav, and given that the bug is not that urgent (Ludwig reverted the change to use $releasever), we have decided to postpone for SP1.

However, here is the branch with the current fix (some tests are still missing): https://github.com/yast/yast-packager/compare/SLE-15-GA...expand-urls?expand=1.
Comment 14 Ludwig Nussel 2018-08-03 09:34:03 UTC
I want to have this in 15.1 finally. Can you please schedule the work on the proper solution accordingly?
Comment 15 Ludwig Nussel 2018-10-05 10:12:18 UTC
Any ETA?
Comment 16 Lukas Ocilka 2018-10-18 12:02:13 UTC
No ETA till now, but we'll try to plan for it next Monday.
It got off the high-prio radar.
Comment 17 Josef Reidinger 2018-10-31 12:02:55 UTC
first draft of fix https://github.com/yast/yast-pkg-bindings/pull/110
 
I just found during manual testing that it stores repos on system in expanded path which does not look correct, so more adaptation will be needed.
Comment 18 Josef Reidinger 2018-11-01 11:37:50 UTC
OK, in the end two more changes was needed:

https://github.com/yast/yast-installation/pull/754

and

https://github.com/yast/yast-packager/pull/383

I tested it and works for both expanded and non-expanded form.

Just please note that both location of urls have to changed. Online and extra_url.

My testing to get idea is this control.xml:

ftp://neser-vr.suse.cz/control.xml

and these two rpms as online repos:

ftp://neser-vr.suse.cz/openSUSE_Leap_15.0_Servers.xml

ftp://neser-vr.suse.cz/_openSUSE_Leap_15.0_Default.xml

If one part use expanded url and second use $var variant then in the end both ended on the system ( I know not a perfect solution, but as it is quite sensitive part used also by multiproduct DVD of SLE I was more on safe side ).

If something does not work or you have questions, feel free to ask me here or on IRC.
Comment 19 Ludwig Nussel 2018-11-05 16:45:38 UTC
great, thanks!
do you know if in control.xml one can omit the "prod_dir", "enable", "autorefresh" and "priority" tags? They are not present in the online version either after all?
Comment 20 Josef Reidinger 2018-11-06 09:12:00 UTC
(In reply to Ludwig Nussel from comment #19)
> great, thanks!
> do you know if in control.xml one can omit the "prod_dir", "enable",
> "autorefresh" and "priority" tags? They are not present in the online
> version either after all?

I check a code for you and there are defaults defined for it:

prod_dir -> `libzypp default`
enable -> false
autorefresh -> true
priority -> `libzypp default`

and checking also xml schema - https://github.com/yast/yast-installation-control/blob/master/control/control.rnc#L395
only base_urls is mandatory, so you should be fine to do not define it, if you are fine with defaults.