Script 'mail_helper' called by kukuk
Hello packager,
This is just FYI. Your package was checked in in distribution "sle12"
by autobuild-member: kukuk.
Here comes the log...
---------------------------%<------------------------------
Hi,
here is the log from ci_new_pac /mounts/work_src_done/SLE12/yast2-registration -> sle12
Changes:
--------
--- /work/SRC/SUSE:SLE-12:GA/yast2-registration/yast2-registration.changes 2014-06-13 16:15:37.000000000 +0200
+++ /mounts/work_src_done/SLE12/yast2-registration/yast2-registration.changes 2014-06-16 13:53:24.000000000 +0200
@@ -1,0 +2,9 @@
+Fri Jun 13 15:32:20 UTC 2014 - lslezak@suse.cz
+
+- port to the new suse-connect API (suse-connect >= 0.1.0)
+- fixed removing previous credentials at installation restart
+- libzypp now properly sets the repository statuses from service,
+ no need to explicitly enforce them
+- 3.1.75
+
+-------------------------------------------------------------------
calling whatdependson for sle12-i586
Packages directly triggered for rebuild:
- yast2-registration
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/SUSE:SLE-12:GA/yast2-registration (Old)
and /mounts/work_src_done/SLE12/yast2-registration (BS:build ID:39576 MAIL:yast-commit@opensuse.org) (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-registration", Maintainer is "yast-commit@opensuse.org"
Old:
----
yast2-registration-3.1.74.tar.bz2
New:
----
yast2-registration-3.1.75.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-registration.spec ++++++
--- /var/tmp/diff_new_pack.KAv1hp/_old 2014-06-16 14:52:56.000000000 +0200
+++ /var/tmp/diff_new_pack.KAv1hp/_new 2014-06-16 14:52:56.000000000 +0200
@@ -17,7 +17,7 @@
Name: yast2-registration
-Version: 3.1.74
+Version: 3.1.75
Release: 0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@@ -31,7 +31,7 @@
Requires: yast2-pkg-bindings >= 2.17.20
# N_() method
Requires: yast2-ruby-bindings >= 3.1.12
-Requires: rubygem-suse-connect >= 0.0.20
+Requires: rubygem-suse-connect >= 0.1.0
Requires: yast2-slp >= 3.1.2
Requires: yast2-add-on >= 3.1.8
Requires: yast2-packager >= 3.1.22
@@ -41,7 +41,7 @@
BuildRequires: yast2-devtools >= 3.1.6
BuildRequires: rubygem-yast-rake >= 0.1.8
BuildRequires: rubygem-rspec
-BuildRequires: rubygem-suse-connect >= 0.0.20
+BuildRequires: rubygem-suse-connect >= 0.1.0
BuildRequires: yast2-slp >= 3.1.2
BuildRequires: yast2-packager >= 3.1.22
++++++ yast2-registration-3.1.74.tar.bz2 -> yast2-registration-3.1.75.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.74/package/yast2-registration.changes new/yast2-registration-3.1.75/package/yast2-registration.changes
--- old/yast2-registration-3.1.74/package/yast2-registration.changes 2014-06-13 15:31:19.000000000 +0200
+++ new/yast2-registration-3.1.75/package/yast2-registration.changes 2014-06-16 13:51:16.000000000 +0200
@@ -1,4 +1,13 @@
-------------------------------------------------------------------
+Fri Jun 13 15:32:20 UTC 2014 - lslezak@suse.cz
+
+- port to the new suse-connect API (suse-connect >= 0.1.0)
+- fixed removing previous credentials at installation restart
+- libzypp now properly sets the repository statuses from service,
+ no need to explicitly enforce them
+- 3.1.75
+
+-------------------------------------------------------------------
Thu Jun 12 13:48:59 UTC 2014 - lslezak@suse.cz
- reset registration status when installation is restarted
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.74/package/yast2-registration.spec new/yast2-registration-3.1.75/package/yast2-registration.spec
--- old/yast2-registration-3.1.74/package/yast2-registration.spec 2014-06-13 15:31:19.000000000 +0200
+++ new/yast2-registration-3.1.75/package/yast2-registration.spec 2014-06-16 13:51:16.000000000 +0200
@@ -17,7 +17,7 @@
Name: yast2-registration
-Version: 3.1.74
+Version: 3.1.75
Release: 0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@@ -31,7 +31,7 @@
Requires: yast2-pkg-bindings >= 2.17.20
# N_() method
Requires: yast2-ruby-bindings >= 3.1.12
-Requires: rubygem-suse-connect >= 0.0.20
+Requires: rubygem-suse-connect >= 0.1.0
Requires: yast2-slp >= 3.1.2
Requires: yast2-add-on >= 3.1.8
Requires: yast2-packager >= 3.1.22
@@ -41,7 +41,7 @@
BuildRequires: yast2-devtools >= 3.1.6
BuildRequires: rubygem-yast-rake >= 0.1.8
BuildRequires: rubygem-rspec
-BuildRequires: rubygem-suse-connect >= 0.0.20
+BuildRequires: rubygem-suse-connect >= 0.1.0
BuildRequires: yast2-slp >= 3.1.2
BuildRequires: yast2-packager >= 3.1.22
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.74/src/clients/discover_registration_services.rb new/yast2-registration-3.1.75/src/clients/discover_registration_services.rb
--- old/yast2-registration-3.1.74/src/clients/discover_registration_services.rb 2014-06-13 15:31:19.000000000 +0200
+++ new/yast2-registration-3.1.75/src/clients/discover_registration_services.rb 2014-06-16 13:51:16.000000000 +0200
@@ -34,7 +34,7 @@
Heading(_('Local Registration Servers')),
VSpacing(0.5),
Label(_("Select a detected registration server from the list\n" +
- "or the default SUSE registration server.")),
+ "or the default SUSE registration server.")),
VSpacing(0.5),
RadioButtonGroup(
Id(:services),
@@ -46,7 +46,7 @@
),
VSpacing(Opt(:vstretch), 1),
ButtonBox(
- PushButton(Id(:ok), Label.OKButton)
+ PushButton(Id(:ok), Opt(:default), Label.OKButton)
)
)
)
@@ -92,7 +92,11 @@
)
)
end
- widgets.unshift Left(RadioButton(Id("scc"), _("SUSE Customer Center"), true))
+
+ widgets.unshift(Left(RadioButton(Id("scc"),
+ # %s is the default SCC URL
+ _("SUSE Customer Center (%s)") % SUSE::Connect::Client::DEFAULT_URL,
+ true)))
end
end unless defined?(DiscoverRegistrationServicesClient)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.74/src/clients/inst_scc.rb new/yast2-registration-3.1.75/src/clients/inst_scc.rb
--- old/yast2-registration-3.1.74/src/clients/inst_scc.rb 2014-06-13 15:31:19.000000000 +0200
+++ new/yast2-registration-3.1.75/src/clients/inst_scc.rb 2014-06-16 13:51:16.000000000 +0200
@@ -131,7 +131,8 @@
init_registration
::Registration::SccHelpers.catch_registration_errors do
- distro_target = ::Registration::SwMgmt.find_base_product["register_target"]
+ base_product = ::Registration::SwMgmt.find_base_product
+ distro_target = base_product["register_target"]
if !::Registration::Registration.is_registered?
log.info "Registering system, distro_target: #{distro_target}"
@@ -145,20 +146,20 @@
if !options.base_registered
# then register the product(s)
- base_product = ::Registration::SwMgmt.base_product_to_register
- product_services = Popup.Feedback(_(CONTACTING_MESSAGE),
+ product_service = Popup.Feedback(_(CONTACTING_MESSAGE),
_("Registering %s ...") % ::Registration::SwMgmt.base_product_label(base_product)
) do
- base_product["reg_code"] = reg_code
- registered_services = @registration.register_product(base_product)
+ base_product_data = ::Registration::SwMgmt.base_product_to_register
+ base_product_data["reg_code"] = reg_code
+ registered_service = @registration.register_product(base_product_data, email)
options.base_registered = true
- registered_services
+ registered_service
end
# select repositories to use in installation or update (e.g. enable/disable Updates)
- select_repositories(product_services) if Mode.installation || Mode.update
+ select_repositories(product_service) if Mode.installation || Mode.update
end
return :next
@@ -298,11 +299,11 @@
end
end
- def select_repositories(product_services)
+ def select_repositories(product_service)
options = ::Registration::Storage::InstallationOptions.instance
# added update repositories
- updates = ::Registration::SwMgmt.service_repos(product_services, only_updates: true)
+ updates = ::Registration::SwMgmt.service_repos(product_service, only_updates: true)
log.info "Found update repositories: #{updates.size}"
# not set yet?
@@ -334,11 +335,8 @@
box = VBox()
addons.each do |addon|
- label = addon.short_name
- label << " (#{addon.long_name})" if addon.long_name && !addon.long_name.empty?
-
- box[box.size] = MinWidth(REG_CODE_WIDTH, InputField(Id(addon.product_ident), label,
- @known_reg_codes.fetch(addon.product_ident, "")))
+ box[box.size] = MinWidth(REG_CODE_WIDTH, InputField(Id(addon.identifier),
+ addon.label, @known_reg_codes.fetch(addon.identifier, "")))
# add extra spacing when there are just few addons, in GUI always
box[box.size] = VSpacing(1) if (addons.size < 5) || !textmode
end
@@ -431,7 +429,7 @@
# @return [Hash] addon => reg. code mapping
def collect_addon_regcodes(addons_with_codes)
pairs = addons_with_codes.map do |a|
- [a.product_ident, UI.QueryWidget(Id(a.product_ident), :Value)]
+ [a.identifier, UI.QueryWidget(Id(a.identifier), :Value)]
end
@known_reg_codes.merge!(Hash[pairs])
end
@@ -453,20 +451,20 @@
# end
# end
#
- # log.info "Addon registration order: #{registration_order.map(&:short_name)}"
+ # log.info "Addon registration order: #{registration_order.map(&:name)}"
init_registration
product_succeed = registration_order.map do |product|
- ::Registration::SccHelpers.catch_registration_errors("#{product.short_name}:") do
+ ::Registration::SccHelpers.catch_registration_errors("#{product.label}:") do
product_service = Popup.Feedback(
_(CONTACTING_MESSAGE),
# %s is name of given product
- _("Registering %s ...") % product.short_name) do
+ _("Registering %s ...") % product.label) do
product_data = {
- "name" => product.product_ident,
- "reg_code" => @known_reg_codes[product.product_ident],
+ "name" => product.identifier,
+ "reg_code" => @known_reg_codes[product.identifier],
"arch" => product.arch,
"version" => product.version
}
@@ -478,8 +476,8 @@
select_repositories(product_service) if Mode.installation || Mode.update
# move from selected to registered
- registered_addons << product.product_ident
- @selected_addons.reject!{|selected| selected.product_ident == product.product_ident}
+ registered_addons << product.identifier
+ @selected_addons.reject!{|selected| selected.identifier == product.identifier}
end
end
@@ -678,7 +676,7 @@
if Stage.initial && ::Registration::Registration.is_registered?
file = ::Registration::Registration::SCC_CREDENTIALS
log.info "Resetting registration status, removing #{file}"
- File.rm(file)
+ File.unlink(file)
end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.74/src/lib/registration/addon.rb new/yast2-registration-3.1.75/src/lib/registration/addon.rb
--- old/yast2-registration-3.1.74/src/lib/registration/addon.rb 2014-06-13 15:31:20.000000000 +0200
+++ new/yast2-registration-3.1.75/src/lib/registration/addon.rb 2014-06-16 13:51:16.000000000 +0200
@@ -68,9 +68,10 @@
:description,
:eula_url,
:free,
- :long_name,
- :product_ident,
- :short_name,
+ :friendly_name,
+ :identifier,
+ :name,
+ :release_type,
:version
def initialize pure_addon
@@ -93,5 +94,12 @@
def registered?
Addon.registered.include?(self)
end
+
+ # get a product printable name (long name if present, fallbacks to the short name)
+ # @return [String] label usable in UI
+ def label
+ (friendly_name && !friendly_name.empty?) ? friendly_name : name
+ end
+
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.74/src/lib/registration/registration.rb new/yast2-registration-3.1.75/src/lib/registration/registration.rb
--- old/yast2-registration-3.1.74/src/lib/registration/registration.rb 2014-06-13 15:31:20.000000000 +0200
+++ new/yast2-registration-3.1.75/src/lib/registration/registration.rb 2014-06-16 13:51:17.000000000 +0200
@@ -41,11 +41,10 @@
def register(email, reg_code, distro_target)
settings = connect_params(
:token => reg_code,
- :distro_target => distro_target,
:email => email
)
- login, password = SUSE::Connect::YaST.announce_system(settings)
+ login, password = SUSE::Connect::YaST.announce_system(settings, distro_target)
credentials = SUSE::Connect::Credentials.new(login, password, SCC_CREDENTIALS)
log.info "Global SCC credentials: #{credentials}"
@@ -58,29 +57,37 @@
end
- def register_product(product)
- services_for_product(product) do |params|
+ def register_product(product, email = nil)
+ service_for_product(product) do |product_ident, params|
log.info "Registering product: #{product}"
- SUSE::Connect::YaST.activate_product(params)
+ SUSE::Connect::YaST.activate_product(product_ident, params, email)
end
end
def upgrade_product(product)
- services_for_product(product) do |params|
+ service_for_product(product) do |product_ident, params|
log.info "Upgrading product: #{product}"
- SUSE::Connect::YaST.upgrade_product(params)
+ SUSE::Connect::YaST.upgrade_product(product_ident, params)
end
end
def get_addon_list
# extensions for base product
base_product = ::Registration::SwMgmt.find_base_product
- params = connect_params(:product_ident => {:name => base_product["name"]})
log.info "Reading available addons for product: #{base_product["name"]}"
- addons = SUSE::Connect::YaST.list_products(params)
+
+ remote_product = SUSE::Connect::Remote::Product.new(
+ :arch => base_product["arch"],
+ :identifier => base_product["name"],
+ :version => base_product["version"],
+ :release_type => base_product["release_type"]
+ )
+
+ params = connect_params({})
+ addons = SUSE::Connect::YaST.show_product(remote_product, params)
# ignore the base product "addon"
- addons.reject{ |a| a.product_ident == base_product["name"] }
+ addons.reject{ |a| a.identifier == base_product["name"] }
end
def self.is_registered?
@@ -89,30 +96,31 @@
private
- def services_for_product(product, &block)
- product_ident = {
+ def service_for_product(product, &block)
+ remote_product = SUSE::Connect::Remote::Product.new(
:arch => product["arch"],
- :name => product["name"],
+ :identifier => product["name"],
:version => product["version"],
:release_type => product["release_type"]
- }
- log.info "Using product: #{product_ident}"
+ )
+
+ log.info "Using product: #{remote_product}"
- params = connect_params(:product_ident => product_ident)
+ params = connect_params({})
# use product specific reg. code (e.g. for addons)
params[:token] = product["reg_code"] if product["reg_code"]
- product_service = yield(params)
+ product_service = yield(remote_product, params)
- log.info "registered product_services: #{product_service.inspect}"
+ log.info "registration result: #{product_service}"
if product_service
credentials = SUSE::Connect::Credentials.read(SCC_CREDENTIALS)
- ::Registration::SwMgmt.add_services([product_service], credentials)
+ ::Registration::SwMgmt.add_service(product_service, credentials)
end
- product_service ? [product_service] : []
+ product_service
end
def connect_params(params)
@@ -120,10 +128,6 @@
:language => ::Registration::Helpers.language,
:debug => ENV["SCCDEBUG"],
:verbose => ENV["Y2DEBUG"] == "1",
- # TODO FIXME: workaround: just a dummy value (it is used only from
- # suse-connect command line, makes no sense in Yast), suse-connect
- # should be fixed to not call zypper when the :product key is missing
- :product => {},
# pass a verify_callback to get details about failed SSL verification
:verify_callback => lambda do |verify_ok, context|
# we cannot raise an exception with details here (all exceptions in
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.74/src/lib/registration/sw_mgmt.rb new/yast2-registration-3.1.75/src/lib/registration/sw_mgmt.rb
--- old/yast2-registration-3.1.74/src/lib/registration/sw_mgmt.rb 2014-06-13 15:31:20.000000000 +0200
+++ new/yast2-registration-3.1.75/src/lib/registration/sw_mgmt.rb 2014-06-16 13:51:17.000000000 +0200
@@ -130,7 +130,7 @@
end
# add the services to libzypp and load (refresh) them
- def self.add_services(product_services, credentials)
+ def self.add_service(product_service, credentials)
# save repositories before refreshing added services (otherwise
# pkg-bindings will treat them as removed by the service refresh and
# unload them)
@@ -140,90 +140,80 @@
end
# services for registered products
- product_services.map(&:sources).flatten.each do |source|
- log.info "Adding service #{source.name.inspect} (#{source.url})"
+ log.info "Adding service #{product_service.name.inspect} (#{product_service.url})"
- credentials_file = Helpers.credentials_from_url(source.url)
+ credentials_file = Helpers.credentials_from_url(product_service.url)
- if credentials_file
- if Mode.update
- # at update libzypp is already switched to /mnt target,
- # update the path accordingly
- credentials_file = File.join(Installation.destdir,
- ::SUSE::Connect::Credentials::DEFAULT_CREDENTIALS_DIR,
- credentials_file)
- log.info "Using #{credentials_file} credentials path in update mode"
- end
- # TODO FIXME: SCC currenly does not return credentials for the service,
- # just reuse the global credentials and save to a different file
- service_credentials = credentials.dup
- service_credentials.file = credentials_file
- service_credentials.write
- end
-
- # add a new service or update the existing service
- if Pkg.ServiceAliases.include?(source.name)
- log.info "Updating existing service: #{source.name}"
- if !Pkg.ServiceSet(source.name, {
- "alias" => source.name,
- "name" => source.name,
- "url" => source.url.to_s,
- "enabled" => true,
- "autorefresh" => true,
- })
-
- ## error message
- raise ::Registration::ServiceError.new(N_("Updating service '%s' failed."), source.name)
- end
- else
- log.info "Adding new service: #{source.name}"
- if !Pkg.ServiceAdd(source.name, source.url.to_s)
- # error message
- raise ::Registration::ServiceError.new(N_("Adding service '%s' failed."), source.name)
- end
- end
-
- # refresh works only for saved services
- if !Pkg.ServiceSave(source.name)
- # error message
- raise ::Registration::ServiceError.new(N_("Saving service '%s' failed."), source.name)
- end
-
- if !Pkg.ServiceRefresh(source.name)
+ if credentials_file
+ if Mode.update
+ # at update libzypp is already switched to /mnt target,
+ # update the path accordingly
+ credentials_file = File.join(Installation.destdir,
+ ::SUSE::Connect::Credentials::DEFAULT_CREDENTIALS_DIR,
+ credentials_file)
+ log.info "Using #{credentials_file} credentials path in update mode"
+ end
+ # TODO FIXME: SCC currenly does not return credentials for the service,
+ # just reuse the global credentials and save to a different file
+ service_credentials = credentials.dup
+ service_credentials.file = credentials_file
+ service_credentials.write
+ end
+
+ service_name = product_service.name
+
+ # add a new service or update the existing service
+ if Pkg.ServiceAliases.include?(service_name)
+ log.info "Updating existing service: #{service_name}"
+ if !Pkg.ServiceSet(service_name, {
+ "alias" => service_name,
+ "name" => service_name,
+ "url" => product_service.url.to_s,
+ "enabled" => true,
+ "autorefresh" => true,
+ })
+
+ ## error message
+ raise ::Registration::ServiceError.new(N_("Updating service '%s' failed."), service_name)
+ end
+ else
+ log.info "Adding new service: #{service_name}"
+ if !Pkg.ServiceAdd(service_name, product_service.url.to_s)
# error message
- raise ::Registration::ServiceError.new(N_("Refreshing service '%s' failed."), source.name)
+ raise ::Registration::ServiceError.new(N_("Adding service '%s' failed."), service_name)
end
end
- # activate the requested repository setup
- product_services.each do |product_service|
- # there is always only one service
- service_name = product_service.sources.first.name
- log.info "Updating repositories for service: #{service_name}"
+ # refresh works only for saved services
+ if !Pkg.ServiceSave(service_name)
+ # error message
+ raise ::Registration::ServiceError.new(N_("Saving service '%s' failed."), service_name)
+ end
- repos_enable(service_aliases(service_name, product_service.enabled))
- repos_disable_autorefresh(service_aliases(service_name, product_service.norefresh))
+ if !Pkg.ServiceRefresh(service_name)
+ # error message
+ raise ::Registration::ServiceError.new(N_("Refreshing service '%s' failed."), service_name)
end
ensure
Pkg.SourceSaveAll
end
# get list of repositories belonging to registered services
- # @param product_services [ArraySUSE::Connect::Service] added services
+ # @param product_services [SUSE::Connect::Remote::Service] added service
# @param only_updates [Boolean] return only update repositories
# @return [Array<Hash>] list of repositories
- def self.service_repos(product_services, only_updates: false)
+ def self.service_repos(product_service, only_updates: false)
repo_data = Pkg.SourceGetCurrent(false).map do |repo|
data = Pkg.SourceGeneralData(repo)
data["SrcId"] = repo
data
end
- service_names = product_services.map(&:sources).flatten.map(&:name)
- log.info "Added services: #{service_names.inspect}"
+ service_name = product_service.name
+ log.info "Added service: #{service_name.inspect}"
# select only repositories belonging to the product services
- repos = repo_data.select{|repo| service_names.include?(repo["service"])}
+ repos = repo_data.select{|repo| service_name == repo["service"]}
log.info "Service repositories: #{repos}"
if only_updates
@@ -251,24 +241,6 @@
end
end
- # Disable specified repositories
- # @param repo_aliases [Array<String>] list of repository aliases
- def self.repos_enable(repo_aliases)
- each_repo(repo_aliases) do |repo_alias|
- log.info "Enabling repository #{repo_alias}"
- Pkg.SourceSetEnabled(repo_alias, true)
- end
- end
-
- # Disable autorefresh for specified repositories
- # @param repo_aliases [Array<String>] list of repository aliases
- def self.repos_disable_autorefresh(repo_aliases)
- each_repo(repo_aliases) do |repo_alias|
- log.info "Disabling autorefresh for #{repo_alias} repository"
- Pkg.SourceSetAutorefresh(repo_alias, false)
- end
- end
-
# copy old NCC/SCC credentials from the old installation to new SCC credentials
# the files are copied to the current system
def self.copy_old_credentials(source_dir)
@@ -322,13 +294,7 @@
end
end
- # get libzypp repository aliases for a service
- # (libzypp internally uses the service name as the prefix)
- def self.service_aliases(service, aliases)
- aliases.map{ |a| "#{service}:#{a}"}
- end
-
- private_class_method :each_repo, :service_aliases
+ private_class_method :each_repo
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.74/src/lib/registration/ui/addon_eula_dialog.rb new/yast2-registration-3.1.75/src/lib/registration/ui/addon_eula_dialog.rb
--- old/yast2-registration-3.1.74/src/lib/registration/ui/addon_eula_dialog.rb 2014-06-13 15:31:20.000000000 +0200
+++ new/yast2-registration-3.1.75/src/lib/registration/ui/addon_eula_dialog.rb 2014-06-16 13:51:17.000000000 +0200
@@ -49,7 +49,7 @@
all_accepted = addons.all? do |addon|
if addon.eula_url && !addon.eula_url.empty?
- log.info "Addon '#{addon.short_name}' has an EULA at #{addon.eula_url}"
+ log.info "Addon '#{addon.name}' has an EULA at #{addon.eula_url}"
accept_eula(addon)
else
# no EULA specified => accepted
@@ -68,11 +68,12 @@
# @param addon [SUSE::Connect::Product] the addon
# @return [Boolean] true if the EULA has been accepted
def accept_eula(addon)
+ addon_name = product.label
Dir.mktmpdir("extension-eula-") do |tmpdir|
begin
Yast::Popup.Feedback(
_("Downloading License Agreement..."),
- addon.short_name
+ addon_name
) do
# download the license (with translations)
loader = EulaDownloader.new(addon.eula_url, tmpdir,
@@ -83,17 +84,17 @@
rescue Exception => e
log.error "Download failed: #{e.message}: #{e.backtrace}"
# %s is an extension name, e.g. "SUSE Linux Enterprise Software Development Kit"
- Yast::Report.Error(_("Downloading the license for\n%s\nfailed.") % addon.short_name)
+ Yast::Report.Error(_("Downloading the license for\n%s\nfailed.") % addon_name)
#FIXME change for GA!!!
return true
end
- id = "#{addon.short_name} extension EULA"
+ id = "#{addon_name} extension EULA"
Yast::ProductLicense.SetAcceptanceNeeded(id, true)
Yast::ProductLicense.license_file_print = addon.eula_url
# %s is an extension name, e.g. "SUSE Linux Enterprise Software Development Kit"
- title = _("%s License Agreement") % addon.short_name
+ title = _("%s License Agreement") % addon_name
eulas = read_downloaded_eulas(tmpdir)
enable_back = true
@@ -101,7 +102,7 @@
eula_lang(eulas.keys), arg_ref(eulas), id, title)
# TODO FIXME: this a workaround, remove before RC/GM!!
- display_beta_warning(addon.short_name)
+ display_beta_warning(addon_name)
base_product = false
action = "abort"
@@ -147,7 +148,7 @@
log.warn "Ignoring unknown file: #{file}"
end
end
-
+
log.info "EULA files in #{dir}: #{eulas}"
eulas
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.74/src/lib/registration/ui/addon_selection_dialog.rb new/yast2-registration-3.1.75/src/lib/registration/ui/addon_selection_dialog.rb
--- old/yast2-registration-3.1.74/src/lib/registration/ui/addon_selection_dialog.rb 2014-06-13 15:31:20.000000000 +0200
+++ new/yast2-registration-3.1.75/src/lib/registration/ui/addon_selection_dialog.rb 2014-06-16 13:51:17.000000000 +0200
@@ -28,6 +28,7 @@
def initialize(registration)
textdomain "registration"
@addons = Addon.find_all(registration)
+ log.info "Available addons: #{@addons}"
end
# display the EULA for each dialog and wait for a button click
@@ -117,9 +118,9 @@
end
def addon_checkbox_element(addon)
- CheckBox(Id(addon.product_ident),
+ CheckBox(Id(addon.identifier),
Opt(:notify),
- addon.short_name,
+ addon.label,
addon.selected? || addon.registered?)
end
@@ -149,18 +150,18 @@
return nil
end
- log.info "Selected addons: #{Addon.selected.map(&:short_name)}"
+ log.info "Selected addons: #{Addon.selected.map(&:name)}"
Addon.selected.empty? ? :skip : :next
end
def handle_addon_selection(id)
# check whether it's an add-on ID (checkbox clicked)
- addon = @addons.find{|addon| addon.product_ident == id}
+ addon = @addons.find{|addon| addon.identifier == id}
return unless addon
show_addon_details(addon)
- if Yast::UI.QueryWidget(Id(addon.product_ident), :Value)
+ if Yast::UI.QueryWidget(Id(addon.identifier), :Value)
addon.selected
else
addon.unselected
@@ -179,7 +180,7 @@
def reactivate_dependencies
@addons.each do |addon|
- Yast::UI.ChangeWidget(Id(addon.product_ident), :Enabled, enable_addon?(addon))
+ Yast::UI.ChangeWidget(Id(addon.identifier), :Enabled, enable_addon?(addon))
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.74/test/addon_selection_dialog_test.rb new/yast2-registration-3.1.75/test/addon_selection_dialog_test.rb
--- old/yast2-registration-3.1.74/test/addon_selection_dialog_test.rb 2014-06-13 15:31:20.000000000 +0200
+++ new/yast2-registration-3.1.75/test/addon_selection_dialog_test.rb 2014-06-16 13:51:17.000000000 +0200
@@ -32,10 +32,10 @@
it "returns `:next` if some addons are selected and user click next" do
test_addon = addon_generator
- expect(Yast::UI).to receive(:UserInput).and_return(test_addon.product_ident, :next)
+ expect(Yast::UI).to receive(:UserInput).and_return(test_addon.identifier, :next)
# mock that widget is selected
expect(Yast::UI).to receive(:QueryWidget).
- with(Yast::Term.new(:id, test_addon.product_ident), :Value).
+ with(Yast::Term.new(:id, test_addon.identifier), :Value).
and_return(true)
registration = double(:get_addon_list => [test_addon])
expect(subject.run(registration)).to eq :next
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.74/test/addon_spec.rb new/yast2-registration-3.1.75/test/addon_spec.rb
--- old/yast2-registration-3.1.74/test/addon_spec.rb 2014-06-13 15:31:20.000000000 +0200
+++ new/yast2-registration-3.1.75/test/addon_spec.rb 2014-06-16 13:51:17.000000000 +0200
@@ -94,4 +94,26 @@
expect(addon.registered?).to be_true
end
end
+
+ describe "#label" do
+ it "returns short name when the long name is nil" do
+ product = addon_generator
+ product.friendly_name = nil
+
+ addon = Registration::Addon.new(product)
+ expect(addon.label).to eq(addon.name)
+ end
+
+ it "returns short name when the long name is empty" do
+ product = addon_generator("friendly_name" => "")
+
+ addon = Registration::Addon.new(product)
+ expect(addon.label).to eq(addon.name)
+ end
+
+ it "returns long name if it is present" do
+ expect(addon.label).to eq(addon.friendly_name)
+ end
+ end
+
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.74/test/factories.rb new/yast2-registration-3.1.75/test/factories.rb
--- old/yast2-registration-3.1.74/test/factories.rb 2014-06-13 15:31:20.000000000 +0200
+++ new/yast2-registration-3.1.75/test/factories.rb 2014-06-16 13:51:17.000000000 +0200
@@ -4,10 +4,10 @@
def suse_connect_product_generator(attrs={})
params = {}
params['name'] = attrs['name'] || "Product#{rand(100000)}"
- params['long_name'] = attrs['long_name'] || "The best cool #{params['name']}"
+ params['friendly_name'] = attrs['friendly_name'] || "The best cool #{params['name']}"
params['description'] = attrs['description'] || "Bla bla bla bla!"
- params['zypper_name'] = attrs['zypper_name'] || "prod#{rand(100000)}"
- params['zypper_version'] = attrs['version'] || "#{rand(13)}"
+ params['identifier'] = attrs['zypper_name'] || "prod#{rand(100000)}"
+ params['version'] = attrs['version'] || "#{rand(13)}"
params['arch'] = attrs['arch'] || "x86_64"
params['free'] = attrs.fetch('free', true)
params['eula_url'] = attrs['eula_url']
@@ -17,12 +17,12 @@
end
def addon_generator(params={})
- SUSE::Connect::Product.new(suse_connect_product_generator(params))
+ SUSE::Connect::Remote::Product.new(suse_connect_product_generator(params))
end
def addon_with_child_generator(parent_params={})
prod_child = suse_connect_product_generator
- SUSE::Connect::Product.new(suse_connect_product_generator(parent_params.merge('extensions' => [prod_child])))
+ SUSE::Connect::Remote::Product.new(suse_connect_product_generator(parent_params.merge('extensions' => [prod_child])))
end
# add cache reset, which is not needed in runtime, but for test it is critical
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.74/test/registration_spec.rb new/yast2-registration-3.1.75/test/registration_spec.rb
--- old/yast2-registration-3.1.74/test/registration_spec.rb 2014-06-13 15:31:20.000000000 +0200
+++ new/yast2-registration-3.1.75/test/registration_spec.rb 2014-06-16 13:51:17.000000000 +0200
@@ -20,15 +20,16 @@
username = "user"
password = "password"
reg_code = "reg_code"
+ target_distro = "sles-12-x86_64"
expect(Registration::SwMgmt).to receive(:zypp_config_writable!)
SUSE::Connect::Credentials.any_instance.should_receive(:write)
expect(SUSE::Connect::YaST).to(receive(:announce_system)
- .with(hash_including(:token => reg_code))
+ .with(hash_including(:token => reg_code), target_distro)
.and_return([username, password])
)
- Registration::Registration.new.register("email", reg_code, "sles-12-x86_64")
+ Registration::Registration.new.register("email", reg_code, target_distro)
end
end
@@ -43,30 +44,25 @@
"release_type" => "DVD"
}
- source = SUSE::Connect::Source.new("service", "https://example.com")
- service = SUSE::Connect::Service.new([source], [], [])
+ service_data = {
+ "name" => "service",
+ "url" => "https://example.com",
+ "product" => product
+ }
- expect(SUSE::Connect::YaST).to(receive(connect_method)
- .with(hash_including(
- :product_ident => {
- :name => product["name"],
- :version => product["version"],
- :arch => product["arch"],
- :release_type => product["release_type"]
- }
- ))
- .and_return(service)
- )
+ service = SUSE::Connect::Remote::Service.new(service_data)
+
+ expect(SUSE::Connect::YaST).to receive(connect_method).and_return(service)
- expect(Registration::SwMgmt).to receive(:add_services)
+ expect(Registration::SwMgmt).to receive(:add_service)
allow(File).to receive(:exist?).with(
SUSE::Connect::Credentials::GLOBAL_CREDENTIALS_FILE).and_return(true)
allow(File).to receive(:read).with(
SUSE::Connect::Credentials::GLOBAL_CREDENTIALS_FILE).and_return(
"username=SCC_foo\npassword=bar")
- service_list = Registration::Registration.new.send(yast_method, product)
- expect(service_list).to eq([service])
+ registered_service = Registration::Registration.new.send(yast_method, product)
+ expect(registered_service).to eq(service)
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.74/test/sw_mgmt_spec.rb new/yast2-registration-3.1.75/test/sw_mgmt_spec.rb
--- old/yast2-registration-3.1.74/test/sw_mgmt_spec.rb 2014-06-13 15:31:20.000000000 +0200
+++ new/yast2-registration-3.1.75/test/sw_mgmt_spec.rb 2014-06-16 13:51:17.000000000 +0200
@@ -58,12 +58,10 @@
end
describe ".service_repos" do
- let(:services) { double }
+ let(:service) { double }
before do
- service = double
expect(service).to receive(:name).and_return(service_name)
- expect(services).to receive(:sources).and_return([service])
expect(yast_pkg).to receive(:SourceGetCurrent).with(false).and_return(repos.keys)
repos.each do |id, repo|
@@ -72,11 +70,11 @@
end
it "returns list of repositories belonging to a service" do
- expect(Registration::SwMgmt.service_repos([services])).to eq([repos[1], repos[2]])
+ expect(Registration::SwMgmt.service_repos(service)).to eq([repos[1], repos[2]])
end
it "optionally returns only update repositories" do
- expect(Registration::SwMgmt.service_repos([services], only_updates: true)).to eq([repos[2]])
+ expect(Registration::SwMgmt.service_repos(service, only_updates: true)).to eq([repos[2]])
end
end
@@ -93,9 +91,12 @@
describe ".add_services" do
let(:service_url) { "https://example.com/foo/bar?credentials=TEST_credentials" }
let(:credentials) { SUSE::Connect::Credentials.new("user", "password", "file") }
- let(:product_services) do
- SUSE::Connect::Service.new({service_name => service_url}, ["SLES12-Pool"],
- ["SLES12-Pool"])
+ let(:product_service) do
+ SUSE::Connect::Remote::Service.new(
+ "name" => service_name,
+ "url" => service_url,
+ "product" => {}
+ )
end
let(:yast_mode) { double("Yast::Mode") }
@@ -105,10 +106,6 @@
expect(yast_pkg).to receive(:ServiceSave).with(service_name).and_return(true)
SUSE::Connect::Credentials.any_instance.should_receive(:write)
- # 1 -> "SLES:SLES12-Pool"
- expect(yast_pkg).to receive(:SourceSetEnabled).with(1, true).and_return(true)
- expect(yast_pkg).to receive(:SourceSetAutorefresh).with(1, false).and_return(true)
-
allow(yast_pkg).to receive(:SourceGetCurrent).with(false).and_return(repos.keys)
repos.each do |id, repo|
allow(yast_pkg).to receive(:SourceGeneralData).with(id).and_return(repo)
@@ -121,14 +118,14 @@
it "it creates a new service if the service does not exist yet" do
expect(yast_pkg).to receive(:ServiceAliases).and_return([])
expect(yast_pkg).to receive(:ServiceAdd).with(service_name, service_url).and_return(true)
- expect { Registration::SwMgmt.add_services([product_services], credentials) }.to_not raise_error
+ expect { Registration::SwMgmt.add_service(product_service, credentials) }.to_not raise_error
end
it "updates the existing service if the service already exists" do
expect(yast_pkg).to receive(:ServiceAliases).and_return([service_name])
expect(yast_pkg).to receive(:ServiceSet).with(
service_name, hash_including("url" => service_url)).and_return(true)
- expect { Registration::SwMgmt.add_services([product_services], credentials) }.to_not raise_error
+ expect { Registration::SwMgmt.add_service(product_service, credentials) }.to_not raise_error
end
end
continue with "q"...
Checked in at Mon Jun 16 14:53:48 CEST 2014 by kukuk
Remember to have fun...
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org