Hello community, here is the log from the commit of package yast2-registration for openSUSE:Factory checked in at 2017-12-01 17:17:03 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-registration (Old) and /work/SRC/openSUSE:Factory/.yast2-registration.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-registration" Fri Dec 1 17:17:03 2017 rev:6 rq:546197 version:4.0.13 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-registration/yast2-registration.changes 2017-10-28 14:19:50.519593561 +0200 +++ /work/SRC/openSUSE:Factory/.yast2-registration.new/yast2-registration.changes 2017-12-01 17:17:05.159955802 +0100 @@ -1,0 +2,18 @@ +Wed Nov 22 09:52:16 UTC 2017 - lsle...@suse.cz + +- AutoYaST fixes (bsc#1065438): + - fixed addon registration order + - automatically register the dependant addons +- Preselect also the recommended beta addons, display them by + default even when the beta filter is active + (related to bsc#1056413) +- 4.0.13 + +------------------------------------------------------------------- +Wed Nov 8 14:36:05 CET 2017 - sch...@suse.de + +- Changed warning text if user has skipped registration. + (bnc#1055023) +- 4.0.12 + +------------------------------------------------------------------- Old: ---- yast2-registration-4.0.10.tar.bz2 New: ---- yast2-registration-4.0.13.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-registration.spec ++++++ --- /var/tmp/diff_new_pack.xW129p/_old 2017-12-01 17:17:05.943927618 +0100 +++ /var/tmp/diff_new_pack.xW129p/_new 2017-12-01 17:17:05.947927474 +0100 @@ -17,7 +17,7 @@ Name: yast2-registration -Version: 4.0.10 +Version: 4.0.13 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ yast2-registration-4.0.10.tar.bz2 -> yast2-registration-4.0.13.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-4.0.10/devel/dump_ay_addons.rb new/yast2-registration-4.0.13/devel/dump_ay_addons.rb --- old/yast2-registration-4.0.10/devel/dump_ay_addons.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-registration-4.0.13/devel/dump_ay_addons.rb 2017-11-28 11:39:05.401523664 +0100 @@ -0,0 +1,48 @@ +#! /usr/bin/ruby + +# This is a simple generator for creating the addons list displayed at +# https://github.com/yast/yast-registration/wiki/Available-SCC-Extensions-for-Use-in-Autoyast +# from the /var/log/YaST2/registration_addons.yml file. + +require "yast" +require "registration/addon" +require "registration/addon_sorter" + +require_relative "yaml_workaround" + +INDENT_WIDTH = 4 + +# convert addon data to an XML document snippet +def dump_addon(a) + prefix = " " * INDENT_WIDTH + + ret = prefix + "<!-- #{a.name} -->\n" + + ret += prefix + "<!-- Depends on: #{a.depends_on.name} -->\n" if a.depends_on + + ret += prefix + "<name>#{a.identifier}</name>\n" + + prefix + "<version>#{a.version}</version>\n" + + prefix + "<arch>#{a.arch}</arch>\n" + + ret += prefix + "<reg_code>REG_CODE_REQUIRED</reg_code>\n" unless a.free + + ret +end + +if ARGV[0] + addons = YAML.load_file(ARGV[0]) + # sort the addons + addons.sort!(&::Registration::ADDON_SORTER) + + puts "<addons config:type=\"list\">" + puts addons.map { |a| dump_addon(a) }.join("\n") + puts "</addons>" +else + puts "This is a simple generator for AutoYaST addons configuration." + puts + puts "Usage: dump_ay_addons <file_path>" + puts + puts " <file_path> is the addons dump file, originally stored at" + puts " /var/log/YaST2/registration_addons.yml" + exit 1 +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-4.0.10/devel/dump_reader.rb new/yast2-registration-4.0.13/devel/dump_reader.rb --- old/yast2-registration-4.0.10/devel/dump_reader.rb 2017-10-27 15:02:16.818291893 +0200 +++ new/yast2-registration-4.0.13/devel/dump_reader.rb 2017-11-28 11:39:05.401523664 +0100 @@ -6,28 +6,7 @@ require "yast" require "registration/addon" -# Monkey Patch to workaround issue in ruby 2.4 Psych (bsc#1048526) -# when fixed or if suseconnect is changed then remove -# (copied from test/spec_helper.rb) -module SUSE - module Connect - module Remote - class Product - alias_method :initialize_orig, :initialize - def initialize(arg = {}) - initialize_orig(arg) - end - end - - class Service - alias_method :initialize_orig, :initialize - def initialize(arg = { "product" => {} }) - initialize_orig(arg) - end - end - end - end -end +require_relative "yaml_workaround" INDENT_WIDTH = 2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-4.0.10/devel/yaml_workaround.rb new/yast2-registration-4.0.13/devel/yaml_workaround.rb --- old/yast2-registration-4.0.10/devel/yaml_workaround.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-registration-4.0.13/devel/yaml_workaround.rb 2017-11-28 11:39:05.401523664 +0100 @@ -0,0 +1,22 @@ +# Monkey Patch to workaround issue in ruby 2.4 Psych (bsc#1048526) +# when fixed or if suseconnect is changed then remove +# (copied from test/spec_helper.rb) +module SUSE + module Connect + module Remote + class Product + alias_method :initialize_orig, :initialize + def initialize(arg = {}) + initialize_orig(arg) + end + end + + class Service + alias_method :initialize_orig, :initialize + def initialize(arg = { "product" => {} }) + initialize_orig(arg) + end + end + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-4.0.10/package/yast2-registration.changes new/yast2-registration-4.0.13/package/yast2-registration.changes --- old/yast2-registration-4.0.10/package/yast2-registration.changes 2017-10-27 15:02:16.818291893 +0200 +++ new/yast2-registration-4.0.13/package/yast2-registration.changes 2017-11-28 11:39:05.401523664 +0100 @@ -1,4 +1,22 @@ ------------------------------------------------------------------- +Wed Nov 22 09:52:16 UTC 2017 - lsle...@suse.cz + +- AutoYaST fixes (bsc#1065438): + - fixed addon registration order + - automatically register the dependant addons +- Preselect also the recommended beta addons, display them by + default even when the beta filter is active + (related to bsc#1056413) +- 4.0.13 + +------------------------------------------------------------------- +Wed Nov 8 14:36:05 CET 2017 - sch...@suse.de + +- Changed warning text if user has skipped registration. + (bnc#1055023) +- 4.0.12 + +------------------------------------------------------------------- Fri Oct 27 12:44:58 UTC 2017 - lsle...@suse.cz - Do not preselect the default addons when some addon is already diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-4.0.10/package/yast2-registration.spec new/yast2-registration-4.0.13/package/yast2-registration.spec --- old/yast2-registration-4.0.10/package/yast2-registration.spec 2017-10-27 15:02:16.818291893 +0200 +++ new/yast2-registration-4.0.13/package/yast2-registration.spec 2017-11-28 11:39:05.401523664 +0100 @@ -17,7 +17,7 @@ Name: yast2-registration -Version: 4.0.10 +Version: 4.0.13 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-4.0.10/src/clients/scc_auto.rb new/yast2-registration-4.0.13/src/clients/scc_auto.rb --- old/yast2-registration-4.0.10/src/clients/scc_auto.rb 2017-10-27 15:02:16.818291893 +0200 +++ new/yast2-registration-4.0.13/src/clients/scc_auto.rb 2017-11-28 11:39:05.401523664 +0100 @@ -30,6 +30,7 @@ require "registration/storage" require "registration/sw_mgmt" +require "registration/autoyast_addons" require "registration/registration" require "registration/registration_ui" require "registration/helpers" @@ -308,29 +309,18 @@ # register the addons specified in the profile def register_addons - # register addons - @config.addons.each do |addon| - product_service = register_addon(addon) + # set the option for installing the updates for addons + options = Registration::Storage::InstallationOptions.instance + options.install_updates = @config.install_updates + + ay_addons_handler = Registration::AutoyastAddons.new(@config.addons, registration) + ay_addons_handler.select + ay_addons_handler.register - ::Registration::Storage::Cache.instance.addon_services << product_service - - registration_ui.disable_update_repos(product_service) if !@config.install_updates - end - - # install the new products + # select the new products to install ::Registration::SwMgmt.select_addon_products end - def register_addon(addon) - Popup.Feedback( - _(CONTACTING_MESSAGE), - # %s is name of given product - _("Registering %s ...") % addon["name"] - ) do - registration.register_product(addon) - end - end - # was the system already registered? # @return [Boolean] true if the system was alreay registered def old_system_registered? diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-4.0.10/src/lib/registration/addon.rb new/yast2-registration-4.0.13/src/lib/registration/addon.rb --- old/yast2-registration-4.0.10/src/lib/registration/addon.rb 2017-10-27 15:02:16.822291893 +0200 +++ new/yast2-registration-4.0.13/src/lib/registration/addon.rb 2017-11-28 11:39:05.401523664 +0100 @@ -44,6 +44,8 @@ def reset! @cached_addons = nil @registered = nil + @selected = nil + @auto_selected = nil end # list of registered add-ons diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-4.0.10/src/lib/registration/autoyast_addons.rb new/yast2-registration-4.0.13/src/lib/registration/autoyast_addons.rb --- old/yast2-registration-4.0.10/src/lib/registration/autoyast_addons.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-registration-4.0.13/src/lib/registration/autoyast_addons.rb 2017-11-28 11:39:05.405523664 +0100 @@ -0,0 +1,127 @@ +# ------------------------------------------------------------------------------ +# Copyright (c) 2017 SUSE LLC +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of version 2 of the GNU General Public License as published by the +# Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# ------------------------------------------------------------------------------ +# + +require "yast" + +module Registration + # This class handles the AutoYaST addons + class AutoyastAddons + include Yast::I18n + + attr_accessor :requested_addons, :selected_addons + + Yast.import "Report" + + # Constructor + # @param requested_addons [Array<Hash<String,String>>] the addons configuration + # from the AutoYaST profile + # @param registration [Registration::Registration] the Registration object to use + # for registering the addons + def initialize(requested_addons, registration) + textdomain "registration" + + self.requested_addons = requested_addons + self.registration = registration + end + + # read the available addons from the server, sort the addons from the profile + # according to the dependencies + def select + # ask the server for all available addons (with UI feedback) + all_addons = registration_ui.get_available_addons + + # remove the addons marked as not available + rejected = all_addons.reject! { |a| a.available? == false } + log.info("Not available addons: #{rejected.map(&:label).inspect}") if rejected + + # select the requested addons from the available addons + self.selected_addons = select_addons(all_addons) + end + + # register the selected addons, the #select method must be called before + def register + regcodes = collect_reg_codes + registration_ui.register_addons(selected_addons, regcodes) + end + + private + + attr_writer :selected_addons + attr_accessor :registration + + # select the requested addons + # @param all_addons [Array<Registration::Addon>] all addons available on the server + def select_addons(all_addons) + # select the requested addons from the AY profile + requested_addons.each do |addon| + server_addon = all_addons.find do |a| + a.identifier == addon["name"] && a.version == addon["version"] && + a.arch == addon["arch"] + end + + if server_addon + # mark it as selected + server_addon.selected + else + # otherwise report an error + report_missing_addon(addon) + end + end + + ordered_addons + end + + # report error about a missing addon + # @param addon [Hash] + def report_missing_addon(addon) + log.error("Unavailable addon: #{addon.inspect}") + Yast::Report.Error( + # TRANSLATORS: %s is an addon name (including version and arch) + # from the AutoYast XML installation profile + _("Addon '%s'\nis not available for registration.") % \ + "#{addon["name"]}-#{addon["version"]}-#{addon["arch"]}" + ) + end + + # Order the addons according to thier dependencies, the result is sorted + # in the registration order. The result also includes the dependant addons + # (even not specified in the profile). + # @return [Array<Registration::Addon>] + def ordered_addons + # include also the automatically selected dependent modules/extensions + ret = Addon.registration_order(Addon.selected + Addon.auto_selected) + + log.info("Addons to register: #{ret.map(&:label).inspect}") + + ret + end + + # collect the registration codes specified in the profile + # @return [Hash<String,String>] mapping "product identifier" => "reg code" + def collect_reg_codes + ret = {} + + requested_addons.each do |a| + ret[a["name"]] = a["reg_code"] if a["reg_code"] + end + + log.info("Found reg codes for addons: #{ret.keys.inspect}") + + ret + end + + def registration_ui + @registration_ui ||= RegistrationUI.new(registration) + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-4.0.10/src/lib/registration/ui/addon_selection_base_dialog.rb new/yast2-registration-4.0.13/src/lib/registration/ui/addon_selection_base_dialog.rb --- old/yast2-registration-4.0.10/src/lib/registration/ui/addon_selection_base_dialog.rb 2017-10-27 15:02:16.826291893 +0200 +++ new/yast2-registration-4.0.13/src/lib/registration/ui/addon_selection_base_dialog.rb 2017-11-28 11:39:05.409523664 +0100 @@ -41,11 +41,10 @@ self.class.filter_beta = FILTER_BETAS_INITIALLY if self.class.filter_beta.nil? + preselect_recommended filter_beta_releases(self.class.filter_beta) @old_selection = Addon.selected.dup - - preselect_recommended end # reimplement this in a subclass @@ -69,8 +68,9 @@ def filter_beta_releases(enable) self.class.filter_beta = enable if enable - @addons, available_addons = @all_addons.partition(&:registered?) - @addons.concat(available_addons.reject(&:beta_release?)) + @addons = @all_addons.select do |a| + a.registered? || a.selected? || !a.beta_release? + end else @addons = @all_addons end @@ -323,9 +323,9 @@ def preselect_recommended # something is already selected/registered, keep the user selection unchanged - return if !Addon.selected.empty? || !Addon.registered.empty? || @addons.nil? + return if !Addon.selected.empty? || !Addon.registered.empty? - @addons.each do |a| + @all_addons.each do |a| next unless a.recommended log.info("Preselecting a default addon: #{a.friendly_name}") a.selected diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-4.0.10/src/lib/registration/ui/base_system_registration_dialog.rb new/yast2-registration-4.0.13/src/lib/registration/ui/base_system_registration_dialog.rb --- old/yast2-registration-4.0.10/src/lib/registration/ui/base_system_registration_dialog.rb 2017-10-27 15:02:16.826291893 +0200 +++ new/yast2-registration-4.0.13/src/lib/registration/ui/base_system_registration_dialog.rb 2017-11-28 11:39:05.409523664 +0100 @@ -359,10 +359,16 @@ # @return [Boolean] true when skipping has been confirmed def show_skipping_warning # Popup question: confirm skipping the registration - warning = _("If you do not register your system we will not be able\n" \ - "to grant you access to the update repositories.\n\n" \ - "You can register after the installation or visit our\n" \ - "Customer Center for online registration.") + # TRANSLATORS: + # %{media_name} is the media name (e.g. SLE-15-Packages), + # %{download_url} is an URL link (e.g. https://download.suse.com) + warning = _("Without registration, update channels will not be\n" \ + "configured. This disables updates and security fixes.\n\n" \ + "A full system can be installed using the\n" \ + "%{media_name} media from %{download_url}.\n" \ + "Without these media only a minimum system is available\n" \ + "in this installation.") % + { media_name: "SLE-15-Packages", download_url: "https://download.suse.com" } Yast::Popup.Warning(warning) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-4.0.10/test/addon_selection_dialog_test.rb new/yast2-registration-4.0.13/test/addon_selection_dialog_test.rb --- old/yast2-registration-4.0.10/test/addon_selection_dialog_test.rb 2017-10-27 15:02:16.830291893 +0200 +++ new/yast2-registration-4.0.13/test/addon_selection_dialog_test.rb 2017-11-28 11:39:05.413523664 +0100 @@ -206,6 +206,16 @@ allow(subject).to receive(:RichText).and_call_original dialog.run end + + it "displays recommended beta add-ons" do + allow(addon).to receive(:beta_release?).and_return(true) + allow(addon).to receive(:registered?).and_return(false) + allow(addon).to receive(:recommended).and_return(true) + allow(Registration::Addon).to receive(:find_all).and_return([addon]) + expect(subject).to receive(:RichText).with(Yast::Term.new(:id, :items), /#{addon.name}/) + allow(subject).to receive(:RichText).and_call_original + dialog.run + end end context "when there is no beta versions to filter" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-4.0.10/test/autoyast_addons_spec.rb new/yast2-registration-4.0.13/test/autoyast_addons_spec.rb --- old/yast2-registration-4.0.10/test/autoyast_addons_spec.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-registration-4.0.13/test/autoyast_addons_spec.rb 2017-11-28 11:39:05.413523664 +0100 @@ -0,0 +1,99 @@ +#! /usr/bin/env rspec + +require_relative "spec_helper" +require "yaml" + +describe Registration::AutoyastAddons do + let(:registration) { double("registration") } + let(:unsorted_addons) do + [ + # deliberately in a wrong registration order, the "sle-module-basesystem" + # module needs to be registered first + { "name" => "sle-module-desktop-applications", "version" => "15", "arch" => "x86_64" }, + { "name" => "sle-module-basesystem", "version" => "15", "arch" => "x86_64" } + ] + end + + # it depends on the "sle-module-basesystem" which is not listed here + let(:incomplete_addons) do + ["name" => "sle-module-desktop-applications", "version" => "15", + "arch" => "x86_64"] + end + + # the basesystem module does not need a reg. key in reality + # but let's use it in this test for the simplicity + let(:addons_with_reg_key) do + ["name" => "sle-module-basesystem", "version" => "15", "arch" => "x86_64", + "reg_code" => "abcd42"] + end + + # some dummy non-existing addon to test error handling + let(:missing_addons) do + ["name" => "non-existing-module", "version" => "42", "arch" => "x86_64"] + end + + # the addons to register in the expcted correct order + let(:expected_registration_order) { ["sle-module-basesystem", "sle-module-desktop-applications"] } + + before do + addons = load_yaml_fixture("sle15_addons.yaml") + allow(Registration::Addon).to receive(:find_all).and_return(addons) + allow(registration).to receive(:get_addon_list).and_return(addons) + end + + after do + Registration::Addon.reset! + end + + describe "#select" do + it "sorts the addons according to their dependencies" do + ayaddons = Registration::AutoyastAddons.new(unsorted_addons, registration) + ayaddons.select + + expect(ayaddons.selected_addons.map(&:identifier)).to eq(expected_registration_order) + end + + it "automatically selects the dependent addons" do + ayaddons = Registration::AutoyastAddons.new(incomplete_addons, registration) + ayaddons.select + + expect(ayaddons.selected_addons.map(&:identifier)).to eq(expected_registration_order) + end + + it "reports error for not available addons" do + expect(Yast::Report).to receive(:Error).with(/is not available for registration/) + + ayaddons = Registration::AutoyastAddons.new(missing_addons, registration) + ayaddons.select + end + end + + describe "#register" do + it "registers the selected addons" do + expect(registration).to receive(:register_product).with( + "name" => "sle-module-basesystem", "reg_code" => nil, "arch" => "x86_64", + "version" => "15" + ).ordered + expect(registration).to receive(:register_product).with( + "name" => "sle-module-desktop-applications", "reg_code" => nil, + "arch" => "x86_64", "version" => "15" + ).ordered + + ayaddons = Registration::AutoyastAddons.new(unsorted_addons, registration) + ayaddons.select + ayaddons.register + end + + it "registers the selected addon using the provided reg. key" do + expect(registration).to receive(:register_product).with( + "name" => "sle-module-basesystem", "reg_code" => "abcd42", "arch" => "x86_64", + "version" => "15" + ) + + ayaddons = Registration::AutoyastAddons.new(addons_with_reg_key, registration) + ayaddons.select + ayaddons.register + end + end + +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-4.0.10/test/base_system_registration_dialog_test.rb new/yast2-registration-4.0.13/test/base_system_registration_dialog_test.rb --- old/yast2-registration-4.0.10/test/base_system_registration_dialog_test.rb 2017-10-27 15:02:16.830291893 +0200 +++ new/yast2-registration-4.0.13/test/base_system_registration_dialog_test.rb 2017-11-28 11:39:05.413523664 +0100 @@ -156,7 +156,7 @@ context "when user skips registration" do it "does not try to register the system and close the dialog" do allow(Yast::UI).to receive(:UserInput).and_return(:skip_registration, :next) - expect(Yast::Popup).to receive(:Warning).with(/If you do not register/) + expect(Yast::Popup).to receive(:Warning).with(/Without registration/) .and_return(true) expect(subject.run).to eq(:skip) end