Hello community, here is the log from the commit of package yast2-dns-server for openSUSE:Factory checked in at 2015-10-22 12:58:31 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-dns-server (Old) and /work/SRC/openSUSE:Factory/.yast2-dns-server.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-dns-server" Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-dns-server/yast2-dns-server.changes 2015-09-19 06:55:58.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.yast2-dns-server.new/yast2-dns-server.changes 2015-10-22 12:58:32.000000000 +0200 @@ -1,0 +2,7 @@ +Fri Oct 2 11:09:19 UTC 2015 - an...@suse.com + +- UI component for services handling moved from yast2-dns-server + to yast2 (fate#318771) +- 3.1.17 + +------------------------------------------------------------------- Old: ---- yast2-dns-server-3.1.16.tar.bz2 New: ---- yast2-dns-server-3.1.17.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-dns-server.spec ++++++ --- /var/tmp/diff_new_pack.dvySWy/_old 2015-10-22 12:58:32.000000000 +0200 +++ /var/tmp/diff_new_pack.dvySWy/_new 2015-10-22 12:58:32.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-dns-server -Version: 3.1.16 +Version: 3.1.17 Release: 0 Url: https://github.com/yast/yast-dns-server @@ -33,8 +33,8 @@ BuildRequires: yast2-testsuite BuildRequires: rubygem(rspec) -# requires DnsServerAPI::GetReverseIPforIPv6 -BuildRequires: yast2 >= 2.17.8 +# requires SrvStatusComponent +BuildRequires: yast2 >= 3.1.151 Requires: /usr/bin/host Requires: perl-gettext # Exporter Data::Dumper @@ -55,8 +55,8 @@ # FATE #303386: Network setup tools Requires: yast2-sysconfig -# for default TLD definition -Requires: yast2 >= 3.1.134 +# for SrvStatusComponent +Requires: yast2 >= 3.1.151 BuildArch: noarch @@ -82,7 +82,6 @@ %defattr(-,root,root) %dir %{yast_yncludedir}/dns-server %{yast_yncludedir}/dns-server/* -%{yast_dir}/lib/ui %{yast_clientdir}/dns-server.rb %{yast_clientdir}/dns-server_*.rb %{yast_moduledir}/* ++++++ yast2-dns-server-3.1.16.tar.bz2 -> yast2-dns-server-3.1.17.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-dns-server-3.1.16/package/yast2-dns-server.changes new/yast2-dns-server-3.1.17/package/yast2-dns-server.changes --- old/yast2-dns-server-3.1.16/package/yast2-dns-server.changes 2015-09-18 15:21:10.000000000 +0200 +++ new/yast2-dns-server-3.1.17/package/yast2-dns-server.changes 2015-10-02 21:23:25.000000000 +0200 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Fri Oct 2 11:09:19 UTC 2015 - an...@suse.com + +- UI component for services handling moved from yast2-dns-server + to yast2 (fate#318771) +- 3.1.17 + +------------------------------------------------------------------- Fri Sep 4 11:49:22 UTC 2015 - mvid...@suse.com - Fix "Unescaped left brace in regex is deprecated" (boo#944490). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-dns-server-3.1.16/package/yast2-dns-server.spec new/yast2-dns-server-3.1.17/package/yast2-dns-server.spec --- old/yast2-dns-server-3.1.16/package/yast2-dns-server.spec 2015-09-18 15:21:10.000000000 +0200 +++ new/yast2-dns-server-3.1.17/package/yast2-dns-server.spec 2015-10-02 21:23:25.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-dns-server -Version: 3.1.16 +Version: 3.1.17 Release: 0 Url: https://github.com/yast/yast-dns-server @@ -33,8 +33,8 @@ BuildRequires: yast2-perl-bindings BuildRequires: yast2-testsuite -# requires DnsServerAPI::GetReverseIPforIPv6 -BuildRequires: yast2 >= 2.17.8 +# requires SrvStatusComponent +BuildRequires: yast2 >= 3.1.151 Requires: /usr/bin/host Requires: perl-gettext # Exporter Data::Dumper @@ -55,8 +55,8 @@ # FATE #303386: Network setup tools Requires: yast2-sysconfig -# for default TLD definition -Requires: yast2 >= 3.1.134 +# for SrvStatusComponent +Requires: yast2 >= 3.1.151 BuildArch: noarch @@ -82,7 +82,6 @@ %defattr(-,root,root) %dir %{yast_yncludedir}/dns-server %{yast_yncludedir}/dns-server/* -%{yast_dir}/lib/ui %{yast_clientdir}/dns-server.rb %{yast_clientdir}/dns-server_*.rb %{yast_moduledir}/* diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-dns-server-3.1.16/src/Makefile.am new/yast2-dns-server-3.1.17/src/Makefile.am --- old/yast2-dns-server-3.1.16/src/Makefile.am 2015-09-18 15:21:10.000000000 +0200 +++ new/yast2-dns-server-3.1.17/src/Makefile.am 2015-10-02 21:23:25.000000000 +0200 @@ -30,10 +30,6 @@ include/dns-server/cmdline.rb \ include/dns-server/helps.rb -ylibdir = @ylibdir@/ui -ylib_DATA = \ - lib/ui/srv_status_component.rb - scrconf_DATA = \ scrconf/dns_zone.scr \ scrconf/cfg_named.scr \ @@ -53,6 +49,6 @@ desktop_DATA = \ desktop/dns-server.desktop -EXTRA_DIST = $(module_DATA) $(module1_DATA) $(client_DATA) $(ynclude_DATA) $(scrconf_DATA) $(agent_SCRIPTS) $(schemafiles_DATA) $(desktop_DATA) $(ylib_DATA) +EXTRA_DIST = $(module_DATA) $(module1_DATA) $(client_DATA) $(ynclude_DATA) $(scrconf_DATA) $(agent_SCRIPTS) $(schemafiles_DATA) $(desktop_DATA) include $(top_srcdir)/Makefile.am.common diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-dns-server-3.1.16/src/lib/ui/srv_status_component.rb new/yast2-dns-server-3.1.17/src/lib/ui/srv_status_component.rb --- old/yast2-dns-server-3.1.16/src/lib/ui/srv_status_component.rb 2015-09-18 15:21:10.000000000 +0200 +++ new/yast2-dns-server-3.1.17/src/lib/ui/srv_status_component.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1,232 +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 - # - # 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 - - # Checks if the user requested the service to be enabled on boot - # - # @return [Boolean] - def enabled? - @enabled - end - - # 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-dns-server-3.1.16/test/srv_status_component_test.rb new/yast2-dns-server-3.1.17/test/srv_status_component_test.rb --- old/yast2-dns-server-3.1.16/test/srv_status_component_test.rb 2015-09-18 15:21:10.000000000 +0200 +++ new/yast2-dns-server-3.1.17/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 - return 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