Skip to content
Permalink
Browse files

Support for urls with repo variables (bnc#944505)

Conflicts:
	src/clients/repositories.rb
  • Loading branch information...
ancorgs authored and lslezak committed Oct 6, 2015
1 parent c2c1103 commit 7d29b8e54161406ddbfef2ca6ccc27a346b8d044
Showing with 22 additions and 10 deletions.
  1. +17 −7 src/clients/repositories.rb
  2. +5 −3 src/include/packager/repositories_include.rb
@@ -263,6 +263,7 @@ def getSourceInfo(index, source)
"autorefresh" => Ops.get_boolean(source, "autorefresh", true),
"name" => Ops.get_locale(source, "name", _("Unknown Name")),
"url" => Ops.get_string(generalData, "url", ""),
"raw_url" => Ops.get_string(generalData, "raw_url", ""),
"type" => Ops.get_string(generalData, "type", ""),
"priority" => Ops.get_integer(source, "priority", @default_priority),
"service" => Ops.get_string(source, "service", ""),
@@ -313,9 +314,12 @@ def fillTable(repo_mode, service_name)
nil
end

def repoInfoRichText(name, raw_url, category)
def repoInfoRichText(name, category, info)
url = info["url"]
raw_url = info["raw_url"]

schema = Builtins.tolower(
Ops.get_string(URL.Parse(raw_url), "scheme", "")
Ops.get_string(URL.Parse(url), "scheme", "")
)
icon_tag = Ops.add(
Ops.add(
@@ -327,15 +331,20 @@ def repoInfoRichText(name, raw_url, category)
"\">   "
)

url = _("Unknown") if url == ""
raw_url = _("Unknown") if raw_url == ""

url = Builtins.sformat(_("URL: %1"), raw_url)
url_string = Builtins.sformat(_("URL: %1"), url)
if url != raw_url
url_string += "<BR>"
url_string += Builtins.sformat(_("Raw URL: %1"), raw_url)
end

Builtins.sformat(
"<P>%1<B><BIG>%2</BIG></B></P><P>%3<BR>%4</P>",
icon_tag,
name,
url,
url_string,
category
)
end
@@ -394,7 +403,7 @@ def fillRepoInfo(index, source, repo_mode, service_name)
UI.ChangeWidget(
Id(:repo_info),
:Value,
repoInfoRichText(name, Ops.get_string(info, "url", ""), category)
repoInfoRichText(name, category, info)
)
end

@@ -1149,7 +1158,8 @@ def SummaryDialog
if input == :replace
if @repository_view
generalData = Pkg.SourceGeneralData(id)
url2 = Ops.get_string(generalData, "url", "")
# use the full URL (incl. the password) when editing it
url2 = Pkg.SourceRawURL(id)
old_url = url2
plaindir = Ops.get_string(generalData, "type", "YaST") == @plaindir_type

@@ -1312,7 +1322,7 @@ def SummaryDialog
else
service_info = Ops.get(@serviceStatesOut, current, {})
Builtins.y2milestone("Editing service %1...", current)
url2 = Ops.get_string(service_info, "url", "")
url2 = Ops.get_string(service_info, "raw_url", "")
old_url = url2

SourceDialogs.SetRepoName(
@@ -54,6 +54,8 @@ def createSourceImpl(url, plaindir, download, preffered_name, force_alias)
)

if url != ""
expanded_url = Pkg.ExpandedUrl(url)

# for Plaindir repository we have to use SourceCreateType() binding
parsed = URL.Parse(url)
scheme = Ops.get_string(parsed, "scheme", "")
@@ -94,7 +96,7 @@ def createSourceImpl(url, plaindir, download, preffered_name, force_alias)
)

Progress.NextStage
service_type = Pkg.ServiceProbe(url)
service_type = Pkg.ServiceProbe(expanded_url)
Builtins.y2milestone("Probed service type: %1", service_type)

if service_type != nil && service_type != "NONE"
@@ -142,7 +144,7 @@ def createSourceImpl(url, plaindir, download, preffered_name, force_alias)
return :ok
end

new_repos = Pkg.RepositoryScan(url)
new_repos = Pkg.RepositoryScan(expanded_url)
Builtins.y2milestone("new_repos: %1", new_repos)

# add at least one product if the scan result is empty (no product info available)
@@ -208,7 +210,7 @@ def createSourceImpl(url, plaindir, download, preffered_name, force_alias)
# probe repository type (do not probe plaindir repo)
repo_type = plaindir ?
@plaindir_type :
Pkg.RepositoryProbe(url, prod_dir)
Pkg.RepositoryProbe(expanded_url, prod_dir)
Builtins.y2milestone(
"Repository type (%1,%2): %3",
URL.HidePassword(url),

0 comments on commit 7d29b8e

Please sign in to comment.
You can’t perform that action at this time.