Skip to content

Commit

Permalink
updated known product renames
Browse files Browse the repository at this point in the history
- 3.1.26
  • Loading branch information
lslezak committed Jun 27, 2014
1 parent 06a6cc4 commit 890fea0
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 11 deletions.
6 changes: 6 additions & 0 deletions package/yast2-packager.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri Jun 27 12:00:38 UTC 2014 - lslezak@suse.cz

- updated known product renames
- 3.1.26

-------------------------------------------------------------------
Wed Jun 25 13:18:20 UTC 2014 - lslezak@suse.cz

Expand Down
25 changes: 14 additions & 11 deletions src/modules/Packages.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ class PackagesClass < Module
RESOLVABLE_TYPES = [:product, :patch, :package, :pattern, :language]

# product renames needed for detecting the product update
# <old_name> => <new_name>
# <old_name> => [ <new_name> ]
PRODUCT_RENAMES = {
"SUSE_SLES" => "SLES",
"SUSE_SLED" => "SLED",
"SUSE_SLES" => [ "SLES" ],
# SLED or Workstation extension
"SUSE_SLED" => [ "SLED", "sle-we" ],
"sle-haegeo" => [ "sle-ha-geo" ]
}

def main
Expand Down Expand Up @@ -200,7 +202,7 @@ def CountSizeToBeInstalled

Builtins.foreach(media_sizes) { |inst_sizes| Builtins.foreach(inst_sizes) do |inst_size|
sz = Ops.add(sz, inst_size)
end }
end }


Builtins.y2milestone(
Expand Down Expand Up @@ -249,7 +251,7 @@ def CountSizeToBeDownloaded
Builtins.y2milestone("Found remote repository %1: %2", repo, url)
remote_repos = Builtins.add(remote_repos, repo)
end
end
end


# shortcut, no remote repository found
Expand All @@ -272,7 +274,7 @@ def CountSizeToBeDownloaded
Builtins.foreach(repo_media_sizes) do |media_size|
ret = Ops.add(ret, media_size)
end
end
end


Builtins.y2milestone(
Expand Down Expand Up @@ -582,7 +584,7 @@ def AddFailedMounts(summary)
Ops.set(summary, "warning_level", :warning)
end
end
end
end


Builtins.y2milestone("Proposal summary: %1", summary)
Expand Down Expand Up @@ -637,7 +639,7 @@ def Summary(flags, use_cache)
partition
)
warning = Ops.add(warning, w)
end
end


if warning != ""
Expand Down Expand Up @@ -1498,7 +1500,7 @@ def SlideShowSetUp(wanted_language)
# bnc #432668
# Do not call init
if Mode.live_installation
Builtins.y2milestone("live_installation, not calling Init")
Builtins.y2milestone("live_installation, not calling Init")
# bnc #427935
# Initialize the base_source_id first
else
Expand Down Expand Up @@ -1800,7 +1802,7 @@ def AdjustSourcePropertiesAccordingToProduct(src_id)
sources_set = Builtins.add(sources_set, one_source)
end

return Pkg.SourceEditSet(sources_set)
return Pkg.SourceEditSet(sources_set)
# Bad luck, nothing useful found
else
Builtins.y2warning("No name found")
Expand Down Expand Up @@ -2658,7 +2660,8 @@ def products_to_update(installed_products, removed_products)
removed_name = removed_product["name"]

# check the current product names or product renames
removed_name == installed_name || PRODUCT_RENAMES[removed_name] == installed_name
removed_name == installed_name ||
PRODUCT_RENAMES.fetch(removed_name, []).include?(installed_name)
end

updated_products[removed] = installed_product if removed
Expand Down
14 changes: 14 additions & 0 deletions test/packages_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,20 @@ def pattern(properties = {})
expect(old_product["display_name"]).to eq("SUSE Linux Enterprise Server 11 SP3")
expect(new_product["display_name"]).to eq("SUSE Linux Enterprise Server 12")
end

it "returns updated product which has been renamed" do
products = [
{ "name" => "sle-haegeo", "status" => :removed },
{ "name" => "sle-ha-geo", "status" => :selected }
]

status = Yast::Packages.group_products_by_status(products)

expect(status[:updated].size).to eq(1)
old_product, new_product = status[:updated].first
expect(old_product["name"]).to eq("sle-haegeo")
expect(new_product["name"]).to eq("sle-ha-geo")
end
end

describe "#product_update_summary" do
Expand Down

0 comments on commit 890fea0

Please sign in to comment.