Skip to content

Commit

Permalink
pass product renames to AddOnProduct module to update the default fal…
Browse files Browse the repository at this point in the history
…lback mapping

- 3.1.85
  • Loading branch information
lslezak committed Jul 4, 2014
1 parent e665274 commit 02469b4
Show file tree
Hide file tree
Showing 6 changed files with 400 additions and 3 deletions.
7 changes: 7 additions & 0 deletions package/yast2-registration.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Fri Jul 4 15:37:14 UTC 2014 - lslezak@suse.cz

- pass product renames to AddOnProduct module to update the
default fallback mapping
- 3.1.85

-------------------------------------------------------------------
Fri Jul 4 07:55:33 UTC 2014 - lslezak@suse.cz

Expand Down
6 changes: 3 additions & 3 deletions package/yast2-registration.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


Name: yast2-registration
Version: 3.1.84
Version: 3.1.85
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand All @@ -34,7 +34,7 @@ Requires: yast2-ruby-bindings >= 3.1.12
Requires: rubygem-suse-connect >= 0.2.0
Requires: yast2-slp >= 3.1.2
Requires: yast2-add-on >= 3.1.8
Requires: yast2-packager >= 3.1.22
Requires: yast2-packager >= 3.1.27

BuildRequires: yast2 >= 3.1.26
BuildRequires: update-desktop-files
Expand All @@ -43,7 +43,7 @@ BuildRequires: rubygem-yast-rake >= 0.1.8
BuildRequires: rubygem-rspec
BuildRequires: rubygem-suse-connect >= 0.2.0
BuildRequires: yast2-slp >= 3.1.2
BuildRequires: yast2-packager >= 3.1.22
BuildRequires: yast2-packager >= 3.1.27

BuildArch: noarch

Expand Down
17 changes: 17 additions & 0 deletions src/lib/registration/registration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ def get_addon_list
addons = SUSE::Connect::YaST.show_product(remote_product, params).extensions || []
log.info "Available addons result: #{addons}"

renames = collect_renames(addons)
::Registration::SwMgmt.update_product_renames(renames)

# ignore the base product "addon"
addons.reject{ |a| a.identifier == base_product["name"] }
end
Expand Down Expand Up @@ -173,5 +176,19 @@ def connect_params(params)

default_params.merge(params)
end

def collect_renames(addons)
renames = {}

addons.each do |addon|
if addon.former_identifier && addon.identifier != addon.former_identifier
renames[addon.former_identifier] = addon.identifier
end
end

log.info "Collected product renames: #{renames}"

renames
end
end
end
8 changes: 8 additions & 0 deletions src/lib/registration/sw_mgmt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
require "registration/helpers"

module Registration
Yast.import "AddOnProduct"
Yast.import "Mode"
Yast.import "Pkg"
Yast.import "PackageLock"
Expand Down Expand Up @@ -296,6 +297,13 @@ def self.find_addon_updates(addons)
ret
end

# update the static defaults in AddOnProduct module
def self.update_product_renames(renames)
renames.each do |old_name, new_name|
AddOnProduct.add_rename(old_name, new_name)
end
end

# a helper method for iterating over repositories
# @param repo_aliases [Array<String>] list of repository aliases
# @param block block evaluated for each found repository
Expand Down
Loading

0 comments on commit 02469b4

Please sign in to comment.