Hello community, here is the log from the commit of package yast2 for openSUSE:Factory checked in at 2015-12-01 10:02:51 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2 (Old) and /work/SRC/openSUSE:Factory/.yast2.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2" Changes: -------- --- /work/SRC/openSUSE:Factory/yast2/yast2.changes 2015-11-08 11:25:32.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.yast2.new/yast2.changes 2015-12-01 10:02:52.000000000 +0100 @@ -1,0 +2,35 @@ +Fri Nov 27 09:03:22 UTC 2015 - [email protected] + +- Renamed some arguments and methods in the UI::ServiceStatus API + (fate#318771) +- 3.1.161 + +------------------------------------------------------------------- +Thu Nov 26 08:47:31 UTC 2015 - [email protected] + +- New methods CWM.save_current_widgets and + CWM.validate_current_widgets +- Replaced UI::SrvStatusComponent with UI::ServiceStatus + (fate#318771) +- 3.1.160 + +------------------------------------------------------------------- +Tue Nov 24 14:05:14 CET 2015 - [email protected] + +- rewrite save_y2logs (and log linuxrc.log and wickedd.log) +- 3.1.159 + +------------------------------------------------------------------- +Mon Nov 23 15:23:51 UTC 2015 - [email protected] + +- Fixed idnkit dependency to allow building YaST HEAD in SLE12 +- 3.1.158 + +------------------------------------------------------------------- +Fri Nov 20 13:28:38 UTC 2015 - [email protected] + +- Fixed Puny code processing - the idnconv tool has been moved to + a different package (idnkit) (bsc#953442) +- 3.1.157 + +------------------------------------------------------------------- Old: ---- yast2-3.1.156.tar.bz2 New: ---- yast2-3.1.161.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2.spec ++++++ --- /var/tmp/diff_new_pack.aMLgtT/_old 2015-12-01 10:02:53.000000000 +0100 +++ /var/tmp/diff_new_pack.aMLgtT/_new 2015-12-01 10:02:53.000000000 +0100 @@ -17,7 +17,7 @@ Name: yast2 -Version: 3.1.156 +Version: 3.1.161 Release: 0 Url: https://github.com/yast/yast-yast2 @@ -73,8 +73,15 @@ Requires: perl-XML-Simple # for GPG.ycp Requires: gpg2 -# for Punycode.ycp (bnc#651893) + +# for Punycode.rb (bnc#651893) - the idnconv tool is located in +# different packages (SLE12/Leap-42.1: bind-utils, TW/Factory: idnkit) +%if 0%{?suse_version} >= 1330 +Requires: idnkit +%else Requires: bind-utils +%endif + # xdg-su in .desktops Recommends: xdg-utils ++++++ yast2-3.1.156.tar.bz2 -> yast2-3.1.161.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.156/library/cwm/src/modules/CWM.rb new/yast2-3.1.161/library/cwm/src/modules/CWM.rb --- old/yast2-3.1.156/library/cwm/src/modules/CWM.rb 2015-11-05 08:51:24.000000000 +0100 +++ new/yast2-3.1.161/library/cwm/src/modules/CWM.rb 2015-11-27 13:27:01.000000000 +0100 @@ -985,6 +985,21 @@ nil end + # Saves changes of all the widgets in the current dialog + # + # @param [Hash] event map event that triggered the saving + def save_current_widgets(event) + saveWidgets(@current_dialog_widgets, event) + end + + # Validates all the widgets in the current dialog + # + # @param [Hash] event map event that caused validation + # @return [Boolean] true if everything is OK, false if something is wrong + def validate_current_widgets(event) + validateWidgets(@current_dialog_widgets, event) + end + publish function: :StringsOfTerm, type: "list <string> (term)" publish function: :ValidateBasicType, type: "boolean (any, string)" publish function: :ValidateValueType, type: "boolean (string, any, string)" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.156/library/general/src/Makefile.am new/yast2-3.1.161/library/general/src/Makefile.am --- old/yast2-3.1.156/library/general/src/Makefile.am 2015-11-05 08:51:24.000000000 +0100 +++ new/yast2-3.1.161/library/general/src/Makefile.am 2015-11-27 13:27:01.000000000 +0100 @@ -89,7 +89,7 @@ ylib2_DATA = \ lib/ui/dialog.rb \ lib/ui/event_dispatcher.rb \ - lib/ui/srv_status_component.rb + lib/ui/service_status.rb EXTRA_DIST = $(module_DATA) $(client_DATA) $(scrconf_DATA) $(agent_SCRIPTS) $(ydata_DATA) $(fillup_DATA) $(ylib_DATA) $(ylib2_DATA) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.156/library/general/src/lib/ui/service_status.rb new/yast2-3.1.161/library/general/src/lib/ui/service_status.rb --- old/yast2-3.1.156/library/general/src/lib/ui/service_status.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-3.1.161/library/general/src/lib/ui/service_status.rb 2015-11-27 13:27:01.000000000 +0100 @@ -0,0 +1,210 @@ +# Copyright (c) 2015 SUSE LLC. +# All Rights Reserved. + +# This program is free software; you can redistribute it and/or +# modify it under the terms of version 2 or 3 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 LLC. + +# To contact Novell about this file by physical or electronic mail, +# you may find current contact information at www.suse.com + +require "yast" +Yast.import "UI" + +module UI + # Widgets for managing the status of services (both currently and on system + # boot) and the behavior associated to those widgets + # + # As long as #handle_input is invoked in the event loop, the widget will + # handle interactive starting and stopping of the service on user demand. + # + # It also provides checkboxes (reload_flag and enabled_flag) for the user + # to specify whether the service must be reloaded/restarted after + # configuration changes and whether it must be enabled at boot time. + class ServiceStatus + include Yast::UIShortcuts + include Yast::I18n + include Yast::Logger + + # @param service [Object] An object providing the following methods: + # #name, #start, #stop, #enabled?, #running? + # For systemd compliant services, just do + # Yast::SystemdService.find("name_of_the_service") + # Note that this widget will #start and #stop the service by itself but + # the actions referenced by the flags (reloading and enabling/disabling) + # are expected to be done by the caller, when the whole configuration is + # written. + # @param reload_flag [Boolean] Initial value for the "reload" checkbox. + # Keep in mind it will always be displayed as unchecked if the service + # is not running, despite the real value. + # @param reload_flag_label [Symbol] Type of label for the "reload" checkbox. + # :reload means the service will be reloaded. + # :restart means the service will be restarted. + def initialize(service, reload_flag: true, reload_flag_label: :reload) + @service = service + @reload_flag = reload_flag + + @enabled_flag = @service.enabled? + @id_prefix = "_srv_status_#{@service.name}" + textdomain "base" + if reload_flag_label == :restart + @reload_label = _("Restart After Saving Settings") + else + @reload_label = _("Reload After Saving Settings") + end + end + + # @return [YaST::Term] + def widget + Frame( + _("Service Status"), + VBox( + ReplacePoint(Id("#{id_prefix}_status"), status_widget), + reload_widget, + VSpacing(), + on_boot_widget + ) + ) + end + + # Handles the input triggered by the widgets, this method must be called in + # the event loop of the dialog using the component. + # + # @return [Symbol] Label for the managed event + def handle_input(input) + case input + when "#{id_prefix}_stop" + @service.stop + refresh + :stop + when "#{id_prefix}_start" + @service.start + refresh + :start + when "#{id_prefix}_reload" + @reload_flag = Yast::UI.QueryWidget(Id(input), :Value) + :reload_flag + when "#{id_prefix}_enabled" + @enabled_flag = Yast::UI.QueryWidget(Id(input), :Value) + :enabled_flag + else + log.info "Input not handled by ServiceStatus: #{input}" + :ignored + end + end + + # Updates the widget to reflect the current status of the service and the + # settings + def refresh + Yast::UI.ChangeWidget(Id("#{id_prefix}_reload"), :Enabled, @service.running?) + Yast::UI.ChangeWidget(Id("#{id_prefix}_reload"), :Value, @service.running? && @reload_flag) + Yast::UI.ChangeWidget(Id("#{id_prefix}_enabled"), :Value, @enabled_flag) + Yast::UI.ReplaceWidget(Id("#{id_prefix}_status"), status_widget) + end + + # rubocop:disable Style/TrivialAccessors + + # Checks if the user requested the service to be enabled on boot + # + # @return [Boolean] + def enabled_flag? + @enabled_flag + end + + # Checks if the user requested the service to be reloaded when saving + # + # @return [Boolean] + def reload_flag? + @reload_flag + end + + # rubocop:enable Style/TrivialAccessors + + # Content for the help + def help + _( + "<p><b><big>Current status</big></b><br>\n"\ + "Displays the current status of the service. The status will remain "\ + "the same after saving the settings, independently of the value of "\ + "'start service during boot'.</p>\n"\ + "<p><b><big>%{reload_label}</big></b><br>\n"\ + "Only applicable if the service is currently running. "\ + "Ensures the running service reloads the new configuration after "\ + "saving it (either finishing the dialog or pressing the apply "\ + "button).</p>\n"\ + "<p><b><big>Start During System Boot</big></b><br>\n"\ + "Check this field to enable the service at system boot. "\ + "Un-check it to disable the service. "\ + "This does not affect the current status of the service in the already "\ + "running system.</p>\n" + ) % { reload_label: @reload_label } + end + + protected + + attr_reader :id_prefix + + # Widget displaying the status and associated buttons + def status_widget + Left( + HBox( + Label(_("Current status:")), + Label(" "), + *label_and_action_widgets + ) + ) + end + + # Widget to configure the status on boot + def on_boot_widget + Left( + CheckBox( + Id("#{id_prefix}_enabled"), + Opt(:notify), + _("Start During System Boot"), + @enabled_flag + ) + ) + end + + # Widget to configure reloading of the running service + def reload_widget + opts = [:notify] + opts << :disabled unless @service.running? + Left( + CheckBox( + Id("#{id_prefix}_reload"), + Opt(*opts), + @reload_label, + @service.running? && @reload_flag + ) + ) + end + + def label_and_action_widgets + if @service.running? + [ + # TRANSLATORS: status of a service + Label(_("running")), + Label(" "), + PushButton(Id("#{id_prefix}_stop"), _("Stop now")) + ] + else + [ + # TRANSLATORS: status of a service + Label(_("stopped")), + Label(" "), + PushButton(Id("#{id_prefix}_start"), _("Start now")) + ] + end + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.156/library/general/src/lib/ui/srv_status_component.rb new/yast2-3.1.161/library/general/src/lib/ui/srv_status_component.rb --- old/yast2-3.1.156/library/general/src/lib/ui/srv_status_component.rb 2015-11-05 08:51:24.000000000 +0100 +++ new/yast2-3.1.161/library/general/src/lib/ui/srv_status_component.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1,241 +0,0 @@ -# Copyright (c) 2015 SUSE LLC. -# All Rights Reserved. - -# This program is free software; you can redistribute it and/or -# modify it under the terms of version 2 or 3 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 LLC. - -# To contact Novell about this file by physical or electronic mail, -# you may find current contact information at www.suse.com - -require "yast" -Yast.import "Service" -Yast.import "UI" - -module UI - # Component encapsulating the widgets for managing the status of services (both - # currently and on system boot) and the behavior associated to those widgets - # - # TODO: The API is experimental and subject to change. This component is only - # used by yast2-dns-server and should not be used by any other module until - # an upcoming refactoring, planned for SLE12-SP2. To see some of the planned - # improvements, check https://github.com/yast/yast-yast2/pull/401 - # - # As long as #handle_input is invoked in the event loop, the component will - # handle interactive starting and stopping of the service on user demand. In - # addition #reload can be used after saving the settings. - # - # To manage the status on boot, the component can be queried for the user - # selection using #enabled?. In addition enabled_callback (in constructor) - # can be used to observe the status of the corresponding field in the UI. - class SrvStatusComponent - include Yast::UIShortcuts - include Yast::I18n - include Yast::Logger - - # @param service_name [String] name of the service as expected by - # Yast::Service - # @param reload [Boolean] initial value for the "reload" checkbox. - # Keep in mind it will always be displayed as unchecked if the service is - # not running, despite the real value. - # @param enabled_callback [Proc] callback executed when the "enabled on - # boot" checkbox is changed. The only parameter of the callback is the new - # state of the checkbox (boolean). - def initialize(service_name, reload: true, enabled_callback: nil) - @service_name = service_name - @reload = reload - @enabled_callback = enabled_callback - - @enabled = service_enabled? - @id_prefix = "_srv_status_#{@service_name}" - textdomain "base" - end - - # @return [YaST::Term] - def widget - Frame( - _("Service Status"), - VBox( - ReplacePoint(Id("#{id_prefix}_status"), status_widget), - reload_widget, - VSpacing(), - on_boot_widget - ) - ) - end - - # Handles the input triggered by the widgets, this method must be called in - # the event loop of the dialog using the component. - def handle_input(input) - case input - when "#{id_prefix}_stop" - stop_service - refresh_widget - when "#{id_prefix}_start" - start_service - refresh_widget - when "#{id_prefix}_reload" - @reload = Yast::UI.QueryWidget(Id(input), :Value) - when "#{id_prefix}_enabled" - @enabled = Yast::UI.QueryWidget(Id(input), :Value) - @enabled_callback.call(@enabled) if @enabled_callback - else - log.info "Input not handled by SrvStatusComponent: #{input}" - end - end - - # Updates the widget to reflect the current status of the service and the - # settings - def refresh_widget - Yast::UI.ChangeWidget(Id("#{id_prefix}_reload"), :Enabled, service_running?) - Yast::UI.ChangeWidget(Id("#{id_prefix}_reload"), :Value, service_running? && @reload) - Yast::UI.ChangeWidget(Id("#{id_prefix}_enabled"), :Value, @enabled) - Yast::UI.ReplaceWidget(Id("#{id_prefix}_status"), status_widget) - end - - # Reloads the service only if the user requested so. It should be called - # after saving the settings. - def reload - reload_service if service_running? && @reload - end - - # rubocop:disable Style/TrivialAccessors - - # Checks if the user requested the service to be enabled on boot - # - # @return [Boolean] - def enabled? - @enabled - end - - # rubocop:enable Style/TrivialAccessors - - # Content for the help - def help - _( - "<p><b><big>Current status</big></b><br>\n"\ - "Displays the current status of the service. The status will remain "\ - "the same after saving the settings, independently of the value of "\ - "'start service during boot'.</p>\n"\ - "<p><b><big>Reload After Saving Settings</big></b><br>\n"\ - "Only applicable if the service is currently running. "\ - "Ensures the running service reloads the new configuration after "\ - "saving it (via 'ok' or 'save' buttons).</p>\n"\ - "<p><b><big>Start During System Boot</big></b><br>\n"\ - "Check this field to enable the service at system boot. "\ - "Un-check it to disable the service. "\ - "This does not affect the current status of the service in the already "\ - "running system.</p>\n" - ) - end - - protected - - attr_reader :id_prefix - - # Checks if the service is currently running - # - # Must be redefined for services not following standard procedures - # - # @return [Boolean] - def service_running? - Yast::Service.active?(@service_name) - end - - # Checks if the service is currently enabled on boot - # - # Must be redefined for services not following standard procedures - # - # @return [Boolean] - def service_enabled? - Yast::Service.enabled?(@service_name) - end - - # Starts the service inmediatly - # - # Must be redefined for services not following standard procedures - def start_service - log.info "Default implementation of SrvStatusComponent#start_service for #{@service_name}" - Yast::Service.Start(@service_name) - end - - # Stops the service inmediatly - # - # Must be redefined for services not following standard procedures - def stop_service - log.info "Default implementation of SrvStatusComponent#stop_service for #{@service_name}" - Yast::Service.Stop(@service_name) - end - - # Reloads the configuration of a running service - # - # Must be redefined for services not following standard procedures - def reload_service - log.info "Default implementation of SrvStatusComponent#reload_service for #{@service_name}" - Yast::Service.Reload(@service_name) - end - - # Widget displaying the status and associated buttons - def status_widget - Left( - HBox( - Label(_("Current status:")), - Label(" "), - *label_and_action_widgets - ) - ) - end - - # Widget to configure the status on boot - def on_boot_widget - Left( - CheckBox( - Id("#{id_prefix}_enabled"), - Opt(:notify), - _("Start During System Boot"), - @enabled - ) - ) - end - - # Widget to configure reloading of the running service - def reload_widget - opts = [:notify] - opts << :disabled unless service_running? - Left( - CheckBox( - Id("#{id_prefix}_reload"), - Opt(*opts), - _("Reload After Saving Settings"), - service_running? && @reload - ) - ) - end - - def label_and_action_widgets - if service_running? - [ - # TRANSLATORS: status of a service - Label(_("running")), - Label(" "), - PushButton(Id("#{id_prefix}_stop"), _("Stop now")) - ] - else - [ - # TRANSLATORS: status of a service - Label(_("stopped")), - Label(" "), - PushButton(Id("#{id_prefix}_start"), _("Start now")) - ] - end - end - end -end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.156/library/general/test/Makefile.am new/yast2-3.1.161/library/general/test/Makefile.am --- old/yast2-3.1.156/library/general/test/Makefile.am 2015-11-05 08:51:24.000000000 +0100 +++ new/yast2-3.1.161/library/general/test/Makefile.am 2015-11-27 13:27:01.000000000 +0100 @@ -10,7 +10,7 @@ os_release_test.rb \ popup_test.rb \ proposal_client_test.rb \ - srv_status_component_test.rb \ + service_status_test.rb \ agents_test/proc_meminfo_agent_test.rb TEST_EXTENSIONS = .rb diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.156/library/general/test/service_status_test.rb new/yast2-3.1.161/library/general/test/service_status_test.rb --- old/yast2-3.1.156/library/general/test/service_status_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-3.1.161/library/general/test/service_status_test.rb 2015-11-27 13:27:01.000000000 +0100 @@ -0,0 +1,161 @@ +#! /usr/bin/env rspec + +require_relative "test_helper" +require "ui/service_status" + +# Some helpers to test the UI + +def matches_id_and_text?(widget, id, text) + return false unless widget.is_a?(Yast::Term) + return false unless widget.params + return false unless widget.params.any? do |p| + p.is_a?(Yast::Term) && p.value == :id && p.params.first =~ id + end + widget.params.any? { |p| p.is_a?(::String) && p =~ text } +end + +def widget_by_id_and_text(widgets, id, text) + widgets.nested_find do |t| + matches_id_and_text?(t, /#{id}/, /#{Yast._(text)}/) + end +end + +def options_for(term) + opt = term.params.find do |p| + p.is_a?(Yast::Term) && p.value == :opt + end + opt.params +end + +def id_for(term) + id = term.params.find do |p| + p.is_a?(Yast::Term) && p.value == :id + end + id.params.first +end + +class DummyService + attr_reader :name + + def initialize(name) + @name = name + end + + def enabled? + @name == "active" + end + + def running? + @name == "active" + end + + def start; end + + def stop; end +end + +# Class using ServiceStatus +class DummyDialog + include Yast::UIShortcuts + + attr_reader :enabled1, :enabled2, :srv1_component, :srv2_component + + def initialize(service1, service2) + @srv1_component = ::UI::ServiceStatus.new(service1) + @srv2_component = ::UI::ServiceStatus.new(service2) + @enabled1 = @srv1_component.enabled_flag? + @enabled2 = @srv2_component.enabled_flag? + end + + def handle_input(input) + if @srv1_component.handle_input(input) == :enabled_flag + @enabled1 = @srv1_component.enabled_flag? + end + @srv2_component.handle_input(input) + end + + def content + VBox( + Heading("Dummy dialog"), + @srv1_component.widget, + @srv2_component.widget, + PushButton(Id(:ok), "Ok") + ) + end +end + +module Yast + extend Yast::I18n + Yast.textdomain "base" + + import "UI" + + describe ::UI::ServiceStatus do + let(:active) { DummyService.new("active") } + let(:inactive) { DummyService.new("inactive") } + + let(:dialog) { DummyDialog.new(active, inactive) } + let(:widgets) { dialog.content } + let(:stop_active) { widget_by_id_and_text(widgets, "active", "Stop now") } + let(:start_inactive) { widget_by_id_and_text(widgets, "inactive", "Start now") } + let(:reload_active) { widget_by_id_and_text(widgets, "active", "Reload After Saving Settings") } + let(:reload_inactive) { widget_by_id_and_text(widgets, "inactive", "Reload After Saving Settings") } + let(:enabled_active) { widget_by_id_and_text(widgets, "active", "Start During System Boot") } + let(:enabled_inactive) { widget_by_id_and_text(widgets, "inactive", "Start During System Boot") } + + describe "#initialize" do + it "reads the initial enabled state from the system" do + expect(dialog.enabled1).to eq true + expect(dialog.enabled2).to eq false + end + end + + describe "#widget" do + it "includes all the UI elements" do + expect(stop_active).not_to be_nil + expect(start_inactive).not_to be_nil + expect(reload_active).not_to be_nil + expect(reload_inactive).not_to be_nil + expect(enabled_active).not_to be_nil + expect(enabled_inactive).not_to be_nil + end + + it "disables and unchecks the reload button for stopped services" do + expect(options_for(reload_inactive).any? { |p| p == :disabled }) + expect(reload_inactive.params.last).to eq false + end + + it "enables the reload button for stopped services" do + expect(options_for(reload_active).none? { |p| p == :disabled }) + end + end + + describe "#handle_input" do + it "stops the service on user request" do + expect(active).to receive(:stop) + dialog.handle_input(id_for(stop_active)) + end + + it "starts the service on user request" do + expect(inactive).to receive(:start) + dialog.handle_input(id_for(start_inactive)) + end + + it "triggers 'enabled_callback' if available" do + allow(Yast::UI).to receive(:QueryWidget).and_return "new_value" + dialog.handle_input(id_for(enabled_active)) + + expect(dialog.enabled1).to eq "new_value" + end + + it "changes the result of #enabled_flag? on user request" do + expect(dialog.srv1_component.enabled_flag?).to eq true + + allow(Yast::UI).to receive(:QueryWidget).and_return false + dialog.handle_input(id_for(enabled_active)) + + expect(dialog.srv1_component.enabled_flag?).to eq false + end + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.156/library/general/test/srv_status_component_test.rb new/yast2-3.1.161/library/general/test/srv_status_component_test.rb --- old/yast2-3.1.156/library/general/test/srv_status_component_test.rb 2015-11-05 08:51:24.000000000 +0100 +++ new/yast2-3.1.161/library/general/test/srv_status_component_test.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1,147 +0,0 @@ -#! /usr/bin/env rspec - -require_relative "test_helper" -require "ui/srv_status_component" - -# Some helpers to test the UI - -def matches_id_and_text?(widget, id, text) - return false unless widget.is_a?(Yast::Term) - return false unless widget.params - return false unless widget.params.any? do |p| - p.is_a?(Yast::Term) && p.value == :id && p.params.first =~ id - end - widget.params.any? { |p| p.is_a?(::String) && p =~ text } -end - -def widget_by_id_and_text(widgets, id, text) - widgets.nested_find do |t| - matches_id_and_text?(t, /#{id}/, /#{Yast._(text)}/) - end -end - -def options_for(term) - opt = term.params.find do |p| - p.is_a?(Yast::Term) && p.value == :opt - end - opt.params -end - -def id_for(term) - id = term.params.find do |p| - p.is_a?(Yast::Term) && p.value == :id - end - id.params.first -end - -# Class using SrvStatusComponent -class DummyDialog - include Yast::UIShortcuts - - attr_reader :enabled1, :enabled2, :srv1_component, :srv2_component - - def initialize - @srv1_component = ::UI::SrvStatusComponent.new( - "service1", - enabled_callback: ->(e) { @enabled1 = e } - ) - @srv2_component = ::UI::SrvStatusComponent.new("service2") - @enabled1 = @srv1_component.enabled? - @enabled2 = @srv2_component.enabled? - end - - def handle_input(input) - @srv1_component.handle_input(input) - @srv2_component.handle_input(input) - end - - def content - VBox( - Heading("Dummy dialog"), - @srv1_component.widget, - @srv2_component.widget, - PushButton(Id(:ok), "Ok") - ) - end -end - -module Yast - extend Yast::I18n - Yast.textdomain "base" - - import "Service" - import "UI" - - describe ::UI::SrvStatusComponent do - before do - allow(Yast::Service).to receive(:enabled?).with("service1").and_return true - allow(Yast::Service).to receive(:enabled?).with("service2").and_return false - allow(Yast::Service).to receive(:active?).with("service1").and_return true - allow(Yast::Service).to receive(:active?).with("service2").and_return false - end - - let(:dialog) { DummyDialog.new } - let(:widgets) { dialog.content } - let(:stop_service1) { widget_by_id_and_text(widgets, "service1", "Stop now") } - let(:start_service2) { widget_by_id_and_text(widgets, "service2", "Start now") } - let(:reload_service1) { widget_by_id_and_text(widgets, "service1", "Reload After Saving Settings") } - let(:reload_service2) { widget_by_id_and_text(widgets, "service2", "Reload After Saving Settings") } - let(:enabled_service1) { widget_by_id_and_text(widgets, "service1", "Start During System Boot") } - let(:enabled_service2) { widget_by_id_and_text(widgets, "service2", "Start During System Boot") } - - describe "#initialize" do - it "reads the initial enabled state from the system" do - expect(dialog.enabled1).to eq true - expect(dialog.enabled2).to eq false - end - end - - describe "#widget" do - it "includes all the UI elements" do - expect(stop_service1).not_to be_nil - expect(start_service2).not_to be_nil - expect(reload_service1).not_to be_nil - expect(reload_service2).not_to be_nil - expect(enabled_service1).not_to be_nil - expect(enabled_service2).not_to be_nil - end - - it "disables and unchecks the reload button for stopped services" do - expect(options_for(reload_service2).any? { |p| p == :disabled }) - expect(reload_service2.params.last).to eq false - end - - it "enables the reload button for stopped services" do - expect(options_for(reload_service1).none? { |p| p == :disabled }) - end - end - - describe "#handle_input" do - it "stops the service on user request" do - expect(Yast::Service).to receive(:Stop).with("service1") - dialog.handle_input(id_for(stop_service1)) - end - - it "starts the service on user request" do - expect(Yast::Service).to receive(:Start).with("service2") - dialog.handle_input(id_for(start_service2)) - end - - it "triggers 'enabled_callback' if available" do - allow(Yast::UI).to receive(:QueryWidget).and_return "new_value" - dialog.handle_input(id_for(enabled_service1)) - - expect(dialog.enabled1).to eq "new_value" - end - - it "changes the result of #enabled? on user request" do - expect(dialog.srv1_component.enabled?).to eq true - - allow(Yast::UI).to receive(:QueryWidget).and_return false - dialog.handle_input(id_for(enabled_service1)) - - expect(dialog.srv1_component.enabled?).to eq false - end - end - end -end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.156/package/yast2.changes new/yast2-3.1.161/package/yast2.changes --- old/yast2-3.1.156/package/yast2.changes 2015-11-05 08:51:24.000000000 +0100 +++ new/yast2-3.1.161/package/yast2.changes 2015-11-27 13:27:01.000000000 +0100 @@ -1,4 +1,39 @@ ------------------------------------------------------------------- +Fri Nov 27 09:03:22 UTC 2015 - [email protected] + +- Renamed some arguments and methods in the UI::ServiceStatus API + (fate#318771) +- 3.1.161 + +------------------------------------------------------------------- +Thu Nov 26 08:47:31 UTC 2015 - [email protected] + +- New methods CWM.save_current_widgets and + CWM.validate_current_widgets +- Replaced UI::SrvStatusComponent with UI::ServiceStatus + (fate#318771) +- 3.1.160 + +------------------------------------------------------------------- +Tue Nov 24 14:05:14 CET 2015 - [email protected] + +- rewrite save_y2logs (and log linuxrc.log and wickedd.log) +- 3.1.159 + +------------------------------------------------------------------- +Mon Nov 23 15:23:51 UTC 2015 - [email protected] + +- Fixed idnkit dependency to allow building YaST HEAD in SLE12 +- 3.1.158 + +------------------------------------------------------------------- +Fri Nov 20 13:28:38 UTC 2015 - [email protected] + +- Fixed Puny code processing - the idnconv tool has been moved to + a different package (idnkit) (bsc#953442) +- 3.1.157 + +------------------------------------------------------------------- Wed Nov 4 20:19:10 UTC 2015 - [email protected] - Fixed clipped dialog label (bsc#948381) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.156/package/yast2.spec new/yast2-3.1.161/package/yast2.spec --- old/yast2-3.1.156/package/yast2.spec 2015-11-05 08:51:24.000000000 +0100 +++ new/yast2-3.1.161/package/yast2.spec 2015-11-27 13:27:01.000000000 +0100 @@ -17,7 +17,7 @@ Name: yast2 -Version: 3.1.156 +Version: 3.1.161 Release: 0 Url: https://github.com/yast/yast-yast2 @@ -73,8 +73,15 @@ Requires: perl-XML-Simple # for GPG.ycp Requires: gpg2 -# for Punycode.ycp (bnc#651893) + +# for Punycode.rb (bnc#651893) - the idnconv tool is located in +# different packages (SLE12/Leap-42.1: bind-utils, TW/Factory: idnkit) +%if 0%{?suse_version} >= 1330 +Requires: idnkit +%else Requires: bind-utils +%endif + # xdg-su in .desktops Recommends: xdg-utils diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.156/scripts/save_y2logs new/yast2-3.1.161/scripts/save_y2logs --- old/yast2-3.1.156/scripts/save_y2logs 2015-11-05 08:51:24.000000000 +0100 +++ new/yast2-3.1.161/scripts/save_y2logs 2015-11-27 13:27:01.000000000 +0100 @@ -5,112 +5,146 @@ # # Author: Stefan Hundhammer <[email protected]> +PATH=/usr/sbin:/usr/bin:/sbin:/bin + usage() { - echo "Usage: $0 [<tgz-file-name>|<bzip2-file-name>]" >&2 + echo "Usage: ${0##*/} [ARCHIVE_NAME]" >&2 echo "" >&2 - echo "Copies the YaST2 logs to a compressed tar archive." >&2 - echo "If file name is missing, it is generated by the script." >&2 + echo "Copies the YaST2 logs to a (compressed) tar archive." >&2 + echo "If file name is missing it is generated by the script." >&2 exit 1 } if test -z "$1"; then - TARGET=`mktemp --suffix .tar.gz /tmp/y2log-XXXXXX` - COMPRESSION=--gzip + # choose some good default + if [ "$(type -p xz)" ] ; then + SUFFIX=.tar.xz + COMPRESSION=xz + elif [ "$(type -p gzip)" ] ; then + SUFFIX=.tar.gz + COMPRESSION=gzip + elif [ "$(type -p bzip2)" ] ; then + SUFFIX=.tar.bz2 + COMPRESSION=bzip2 + else + SUFFIX=.tar + COMPRESSION= + fi + TARGET=`mktemp --suffix $SUFFIX /tmp/y2log-XXXXXX` else case "$1" in -*) usage ;; + *.tar) + COMPRESSION= + ;; + *.tgz|*.tar.gz) - TARGET="$1" - COMPRESSION=--gzip + COMPRESSION=gzip ;; - *.tar.bz2) - TARGET="$1" - COMPRESSION=--bzip2 + *.txz|*.tar.xz) + COMPRESSION=xz + ;; - if [ ! -x /usr/bin/bzip2 ]; then - echo "FATAL: /usr/bin/bzip2 not available" >&2 - # This might easily happen in the inst-sys - exit 3 - fi + *.tar.bz2) + COMPRESSION=bzip2 ;; *) - echo "FATAL: Uncompressed archives not supported" >&2 - echo "Use one of: .tgz .tar.gz .tar.bz2" >&2 + echo "FATAL: argument is not a (compressed) tar file." >&2 + echo "Use one of these suffixes: .tar .tgz .tar.gz .txz .tar.xz .tar.bz2" >&2 exit 4 esac + TARGET="$1" +fi + +# check for compression program +if [ "$COMPRESSION" -a -z "$(type -p $COMPRESSION)" ]; then + echo "FATAL: $COMPRESSION not available" >&2 + exit 3 fi TMPDIR=`mktemp -d` || ( echo "FATAL: Failed to create a temporary directory" >&2; exit 5 ); -LIST=YaST2 -if [ -f /var/log/evms-engine.log ]; then - LIST="$LIST $( cd /var/log/; ls evms-engine.*)" -fi -if [ -x /bin/dmesg ]; then - dmesg > $TMPDIR/dmesg - LIST="$LIST $TMPDIR/dmesg" +# 1. gather some information in $TMPDIR + +# last kernel messages, if any +if [ "$(type -p dmesg)" ]; then + dmesg > $TMPDIR/dmesg + LIST_TMP="$LIST_TMP dmesg" fi -if [ -f /var/log/zypp/history ]; then - LIST="$LIST $( cd /var/log/; ls zypp/history*)" +if [ "$(type -p journalctl)" ]; then + journalctl --dmesg > $TMPDIR/journalctl-dmesg + LIST_TMP="$LIST_TMP journalctl-dmesg" fi +# strip sensitive information if [ -f /etc/install.inf ]; then - sed 's/\(^WlanESSID: \|^WlanKey: \|^RootPassword: \|^VNCPassword: \|^Password: \).*$/\1XXXXXX/' </etc/install.inf >$TMPDIR/install.inf - LIST="$LIST $TMPDIR/install.inf" + sed 's/\(^WlanESSID: \|^WlanKey: \|^RootPassword: \|^VNCPassword: \|^Password: \).*$/\1XXXXXX/' </etc/install.inf >$TMPDIR/install.inf + LIST_TMP="$LIST_TMP install.inf" fi -if [ -f /etc/X11/xorg.conf ]; then - LIST="$LIST /etc/X11/xorg.conf" +# if storing logs at the end of installation after bootloader fail, try to store pbl log from target system +if [ -f /mnt/var/log/pbl.log ]; then + cp /mnt/var/log/pbl.log $TMPDIR/pbl-target.log + LIST_TMP="$LIST_TMP pbl-target.log" fi -if [ -f /etc/X11/xorg.conf.install ]; then - LIST="$LIST /etc/X11/xorg.conf.install" +# installed packages +if [ -f /var/lib/rpm/Packages -a "$(type -p rpm)" ]; then + rpm -qa --qf '%{NAME}-%{VERSION}-%{RELEASE}\t\t\t(%{VENDOR})\t%{DISTRIBUTION}\n' 2>/dev/null | sort >/$TMPDIR/rpm-qa + LIST_TMP="$LIST_TMP rpm-qa" fi -if [ -f /var/log/Xorg.0.log ]; then - LIST="$LIST /var/log/Xorg.0.log" +# rename, so people can see it +if [ -f /.packages.root ]; then + cp /.packages.root $TMPDIR/_packages.root + LIST_TMP="$LIST_TMP _packages.root" fi -if [ -f /var/log/zypper.log ]; then - LIST="$LIST /var/log/zypper.log" -fi -if [ -f /var/log/pk_backend_zypp ]; then - LIST="$LIST /var/log/pk_backend_zypp" -fi +# 2. things from /var/log relevant for us -if [ -f /var/log/pbl.log ]; then - LIST="$LIST /var/log/pbl.log" -fi -# if storing logs at the end of installation after bootloader fail, try to store pbl log from target system -if [ -f /mnt/var/log/pbl.log ]; then - LIST="$LIST /mnt/var/log/pbl.log" -fi +VAR_LOG_FILES='\ + YaST2 \ + Xorg.0.log \ + zypper.log zypp/history* pk_backend_zypp \ + pbl.log linuxrc.log wickedd.log \ + evms-engine.* \ +' +cd /var/log +for i in $VAR_LOG_FILES ; do + [ -e "$i" ] && LIST_VAR="$LIST_VAR $i" +done +cd / -if [ -f /.packages.root ]; then - LIST="$LIST /.packages.root" -fi -RPM_LIST="rpm-qa" -if [ -f /var/lib/rpm/Packages ]; then - rpm -qa --qf '%{NAME}-%{VERSION}-%{RELEASE}\t\t\t(%{VENDOR})\t%{DISTRIBUTION}\n' 2>/dev/null | sort >/var/log/$RPM_LIST -fi +# 3. any other files -if [ -f /var/log/$RPM_LIST ]; then - LIST="$LIST $RPM_LIST" -fi +FILES='\ + etc/X11/xorg.conf etc/X11/xorg.conf.install \ + etc/X11/xorg.conf.d \ +' +for i in $FILES ; do + [ -e "$i" ] && LIST="$LIST $i" +done + + +echo "Saving YaST logs to $TARGET" >&2 + +[ -n "$COMPRESSION" ] && COMPRESSION="--$COMPRESSION" + +tar cf "$TARGET" $COMPRESSION --dereference -C / $LIST -C /var/log $LIST_VAR -C $TMPDIR $LIST_TMP +err=$? -echo "Saving y2logs to $TARGET" >&2 +rm -rf $TMPDIR -tar cf "$TARGET" $COMPRESSION --directory=/var/log --dereference $LIST && rm -rf $TMPDIR && exit 0 +[ $err != 0 ] && echo "FATAL: Error creating archive $TARGET" >&2 -echo "FATAL: Error creating archive $TARGET" >&2 -exit 2 +exit $err
