Skip to content

Commit

Permalink
Merge da9dc71 into 4d06329
Browse files Browse the repository at this point in the history
  • Loading branch information
dgdavid committed Sep 12, 2018
2 parents 4d06329 + da9dc71 commit da5f1ba
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
7 changes: 7 additions & 0 deletions package/yast2-add-on.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Wed Sep 12 15:50:58 UTC 2018 - dgonzalez@suse.com

- Fix and improve the repo name selection in the AddOn auto client
(bsc#1108139)
- 4.1.6

-------------------------------------------------------------------
Thu Aug 30 08:50:09 UTC 2018 - dgonzalez@suse.com

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-add-on.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


Name: yast2-add-on
Version: 4.1.5
Version: 4.1.6
Release: 0
Summary: YaST2 - Add-On media installation code
License: GPL-2.0-only
Expand Down
10 changes: 5 additions & 5 deletions src/lib/add-on/clients/add-on_auto.rb
Original file line number Diff line number Diff line change
Expand Up @@ -324,12 +324,12 @@ def preferred_name_for(add_on, repo)
add_on_name = add_on.fetch("name", nil)

# name in control file, bnc#433981
return add_on_name unless add_on_name.nil? || add_on_name.empty?
return add_on_name unless add_on_name.to_s.empty?

media = add_on.fetch("media")
product_dir = add_on.fetch("product_dir")
expanded_url = Pkg.ExpandedUrl(media)
repos_at_url = Pkg.RepositoryScan(expanded_url)
media_url = add_on.fetch("media_url", "")
product_dir = add_on.fetch("product_dir", "/")
expanded_url = Pkg.ExpandedUrl(media_url)
repos_at_url = Pkg.RepositoryScan(expanded_url) || []

# {Pkg.RepositoryScan} output: [["Product Name", "Path"], ...]
found_repo = repos_at_url.find { |r| r[1] == product_dir }
Expand Down
9 changes: 6 additions & 3 deletions test/y2add_on/clients/add-on_auto_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@
"alias" => "produc_alias",
"ask_on_error" => ask_on_error,
"media_url" => "RELURL://product.url",
"name" => "updated_repo",
"priority" => 20,
"product_dir" => "/"
}
Expand All @@ -258,7 +257,7 @@
"autorefresh" => true,
"enabled" => true,
"keeppackaged" => false,
"name" => "updated_repo",
"name" => "Updated repo",
"priority" => 20,
"service" => ""
},
Expand All @@ -279,9 +278,13 @@
allow(Yast::Pkg).to receive(:SourceEditSet)
allow(Yast::Pkg).to receive(:SourceCreate).and_return(1)
allow(Yast::Pkg).to receive(:SourceEditGet).and_return(repos)
allow(Yast::Pkg).to receive(:ExpandedUrl)
# To test indirectly the "preferred_name_for" method
allow(Yast::Pkg).to receive(:RepositoryScan)
.with(anything)
.and_return([["Updated repo", "/"]])
end

# FIXME: improve that WIP scenarios/contexts
context "and product creation fails" do
before do
allow(Yast::Pkg).to receive(:SourceCreate).and_return(-1)
Expand Down

0 comments on commit da5f1ba

Please sign in to comment.