Hello community, here is the log from the commit of package yast2-slp for openSUSE:Factory checked in at 2016-08-10 19:53:52 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-slp (Old) and /work/SRC/openSUSE:Factory/.yast2-slp.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-slp" Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-slp/yast2-slp.changes 2016-06-09 15:58:02.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.yast2-slp.new/yast2-slp.changes 2016-08-10 19:53:53.000000000 +0200 @@ -1,0 +2,7 @@ +Mon Jul 25 09:36:32 UTC 2016 - [email protected] + +- Add a ServiceSelectionDialog to be used by others YaST2 modules + (related to fate#319716) +- 3.1.9 + +------------------------------------------------------------------- Old: ---- yast2-slp-3.1.8.tar.bz2 New: ---- yast2-slp-3.1.9.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-slp.spec ++++++ --- /var/tmp/diff_new_pack.CZXOyd/_old 2016-08-10 19:53:54.000000000 +0200 +++ /var/tmp/diff_new_pack.CZXOyd/_new 2016-08-10 19:53:54.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-slp -Version: 3.1.8 +Version: 3.1.9 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -64,6 +64,9 @@ %{yast_plugindir}/libpy2ag_slp.la %{yast_moduledir}/SLP.rb %{yast_moduledir}/SlpService.rb +%dir %{yast_libdir}/slp +%dir %{yast_libdir}/slp/dialogs +%{yast_libdir}/slp/dialogs/* %doc %{yast_docdir} %changelog ++++++ yast2-slp-3.1.8.tar.bz2 -> yast2-slp-3.1.9.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-slp-3.1.8/.travis.yml new/yast2-slp-3.1.9/.travis.yml --- old/yast2-slp-3.1.8/.travis.yml 2016-05-03 16:15:32.000000000 +0200 +++ new/yast2-slp-3.1.9/.travis.yml 2016-07-26 15:19:15.000000000 +0200 @@ -4,8 +4,8 @@ before_install: # disable rvm, use system Ruby - rvm reset - - wget https://raw.githubusercontent.com/yast/yast-devtools/SLE-12-GA/travis-tools/travis_setup.sh - - sh ./travis_setup.sh -p "rake yast2-devtools yast2 yast2-core-dev libslp-dev doxygen" -g "rspec:3.3.0 yast-rake gettext" + - wget https://raw.githubusercontent.com/yast/yast-devtools/master/travis-tools/travis_setup.sh + - sh ./travis_setup.sh -p "rake yast2-devtools yast2 yast2-core-dev libslp-dev" -g "rspec:3.3.0 yast-rake gettext simplecov coveralls:0.8.10" script: - rake check:syntax - rake check:pot diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-slp-3.1.8/package/yast2-slp.changes new/yast2-slp-3.1.9/package/yast2-slp.changes --- old/yast2-slp-3.1.8/package/yast2-slp.changes 2016-06-06 11:33:08.000000000 +0200 +++ new/yast2-slp-3.1.9/package/yast2-slp.changes 2016-07-26 15:19:16.000000000 +0200 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Mon Jul 25 09:36:32 UTC 2016 - [email protected] + +- Add a ServiceSelectionDialog to be used by others YaST2 modules + (related to fate#319716) +- 3.1.9 + +------------------------------------------------------------------- Mon Jun 6 09:15:01 UTC 2016 - [email protected] - Stop generating autodocs (fate#320356) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-slp-3.1.8/package/yast2-slp.spec new/yast2-slp-3.1.9/package/yast2-slp.spec --- old/yast2-slp-3.1.8/package/yast2-slp.spec 2016-06-06 11:33:08.000000000 +0200 +++ new/yast2-slp-3.1.9/package/yast2-slp.spec 2016-07-26 15:19:16.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-slp -Version: 3.1.8 +Version: 3.1.9 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -58,4 +58,7 @@ %{yast_plugindir}/libpy2ag_slp.la %{yast_moduledir}/SLP.rb %{yast_moduledir}/SlpService.rb +%dir %{yast_libdir}/slp +%dir %{yast_libdir}/slp/dialogs +%{yast_libdir}/slp/dialogs/* %doc %{yast_docdir} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-slp-3.1.8/src/Makefile.am new/yast2-slp-3.1.9/src/Makefile.am --- old/yast2-slp-3.1.8/src/Makefile.am 2016-05-03 16:15:32.000000000 +0200 +++ new/yast2-slp-3.1.9/src/Makefile.am 2016-07-26 15:19:16.000000000 +0200 @@ -4,6 +4,10 @@ modules/SLP.rb \ modules/SlpService.rb -EXTRA_DIST = $(module_DATA) +ylibdialogsdir = @ylibdir@/slp/dialogs +ylibdialogs_DATA = \ + lib/slp/dialogs/service_selection.rb + +EXTRA_DIST = $(module_DATA) $(ylibdialogs_DATA) include $(top_srcdir)/Makefile.am.common diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-slp-3.1.8/src/lib/slp/dialogs/service_selection.rb new/yast2-slp-3.1.9/src/lib/slp/dialogs/service_selection.rb --- old/yast2-slp-3.1.8/src/lib/slp/dialogs/service_selection.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-slp-3.1.9/src/lib/slp/dialogs/service_selection.rb 2016-07-26 15:19:16.000000000 +0200 @@ -0,0 +1,167 @@ +# ------------------------------------------------------------------------------ +# Copyright (c) 2016 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" +require "ui/dialog" + +module Yast + module Dialogs + # This class implements a services selection dialog. + class ServiceSelection < ::UI::Dialog + Yast.import "UI" + Yast.import "Label" + Yast.import "Report" + + # @return [Array<SlpServiceClass::Service>] list of services to show + attr_reader :services + # @return [String] dialog's heading + attr_reader :heading + # @return [String] dialog's description + attr_reader :description + # @return [String] message to be shown when no service was selected + attr_reader :no_selected_msg + # @return [SlpServiceClass::Service] initially selected service + attr_reader :initial + + # Run dialog + # + # The return value will be: + # * A service in case one was selected + # * :cancel symbol if the dialog was canceled + # + # @example Select some service + # Yast::Dialogs::SelectionService.run(services: services) #=> :scc + # #=> #<Yast::SlpServiceClass::Service...> + # + # @example Press the 'cancel' button + # Yast::Dialogs::SelectionService.run(services: services) #=> :cancel + # + # @param services [Array<SlpServiceClass::Service] list of services to show + # @param heading [String] Dialog's heading + # @param description [String] Dialog's description (to be shown on top of the list) + # @param no_selected_msg [String] Message to be shown when no service was selected + # @return [SlpServiceClass::Service,Symbol] selected service or :cancel symbol + # + # @see #run + def self.run(services:, heading: nil, description: nil) + new(services: services, heading: nil, description: nil, + no_selected_msg: nil, initial: nil).run + end + + # Constructor + # + # @param services [Array<SlpServiceClass::Service>] list of services to show + # @param heading [String] Dialog's heading. If nil (or not specified), a default + # heading will be used). + # @param description [String] Dialog's description (to be shown on top of the list). + # If nil (or not specified) a default description will be used. + # @param no_selected_msg [String] Message to be shown when no service was selected + # If nil (or not specified) a default description will be used. + # @param initial [SlpServiceClass::Service] initially selected service. If nil + # (or not specified) the first service will be used. + def initialize(services:, heading: nil, description: nil, no_selected_msg: nil, initial: nil) + super() + + textdomain "registration" + + @services = services + @heading = heading || _("Service selection") + @description = description || _("Select a detected service from the list.") + @no_selected_msg = no_selected_msg || _("No service was selected.") + @initial = initial || services.first + end + + # Handler for the Ok button + # + # If no option was selected, a error message is shown. + def ok_handler + selected = Yast::UI.QueryWidget(Id(:services), :CurrentButton) + if !selected + Yast::Report.Error(no_selected_msg) + else + finish_dialog(services[selected.to_i]) + end + end + + # Handler for the cancel button + def cancel_handler + finish_dialog(:cancel) + end + + protected + + # Dialog's initial content + # + # @return [Yast::Term] Content + def dialog_content + MarginBox(2, 0.5, + VBox( + # popup heading (in bold) + Heading(heading), + VSpacing(0.5), + Label(description), + VSpacing(0.5), + RadioButtonGroup( + Id(:services), + Left( + HVSquash( + VBox(*services_radio_buttons) + ) + ) + ), + VSpacing(Opt(:vstretch), 1), + button_box + )) + end + + # Dialog options + # + # @return [Yast::Term] Dialog's options + def dialog_options + Yast::Term.new(:opt, :decorated) + end + + # Return dialog's buttons + # + # @return [Yast::Term] Buttons' description + def button_box + ButtonBox( + PushButton(Id(:ok), Opt(:default), Yast::Label.OKButton), + PushButton(Id(:cancel), Yast::Label.CancelButton) + ) + end + + # Return service radio buttons + # + # @return [Yast::Term] Service radio button's description + def services_radio_buttons + services.map.with_index do |service, idx| + Left( + RadioButton(Id(idx.to_s), service_to_description(service), service == initial) + ) + end + end + + # Return the service description to be shown to the user + # + # @return [String] Service description + def service_to_description(service) + url = service.slp_url.sub(service.slp_type, service.protocol) + descr = service.attributes.description + + # display URL and the description if it is present + (descr && !descr.empty?) ? "#{descr} (#{url})" : url + end + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-slp-3.1.8/src/modules/SlpService.rb new/yast2-slp-3.1.9/src/modules/SlpService.rb --- old/yast2-slp-3.1.8/src/modules/SlpService.rb 2016-05-03 16:15:32.000000000 +0200 +++ new/yast2-slp-3.1.9/src/modules/SlpService.rb 2016-07-26 15:19:16.000000000 +0200 @@ -102,7 +102,7 @@ name = type_parts[1] protocol = type_parts[2] else - raise "Incorrect slp service type: #{service.inspect}" + raise "Incorrect slp service type: #{service_type.inspect}" end OpenStruct.new :name => name, :protocol => protocol end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-slp-3.1.8/test/Makefile.am new/yast2-slp-3.1.9/test/Makefile.am --- old/yast2-slp-3.1.8/test/Makefile.am 2016-05-03 16:15:32.000000000 +0200 +++ new/yast2-slp-3.1.9/test/Makefile.am 2016-07-26 15:19:16.000000000 +0200 @@ -1,5 +1,6 @@ TESTS = \ - slp_service_test.rb + slp_service_test.rb \ + dialogs/service_selection_test.rb TEST_EXTENSIONS = .rb RB_LOG_COMPILER = rspec diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-slp-3.1.8/test/dialogs/service_selection_test.rb new/yast2-slp-3.1.9/test/dialogs/service_selection_test.rb --- old/yast2-slp-3.1.8/test/dialogs/service_selection_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-slp-3.1.9/test/dialogs/service_selection_test.rb 2016-07-26 15:19:16.000000000 +0200 @@ -0,0 +1,101 @@ +#!/usr/bin/env rspec + +require_relative "../spec_helper" +require "slp/dialogs/service_selection" + +Yast.import "SlpService" + +describe Yast::Dialogs::ServiceSelection do + include Yast::UIShortcuts + + subject(:dialog) { Yast::Dialogs::ServiceSelection.new(services: services) } + + before do + allow(Yast::UI).to receive(:OpenDialog).and_return(true) + allow(Yast::UI).to receive(:CloseDialog).and_return(true) + end + + let(:services) do + [ + Yast::SlpServiceClass::Service.new( + name: "smt1", + data: { "pcSrvType" => "smt", "srvurl" => "http://smt1.example.net" } + ), + Yast::SlpServiceClass::Service.new( + name: "smt2", + data: { "pcSrvType" => "smt", "srvurl" => "http://smt2.example.net" } + ) + ] + end + + before do + allow(Yast::SlpServiceClass::DnsCache).to receive(:resolve) + .and_return("somehost") + allow(Yast::SLP).to receive(:GetUnicastAttrMap) + .and_return(type: "server", description: "SMT") + end + + describe "#run" do + context "when the OK button is pressed" do + before do + expect(Yast::UI).to receive(:QueryWidget).with(Id(:services), :CurrentButton) + .and_return(selected) + allow(Yast::UI).to receive(:UserInput).and_return(:ok) + end + + context "when a service is selected" do + let(:selected) { "0" } + + it "returns the selected service" do + expect(dialog.run).to eq(services.first) + end + end + + context "when no service is selected" do + let(:selected) { nil } + + subject(:dialog) do + Yast::Dialogs::ServiceSelection.new(services: services, no_selected_msg: "No service") + end + + it "shows an error" do + expect(Yast::UI).to receive(:UserInput).and_return(:ok, :cancel) + expect(Yast::Report).to receive(:Error).with("No service") + .and_return(true) + dialog.run + end + end + end + + context "when the cancel button is pressed" do + it "returns :cancel" do + expect(Yast::UI).to receive(:UserInput).and_return(:cancel) + expect(dialog.run).to eq(:cancel) + end + end + + it "sets default heading and description" do + expect(Yast::UI).to receive(:UserInput).and_return(:cancel) + expect(dialog).to receive(:Heading) + .with(_("Service selection")) + expect(dialog).to receive(:Label) + .with(_("Select a detected service from the list.")) + dialog.run + end + + context "when customized heading/description are specified" do + subject(:dialog) do + Yast::Dialogs::ServiceSelection.new( + services: services, heading: "some title", description: "some description" + ) + end + + it "sets heading and description accordingly" do + expect(Yast::UI).to receive(:UserInput).and_return(:cancel) + expect(dialog).to receive(:Heading).with("some title") + expect(dialog).to receive(:Label).with("some description") + dialog.run + end + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-slp-3.1.8/test/slp_service_test.rb new/yast2-slp-3.1.9/test/slp_service_test.rb --- old/yast2-slp-3.1.8/test/slp_service_test.rb 2016-05-03 16:15:32.000000000 +0200 +++ new/yast2-slp-3.1.9/test/slp_service_test.rb 2016-07-26 15:19:16.000000000 +0200 @@ -1,8 +1,6 @@ #!/usr/bin/env rspec # -ENV['Y2DIR'] = File.expand_path('../../src', __FILE__) - -require 'yast' +require_relative 'spec_helper' Yast.import 'SlpService' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-slp-3.1.8/test/spec_helper.rb new/yast2-slp-3.1.9/test/spec_helper.rb --- old/yast2-slp-3.1.8/test/spec_helper.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-slp-3.1.9/test/spec_helper.rb 2016-07-26 15:19:16.000000000 +0200 @@ -0,0 +1,36 @@ +ENV["Y2DIR"] = File.expand_path("../../src", __FILE__) +libdir = File.expand_path("../../src/lib", __FILE__) +$LOAD_PATH.unshift(libdir) + +require "yast" +require "pathname" +require "yast/rspec" + +if ENV["COVERAGE"] + require "simplecov" + + # use coveralls for on-line code coverage reporting at Travis CI + if ENV["TRAVIS"] + require "coveralls" + + SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[ + SimpleCov::Formatter::HTMLFormatter, + Coveralls::SimpleCov::Formatter + ] + end + + SimpleCov.start do + add_filter "/test/" + end +end + +# configure RSpec +RSpec.configure do |config| + config.mock_with :rspec do |c| + # https://relishapp.com/rspec/rspec-mocks/v/3-0/docs/verifying-doubles/partial-doubles + c.verify_partial_doubles = true + end + + config.extend Yast::I18n # available in context/describe + config.include Yast::I18n # available in it/let/before +end
