Hello community, here is the log from the commit of package yast2-installation for openSUSE:Factory checked in at 2017-02-04 15:19:22 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-installation (Old) and /work/SRC/openSUSE:Factory/.yast2-installation.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-installation" Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-installation/yast2-installation.changes 2017-02-03 20:07:45.487975593 +0100 +++ /work/SRC/openSUSE:Factory/.yast2-installation.new/yast2-installation.changes 2017-02-04 16:52:28.365738147 +0100 @@ -1,0 +2,46 @@ +Fri Feb 3 10:07:35 UTC 2017 - jsr...@suse.cz + +- Downloading release notes: Do not download them at all during + AutoYaST (bsc#1009276) +- Use the directory.yast file to check avilable + translations (fate#322372) +- 3.2.20 + +------------------------------------------------------------------- +Wed Feb 1 17:07:23 CET 2017 - sch...@suse.de + +- Downloading release notes: Do not try again if the host or the + proxy cannot be resolved (bnc#1022784) +- 3.2.19 + +------------------------------------------------------------------- +Fri Jan 27 15:55:33 UTC 2017 - kanders...@suse.com + +- Ask for installation confirmation in all-in-one dialog before + proceed with it. (Fate#322328) +- 3.2.18 + +------------------------------------------------------------------- +Fri Jan 27 09:11:32 UTC 2017 - jreidin...@suse.com + +- Respect newly registered update repos in software proposal and + do register. (FATE#322328) + +------------------------------------------------------------------- +Thu Jan 26 14:16:43 UTC 2017 - jreidin...@suse.com + +- handle proposal errors in all-in-one dialog (FATE#322328) + +------------------------------------------------------------------- +Wed Jan 25 15:29:02 UTC 2017 - mvid...@suse.com + +- Added an all-in-one installation overview for CaaSP (FATE#322328) + +------------------------------------------------------------------- +Wed Jan 25 10:41:33 UTC 2017 - igonzalezs...@suse.com + +- Add an option to disable the self-update feature through the + AutoYaST profile (FATE#319716) +- 3.2.17 + +------------------------------------------------------------------- Old: ---- yast2-installation-3.2.16.tar.bz2 New: ---- yast2-installation-3.2.20.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-installation.spec ++++++ --- /var/tmp/diff_new_pack.o88xcb/_old 2017-02-04 16:52:28.905661273 +0100 +++ /var/tmp/diff_new_pack.o88xcb/_new 2017-02-04 16:52:28.909660704 +0100 @@ -17,7 +17,7 @@ Name: yast2-installation -Version: 3.2.16 +Version: 3.2.20 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -82,11 +82,11 @@ # Requires: yast2-update # new root password cwm widget -Requires: yast2-users >= 3.2.7 -# new keyboard layout cwm widget needed only for CASP, so use version that works -# also for SP3 -# FIXME: update dependency when CASP is merged to SP2 and SP3 for yast2-country -Requires: yast2-country >= 3.1.30 +BuildRequires: yast2-users >= 3.2.8 +Requires: yast2-users >= 3.2.8 +# new keyboard layout cwm widget +BuildRequires: yast2-country >= 3.2.7 +Requires: yast2-country >= 3.2.7 # Pkg::SourceProvideSignedFile Pkg::SourceProvideDigestedFile # pkg-bindings are not directly required @@ -104,8 +104,8 @@ # Top bar with logo Conflicts: yast2-ycp-ui-bindings < 3.1.7 -# RegserviceSelectionDialog -Conflicts: yast2-registration < 3.1.179 +# new registration widget +Conflicts: yast2-registration <= 3.2.1 Obsoletes: yast2-installation-devel-doc ++++++ yast2-installation-3.2.16.tar.bz2 -> yast2-installation-3.2.20.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-3.2.16/doc/SELF_UPDATE.md new/yast2-installation-3.2.20/doc/SELF_UPDATE.md --- old/yast2-installation-3.2.16/doc/SELF_UPDATE.md 2017-01-24 13:35:27.696000000 +0100 +++ new/yast2-installation-3.2.20/doc/SELF_UPDATE.md 2017-02-03 14:17:23.482807975 +0100 @@ -7,9 +7,21 @@ ## Disabling Updates -Self-update is enabled by default. However, it can be disabled by setting -`self_update=0` boot option. In the following sections it is assumed that this -feature is enabled. +Starting in SUSE Linux Enterprise 12 SP3, self-update is enabled by default. +However, it can be disabled by setting `self_update=0` boot option. If you're +using AutoYaST, it is also possible to disable this feature using the +`self_update` element in the `general` section of the profile: + + ```xml + <general> + <self_update config:type="boolean">false</self_update> + </general> + ``` + +Please, take into account that self-update will be skipped if any option +disables it (boot parameter *or* AutoYaST profile). + +During the rest of this document it is assumed that self-update is enabled. ## Basic Workflow diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-3.2.16/package/yast2-installation.changes new/yast2-installation-3.2.20/package/yast2-installation.changes --- old/yast2-installation-3.2.16/package/yast2-installation.changes 2017-01-24 13:35:28.112000000 +0100 +++ new/yast2-installation-3.2.20/package/yast2-installation.changes 2017-02-03 14:17:23.494813976 +0100 @@ -1,4 +1,50 @@ ------------------------------------------------------------------- +Fri Feb 3 10:07:35 UTC 2017 - jsr...@suse.cz + +- Downloading release notes: Do not download them at all during + AutoYaST (bsc#1009276) +- Use the directory.yast file to check avilable + translations (fate#322372) +- 3.2.20 + +------------------------------------------------------------------- +Wed Feb 1 17:07:23 CET 2017 - sch...@suse.de + +- Downloading release notes: Do not try again if the host or the + proxy cannot be resolved (bnc#1022784) +- 3.2.19 + +------------------------------------------------------------------- +Fri Jan 27 15:55:33 UTC 2017 - kanders...@suse.com + +- Ask for installation confirmation in all-in-one dialog before + proceed with it. (Fate#322328) +- 3.2.18 + +------------------------------------------------------------------- +Fri Jan 27 09:11:32 UTC 2017 - jreidin...@suse.com + +- Respect newly registered update repos in software proposal and + do register. (FATE#322328) + +------------------------------------------------------------------- +Thu Jan 26 14:16:43 UTC 2017 - jreidin...@suse.com + +- handle proposal errors in all-in-one dialog (FATE#322328) + +------------------------------------------------------------------- +Wed Jan 25 15:29:02 UTC 2017 - mvid...@suse.com + +- Added an all-in-one installation overview for CaaSP (FATE#322328) + +------------------------------------------------------------------- +Wed Jan 25 10:41:33 UTC 2017 - igonzalezs...@suse.com + +- Add an option to disable the self-update feature through the + AutoYaST profile (FATE#319716) +- 3.2.17 + +------------------------------------------------------------------- Fri Jan 20 08:44:28 UTC 2017 - mfi...@suse.com - bnc#1017752 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-3.2.16/package/yast2-installation.spec new/yast2-installation-3.2.20/package/yast2-installation.spec --- old/yast2-installation-3.2.16/package/yast2-installation.spec 2017-01-24 13:35:28.112000000 +0100 +++ new/yast2-installation-3.2.20/package/yast2-installation.spec 2017-02-03 14:17:23.494813976 +0100 @@ -17,7 +17,7 @@ Name: yast2-installation -Version: 3.2.16 +Version: 3.2.20 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -82,11 +82,11 @@ # Requires: yast2-update # new root password cwm widget -Requires: yast2-users >= 3.2.7 -# new keyboard layout cwm widget needed only for CASP, so use version that works -# also for SP3 -# FIXME: update dependency when CASP is merged to SP2 and SP3 for yast2-country -Requires: yast2-country >= 3.1.30 +BuildRequires: yast2-users >= 3.2.8 +Requires: yast2-users >= 3.2.8 +# new keyboard layout cwm widget +BuildRequires: yast2-country >= 3.2.7 +Requires: yast2-country >= 3.2.7 # Pkg::SourceProvideSignedFile Pkg::SourceProvideDigestedFile # pkg-bindings are not directly required @@ -104,8 +104,8 @@ # Top bar with logo Conflicts: yast2-ycp-ui-bindings < 3.1.7 -# RegserviceSelectionDialog -Conflicts: yast2-registration < 3.1.179 +# new registration widget +Conflicts: yast2-registration <= 3.2.1 Obsoletes: yast2-installation-devel-doc diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-3.2.16/src/clients/inst_casp_overview.rb new/yast2-installation-3.2.20/src/clients/inst_casp_overview.rb --- old/yast2-installation-3.2.16/src/clients/inst_casp_overview.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-installation-3.2.20/src/clients/inst_casp_overview.rb 2017-02-03 14:17:23.494813976 +0100 @@ -0,0 +1,2 @@ +require "installation/clients/inst_casp_overview" +::Installation::InstCaspOverview.new.run diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-3.2.16/src/lib/installation/clients/inst_casp_overview.rb new/yast2-installation-3.2.20/src/lib/installation/clients/inst_casp_overview.rb --- old/yast2-installation-3.2.16/src/lib/installation/clients/inst_casp_overview.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-installation-3.2.20/src/lib/installation/clients/inst_casp_overview.rb 2017-02-03 14:17:23.502817976 +0100 @@ -0,0 +1,156 @@ +# encoding: utf-8 + +# ------------------------------------------------------------------------------ +# 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. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, contact SUSE. +# +# To contact SUSE about this file by physical or electronic mail, you may find +# current contact information at www.suse.com. +# ------------------------------------------------------------------------------ + +require "users/widgets" +require "y2country/widgets" +require "ui/widgets" +require "tune/widgets" +require "registration/widgets/registration_code" + +require "installation/widgets/overview" +require "installation/widgets/system_role" + +module Installation + # This library provides a simple dialog for setting + # - the password for the system administrator (root) + # - the keyboard layout + # This dialog does not write the password to the system, + # only stores it in UsersSimple module, + # to be written during inst_finish. + class InstCaspOverview + include Yast::Logger + include Yast::I18n + include Yast::UIShortcuts + + def run + Yast.import "UI" + Yast.import "Language" + Yast.import "Mode" + Yast.import "CWM" + Yast.import "Popup" + Yast.import "Pkg" + + textdomain "installation" + + # Simplified work-flow do not contain language proposal, but have software one. + # So avoid false positive detection of language change + Yast::Pkg.SetPackageLocale(Yast::Language.language) + + # We do not need to create a wizard dialog in installation, but it's + # helpful when testing all manually on a running system + Yast::Wizard.CreateDialog if separate_wizard_needed? + + ret = nil + loop do + ret = Yast::CWM.show( + content, + # Title for installation overview dialog + caption: _("Installation Overview"), + # Button label: start the installation + next_button: _("Install"), + # do not show abort and back button + abort_button: "", + back_button: "", + # do not store stuff when just redrawing + skip_store_for: [:redraw] + ) + next if ret == :redraw + + # do software proposal + d = Yast::WFM.CallFunction("software_proposal", + [ + "MakeProposal", + { "simple_mode" => true } + ]) + # report problems with sofware proposal + if [:blocker, :fatal].include?(d["warning_level"]) + # %s is a problem description + Yast::Popup.Error( + _("Software proposal failed. Cannot proceed with installation.\n%s") % d["warning"] + ) + # continue only if confirmed + elsif Yast::WFM.CallFunction("inst_doit", []) == :next + break + end + end + + Yast::Wizard.CloseDialog if separate_wizard_needed? + + ret + end + + private + + def quadrant_layout(upper_left:, lower_left:, upper_right:, lower_right:) + HBox( + HWeight( + 6, + VBox( + VWeight(5, upper_left), + VStretch(), + VWeight(5, lower_left) + ) + ), + HSpacing(3), + HWeight( + 4, + VBox( + VWeight(5, upper_right), + VStretch(), + VWeight(5, lower_right) + ) + ) + ) + end + + # Returns a pair with UI widget-set for the dialog and widgets that can + # block installation + def content + dashboard = Installation::Widgets::DashboardPlace.new + quadrant_layout( + upper_left: VBox( + ::Registration::Widgets::RegistrationCode.new, + ::Users::PasswordWidget.new(little_space: true), + # use english us as default keyboard layout + ::Y2Country::Widgets::KeyboardSelectionCombo.new("english-us") + ), + lower_left: VBox( + Installation::Widgets::SystemRole.new(dashboard), + dashboard, + Tune::Widgets::SystemInformation.new + ), + upper_right: VBox( + Installation::Widgets::Overview.new(client: "partitions_proposal"), + Installation::Widgets::Overview.new(client: "bootloader_proposal") + ), + lower_right: VBox( + Installation::Widgets::Overview.new(client: "network_proposal"), + Installation::Widgets::Overview.new(client: "kdump_proposal") + ) + ) + end + + # Returns whether we need/ed to create new UI Wizard + def separate_wizard_needed? + Yast::Mode.normal + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-3.2.16/src/lib/installation/clients/inst_download_release_notes.rb new/yast2-installation-3.2.20/src/lib/installation/clients/inst_download_release_notes.rb --- old/yast2-installation-3.2.16/src/lib/installation/clients/inst_download_release_notes.rb 2017-01-24 13:35:28.368000000 +0100 +++ new/yast2-installation-3.2.20/src/lib/installation/clients/inst_download_release_notes.rb 2017-02-03 14:17:23.502817976 +0100 @@ -31,9 +31,53 @@ # When cURL returns one of those codes, the download won't be retried # @see man curl - # 7 = Failed to connect to host. - # 28 = Operation timeout. - CURL_GIVE_UP_RETURN_CODES = [7, 28].freeze + CURL_GIVE_UP_RETURN_CODES = { + 5 => "Couldn't resolve proxy.", + 6 => "Couldn't resolve host.", + 7 => "Failed to connect to host.", + 28 => "Operation timeout." + }.freeze + + # Download of index of release notes for a specific product + # @param url_base URL pointing to directory with the index + # @param proxy the proxy URL to be passed to curl + # + # @return true when successful + def download_release_notes_index(url_base, proxy) + url_index = url_base + "/directory.yast2" + log.info("Index with available files: #{url_index}") + filename = Builtins.sformat("%1/directory.yast", SCR.Read(path(".target.tmpdir"))) + # download the index with much shorter time-out + cmd = Builtins.sformat( + "/usr/bin/curl --location --verbose --fail --max-time 30 --connect-timeout 15 %1 '%2' --output '%3' > '%4/%5' 2>&1", + proxy, + url_index, + String.Quote(filename), + String.Quote(Directory.logdir), + "curl_log" + ) + ret = SCR.Execute(path(".target.bash"), cmd) + log.info("Downloading release notes index: #{cmd} returned #{ret}") + if ret == 0 + log.info("Release notes index downloaded successfully") + index_file = File.read(filename) + if index_file.nil? || index_file.empty? + log.info("Release notes index empty, not filtering further downloads") + return nil + else + rn_filter = index_file.split("\n") + log.info("Index of RN files at the server: #{rn_filter}") + return rn_filter + end + elsif CURL_GIVE_UP_RETURN_CODES.key? ret + log.info "Communication with server for release notes download failed ( #{CURL_GIVE_UP_RETURN_CODES[ret]} ), skipping further attempts." + InstData.stop_relnotes_download = true + return nil + else + log.info "Downloading index failed, trying all files according to selected language" + return nil + end + end # Download all release notes mentioned in Product::relnotesurl_all # @@ -93,9 +137,23 @@ next end url_base = url[0, pos] + + rn_filter = download_release_notes_index(url_base, proxy) + if InstData.stop_relnotes_download + log.info("Skipping release notes download due to previous download issues") + break + end + url_template = url_base + filename_templ log.info("URL template: #{url_base}") [Language.language, Language.language[0..1], "en"].uniq.each do |lang| + if !rn_filter.nil? + filename = Builtins.sformat(filename_templ, lang) + if !rn_filter.include?(filename[1..-1]) + log.info "File #{filename} not found in index, skipping attempt download" + next + end + end url = Builtins.sformat(url_template, lang) log.info("URL: #{url}") # Where we want to store the downloaded release notes @@ -123,8 +181,8 @@ InstData.release_notes[product["short_name"]] = SCR.Read(path(".target.string"), filename) InstData.downloaded_release_notes << product["short_name"] break - elsif CURL_GIVE_UP_RETURN_CODES.include?(ret) - log.info "Communication with server for release notes download failed, skipping further attempts." + elsif CURL_GIVE_UP_RETURN_CODES.key? ret + log.info "Communication with server for release notes download failed ( #{CURL_GIVE_UP_RETURN_CODES[ret]} ), skipping further attempts." InstData.stop_relnotes_download = true break else @@ -161,6 +219,12 @@ return :back if GetInstArgs.going_back + # skip download during AutoYaST + if Mode.auto + log.info "Skipping release notes during AutoYaST-driven installation or upgrade" + return :auto + end + init_ui download_release_notes diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-3.2.16/src/lib/installation/clients/inst_update_installer.rb new/yast2-installation-3.2.20/src/lib/installation/clients/inst_update_installer.rb --- old/yast2-installation-3.2.16/src/lib/installation/clients/inst_update_installer.rb 2017-01-24 13:35:28.400000000 +0100 +++ new/yast2-installation-3.2.20/src/lib/installation/clients/inst_update_installer.rb 2017-02-03 14:17:23.506819976 +0100 @@ -63,13 +63,12 @@ return :next end - initialize_progress - if Mode.auto process_profile - Yast::Progress.NextStage + return :next if disabled_in_profile? end + initialize_progress initialize_packager # self-update not possible, the repo URL is not defined @@ -149,6 +148,14 @@ Linuxrc.InstallInf("SelfUpdate") == "0" end + # Determines whether self-update feature is disabled via AutoYaST profile + # + # @return [Boolean] true if self update has been disabled by AutoYaST profile + def disabled_in_profile? + profile = Yast::Profile.current + !profile.fetch("general", {}).fetch("self_update", true) + end + # Return the self-update URLs # # @return [Array<URI>] self-update URLs @@ -582,8 +589,6 @@ _("Restart") ] - stages.unshift(_("Fetching AutoYast Profile")) if Mode.auto - # open a new wizard dialog with title on the top # (the default dialog with title on the left looks ugly with the # Progress dialog) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-3.2.16/src/lib/installation/widgets/overview.rb new/yast2-installation-3.2.20/src/lib/installation/widgets/overview.rb --- old/yast2-installation-3.2.16/src/lib/installation/widgets/overview.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-installation-3.2.20/src/lib/installation/widgets/overview.rb 2017-02-03 14:17:23.510821975 +0100 @@ -0,0 +1,112 @@ +# encoding: utf-8 + +# ------------------------------------------------------------------------------ +# 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. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, contact SUSE. +# +# To contact SUSE about this file by physical or electronic mail, you may find +# current contact information at www.suse.com. +# ------------------------------------------------------------------------------ + +require "yast" +require "cwm/widget" + +Yast.import "Popup" + +module Installation + module Widgets + # A widget for an all-in-one installation dialog. + # It uses the `simple_mode` of {Installation::ProposalClient#make_proposal} + # It is immutable, so for showing new values reinitialize widget + class Overview < CWM::CustomWidget + attr_reader :proposal_client + + # @param client [String] A proposal client implementing simple_mode, + # eg. "bootloader_proposal" + def initialize(client:) + textdomain "installation" + @proposal_client = client + # by default widget_id is the class name; must differentiate instances + self.widget_id = "overview_" + client + @blocking = false + end + + def contents + VBox( + Left(PushButton(Id(button_id), label)), + * items.map { |i| Left(Label(" * #{i}")) } + ) + end + + def label + return @label if @label + + d = Yast::WFM.CallFunction(proposal_client, ["Description", {}]) + @label = d["menu_title"] + end + + def items + return @items if @items + + d = Yast::WFM.CallFunction(proposal_client, + [ + "MakeProposal", + { "simple_mode" => true } + ]) + if d["warning"] && !d["warning"].empty? && d["warning_level"] != :notice + Yast::Popup.LongError( + format( + _("Problem found when proposing %{client}:<br>" \ + "Severity: %{severity}<br>" \ + "Message: %{message}"), + client: label.delete("&"), + severity: (d["warning_level"] || :warning).to_s, + message: d["warning"] + ) + ) + @blocking = [:blocker, :fatal].include?(d["warning_level"]) + end + @items = d["label_proposal"] + end + + def handle(_event) + Yast::WFM.CallFunction(proposal_client, ["AskUser", {}]) + :redraw + end + + def validate + return true unless @blocking + + # %s is a heading of a problematic section, like "Partitioning" or "Network" + Yast::Popup.Error( + _("%s blocks the installation. Please solve the problem there before proceeding.") % + label.delete("&") + ) + + false + end + + def blocking? + @blocking + end + + private + + def button_id + # an arbitrary unique id + "ask_" + proposal_client + end + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-3.2.16/src/lib/installation/widgets/system_role.rb new/yast2-installation-3.2.20/src/lib/installation/widgets/system_role.rb --- old/yast2-installation-3.2.16/src/lib/installation/widgets/system_role.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-installation-3.2.20/src/lib/installation/widgets/system_role.rb 2017-02-03 14:17:23.510821975 +0100 @@ -0,0 +1,149 @@ +# encoding: utf-8 + +# ------------------------------------------------------------------------------ +# 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. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, contact SUSE. +# +# To contact SUSE about this file by physical or electronic mail, you may find +# current contact information at www.suse.com. +# ------------------------------------------------------------------------------ + +require "yast" +require "cwm/widget" +require "installation/services" + +Yast.import "ProductControl" +Yast.import "ProductFeatures" + +module Installation + module Widgets + class DashboardURL < CWM::InputField + def label + # intentional no translation for CAASP + "Dashboard URL" + end + + def store + # TODO: implement it together with init and some validation + end + end + + class DashboardPlace < CWM::ReplacePoint + def initialize + @dashboard = DashboardURL.new + @empty = CWM::Empty.new("no_dashboard") + super(widget: @empty) + end + + def show + replace(@dashboard) + end + + def hide + replace(@empty) + end + end + + class SystemRole < CWM::ComboBox + class << self + # once the user selects a role, remember it in case they come back + attr_accessor :original_role_id + end + + def initialize(dashboard_widget) + textdomain "installation" + @dashboard_widget = dashboard_widget + end + + def label + Yast::ProductControl.GetTranslatedText("roles_caption") + end + + def opt + [:hstretch, :notify] + end + + def init + self.class.original_role_id ||= roles_description.first[:id] + self.value = self.class.original_role_id + handle + end + + def handle + if value == "worker_role" + @dashboard_widget.show + else + @dashboard_widget.hide + end + + nil + end + + def items + roles_description.map do |attr| + [attr[:id], attr[:label]] + end + end + + def help + Yast::ProductControl.GetTranslatedText("roles_help") + "\n\n" + + roles_description.map { |r| r[:label] + "\n\n" + r[:description] }.join("\n\n\n") + end + + NON_OVERLAY_ATTRIBUTES = [ + "additional_dialogs", + "id" + ].freeze + private_constant :NON_OVERLAY_ATTRIBUTES + + def store + log.info "Applying system role '#{value}'" + features = raw_roles.find { |r| r["id"] == value } + features = features.dup + NON_OVERLAY_ATTRIBUTES.each { |a| features.delete(a) } + Yast::ProductFeatures.SetOverlay(features) + adapt_services + self.class.original_role_id = value + end + + private + + def raw_roles + @raw_roles ||= Yast::ProductControl.productControl.fetch("system_roles", []) + end + + def roles_description + @roles_description ||= raw_roles.map do |r| + id = r["id"] + + { + id: id, + label: Yast::ProductControl.GetTranslatedText(id), + description: Yast::ProductControl.GetTranslatedText(id + "_description") + } + end + end + + def adapt_services + services = raw_roles.find { |r| r["id"] == value }["services"] + services ||= [] + + to_enable = services.map { |s| s["name"] } + log.info "enable for #{value} these services: #{to_enable.inspect}" + + Installation::Services.enabled = to_enable + end + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-3.2.16/test/inst_casp_overview_test.rb new/yast2-installation-3.2.20/test/inst_casp_overview_test.rb --- old/yast2-installation-3.2.16/test/inst_casp_overview_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-installation-3.2.20/test/inst_casp_overview_test.rb 2017-02-03 14:17:23.526829976 +0100 @@ -0,0 +1,112 @@ +#! /usr/bin/env rspec + +require_relative "test_helper" + +require "installation/clients/inst_casp_overview" + +Yast.import "CWM" +Yast.import "Language" +Yast.import "Mode" +Yast.import "Pkg" +Yast.import "Popup" +Yast.import "Wizard" + +# stub tune widgets used in dialog +require "cwm/widget" + +module Tune + module Widgets + class SystemInformation < CWM::PushButton + def label + "System Information" + end + end + end +end + +module Registration + module Widgets + class RegistrationCode < CWM::InputField + def label + "Registration code" + end + end + end +end + +module Users + class PasswordWidget < CWM::CustomWidget + def initialize(little_space: true) + end + + def label + "Password" + end + end +end + +module Y2Country + module Widgets + class KeyboardSelectionCombo < CWM::ComboBox + def initialize(_language) + end + + def label + "Keyboard" + end + end + end +end + +describe ::Installation::InstCaspOverview do + describe "#run" do + before do + allow(Yast::Wizard).to receive(:CreateDialog) + allow(Yast::Wizard).to receive(:CloseDialog) + allow(Yast::Pkg).to receive(:SetPackageLocale) + allow(Yast::CWM).to receive(:show).and_return(:next) + allow(Yast::Language).to receive(:language).and_return("en_US") + allow(Yast::WFM).to receive(:CallFunction).and_return({}) + allow(Yast::WFM).to receive(:CallFunction) + .with("inst_doit", []).and_return(:next) + end + + it "sets package locale same as Language" do + expect(Yast::Pkg).to receive(:SetPackageLocale).with(Yast::Language.language) + + subject.run + end + + it "creates wizard dialog in normal mode" do + allow(Yast::Mode).to receive(:normal).and_return(true) + + expect(Yast::Wizard).to receive(:CreateDialog) + + subject.run + end + + it "closed wizard dialog in normal mode" do + allow(Yast::Mode).to receive(:normal).and_return(true) + + expect(Yast::Wizard).to receive(:CloseDialog) + + subject.run + end + + it "shows CWM widgets" do + allow(Yast::Mode).to receive(:normal).and_return(true) + + expect(Yast::CWM).to receive(:show).and_return(:next) + + subject.run + end + + it "shows CWM widgets again if it returns redraw event" do + allow(Yast::Mode).to receive(:normal).and_return(true) + + expect(Yast::CWM).to receive(:show).twice.and_return(:redraw, :next) + + subject.run + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-3.2.16/test/inst_update_installer_test.rb new/yast2-installation-3.2.20/test/inst_update_installer_test.rb --- old/yast2-installation-3.2.16/test/inst_update_installer_test.rb 2017-01-24 13:35:28.864000000 +0100 +++ new/yast2-installation-3.2.20/test/inst_update_installer_test.rb 2017-02-03 14:17:23.526829976 +0100 @@ -484,6 +484,15 @@ end end end + + context "when update is disabled through the profile" do + let(:profile) { { "general" => { "self_update" => false } } } + + it "does not update the installer" do + expect(subject).to_not receive(:update_installer) + expect(subject.main).to eq(:next) + end + end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-3.2.16/test/lib/inst_download_release_notes_test.rb new/yast2-installation-3.2.20/test/lib/inst_download_release_notes_test.rb --- old/yast2-installation-3.2.16/test/lib/inst_download_release_notes_test.rb 2017-01-24 13:35:28.892000000 +0100 +++ new/yast2-installation-3.2.20/test/lib/inst_download_release_notes_test.rb 2017-02-03 14:17:23.526829976 +0100 @@ -37,6 +37,10 @@ .and_return([product]) allow(Yast::SCR).to receive(:Execute) + .with(Yast::Path.new(".target.bash"), /curl.*directory.yast/) + .and_return(CURL_NOT_FOUND_CODE) + + allow(Yast::SCR).to receive(:Execute) .with(Yast::Path.new(".target.bash"), /curl.*relnotes/) .and_return(curl_code) @@ -127,6 +131,39 @@ end end + context "when release notes index file is found" do + let(:language) { "es_ES" } + + it "Reads the index and falls back to es" do + expect(Yast::SCR).to receive(:Execute) + .with(Yast::Path.new(".target.bash"), /curl.*directory.yast/) + .and_return(CURL_SUCCESS_CODE) + expect(File).to receive(:read) + .with(/directory.yast/) + .and_return("foo\nRELEASE-NOTES.es.rtf\nbar") + expect(Yast::SCR).to receive(:Execute).once + .with(Yast::Path.new(".target.bash"), /curl.*RELEASE-NOTES.#{language[0..1]}.rtf/) + .and_return(CURL_SUCCESS_CODE) + client.main + end + + it "Tries to read the index file, which is empty, falls back to es" do + expect(Yast::SCR).to receive(:Execute) + .with(Yast::Path.new(".target.bash"), /curl.*directory.yast/) + .and_return(CURL_SUCCESS_CODE) + expect(File).to receive(:read) + .with(/directory.yast/) + .and_return("") + expect(Yast::SCR).to receive(:Execute).once + .with(Yast::Path.new(".target.bash"), /curl.*RELEASE-NOTES.#{language}.rtf/) + .and_return(CURL_NOT_FOUND_CODE) + expect(Yast::SCR).to receive(:Execute).once + .with(Yast::Path.new(".target.bash"), /curl.*RELEASE-NOTES.#{language[0..1]}.rtf/) + .and_return(CURL_SUCCESS_CODE) + client.main + end + end + context "when called twice" do let(:language) { "en" } let(:curl_code) { 22 } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-3.2.16/test/test_helper.rb new/yast2-installation-3.2.20/test/test_helper.rb --- old/yast2-installation-3.2.16/test/test_helper.rb 2017-01-24 13:35:28.940000000 +0100 +++ new/yast2-installation-3.2.20/test/test_helper.rb 2017-02-03 14:17:23.530831976 +0100 @@ -13,6 +13,9 @@ FIXTURES_DIR = Pathname.new(__FILE__).dirname.join("fixtures") +# mock some dependencies, to not increase built dependencies +$LOAD_PATH.unshift(File.join(FIXTURES_DIR.to_s, "stub_libs")) + # stub module to prevent its Import # Useful for modules from different yast packages, to avoid build dependencies def stub_module(name)