Hello community, here is the log from the commit of package yast2 for openSUSE:Factory checked in at 2017-01-23 11:27:32 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 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 2017-01-10 10:33:29.695865017 +0100 +++ /work/SRC/openSUSE:Factory/.yast2.new/yast2.changes 2017-01-23 11:27:33.457526556 +0100 @@ -1,0 +2,12 @@ +Thu Jan 19 13:49:10 UTC 2017 - [email protected] + +- Added a CWM::ReplacePoint widget +- 3.2.12 + +------------------------------------------------------------------- +Wed Jan 18 13:56:27 UTC 2017 - [email protected] + +- CWM: when skipping storing of widget values, skip also its + validation (FATE#322328) + +------------------------------------------------------------------- Old: ---- yast2-3.2.11.tar.bz2 New: ---- yast2-3.2.12.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2.spec ++++++ --- /var/tmp/diff_new_pack.kdLQWL/_old 2017-01-23 11:27:33.949456818 +0100 +++ /var/tmp/diff_new_pack.kdLQWL/_new 2017-01-23 11:27:33.953456251 +0100 @@ -17,7 +17,7 @@ Name: yast2 -Version: 3.2.11 +Version: 3.2.12 Release: 0 Summary: YaST2 - Main Package License: GPL-2.0 ++++++ yast2-3.2.11.tar.bz2 -> yast2-3.2.12.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.11/.travis.yml new/yast2-3.2.12/.travis.yml --- old/yast2-3.2.11/.travis.yml 2017-01-05 12:49:01.000477635 +0100 +++ new/yast2-3.2.12/.travis.yml 2017-01-20 08:38:44.906398301 +0100 @@ -1,19 +1,11 @@ -language: cpp -compiler: - - gcc +sudo: required +language: ruby +services: + - docker + before_install: - # disable rvm, use system Ruby - - rvm reset - - wget https://raw.githubusercontent.com/yast/yast-devtools/master/travis-tools/travis_setup.sh - - sh ./travis_setup.sh -p "rake yast2-core yast2-devtools yast2-testsuite yast2-ruby-bindings yast2-pkg-bindings ruby2.1-dev libaugeas-dev pkg-config" -g "rspec:3.3.0 yast-rake gettext simplecov coveralls rubocop:0.41.2 cheetah abstract_method cfa" + - docker build -t yast-yast2-image . script: - - rake check:pot - - rubocop - - make -s -f Makefile.cvs - - make -s - - sudo make -s install - # English messages, UTF-8, "C" locale for numeric formatting tests - - LC_ALL= LANG=en_US.UTF-8 LC_NUMERIC=C make -s check - # English messages, UTF-8, "C" locale for numeric formatting tests, enable test coverage report - - LC_ALL= LANG=en_US.UTF-8 LC_NUMERIC=C COVERAGE=1 rake test:unit - + # the "yast-travis-ruby" script is included in the base yastdevel/ruby image + # see https://github.com/yast/docker-yast-ruby/blob/master/yast-travis-ruby + - docker run -it -e TRAVIS_JOB_ID="$TRAVIS_JOB_ID" yast-yast2-image yast-travis-ruby diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.11/Dockerfile new/yast2-3.2.12/Dockerfile --- old/yast2-3.2.11/Dockerfile 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-3.2.12/Dockerfile 2017-01-20 08:38:44.906398301 +0100 @@ -0,0 +1,5 @@ +FROM yastdevel/ruby +COPY . /usr/src/app +# English messages, UTF-8, "C" locale for numeric formatting tests +ENV LC_ALL= LANG=en_US.UTF-8 LC_NUMERIC=C + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.11/library/commandline/test/commandline_test.rb new/yast2-3.2.12/library/commandline/test/commandline_test.rb --- old/yast2-3.2.11/library/commandline/test/commandline_test.rb 2017-01-05 12:49:01.008477636 +0100 +++ new/yast2-3.2.12/library/commandline/test/commandline_test.rb 2017-01-20 08:38:44.914398301 +0100 @@ -5,6 +5,16 @@ Yast.import "CommandLine" describe Yast::CommandLine do + # restore the original modes to not accidentally influence the other tests + # (these tests change the UI mode to "commandline") + around(:example) do |example| + orig_mode = Yast::Mode.mode + orig_ui = Yast::Mode.ui + example.run + Yast::Mode.SetMode(orig_mode) + Yast::Mode.SetUI(orig_ui) + end + it "invokes initialize, handler and finish" do expect(STDOUT).to receive(:puts).with("Initialize called").ordered expect(STDOUT).to receive(:puts).with("something").ordered diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.11/library/cwm/examples/replace_point_example.rb new/yast2-3.2.12/library/cwm/examples/replace_point_example.rb --- old/yast2-3.2.11/library/cwm/examples/replace_point_example.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-3.2.12/library/cwm/examples/replace_point_example.rb 2017-01-20 08:38:44.930398301 +0100 @@ -0,0 +1,65 @@ +# Simple example to demonstrate object oriented replace_point widget + +require_relative "example_helper" + +require "yast" + +require "cwm/widget" + +Yast.import "UI" +Yast.import "CWM" +Yast.import "Wizard" + +class SwitchWidget < CWM::PushButton + def initialize(replace_point, widgets) + @replace_point = replace_point + @widgets = widgets + end + + def label + "Switch" + end + + def handle + @widgets.rotate! + @replace_point.replace(@widgets.first) + end +end + +class PopupButtonWidget < CWM::PushButton + def label + "Popup" + end + + def handle + Yast::Popup.Message("Click!") + end +end + +class StoreWidget < CWM::InputField + def label + "write here" + end + + def validate + return true unless value.empty? + + Yast::Popup.Error("Empty value!") + false + end + + def store + Yast::Popup.Message(value) + end +end + +widgets = [PopupButtonWidget.new, CWM::Empty.new(:empty), StoreWidget.new] +replace_point = CWM::ReplacePoint.new(widget: widgets.first) + +content = Yast::Term.new(:VBox, + SwitchWidget.new(replace_point, widgets), + replace_point) + +Yast::Wizard.CreateDialog +Yast::CWM.show(content) +Yast::Wizard.CloseDialog diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.11/library/cwm/src/lib/cwm/widget.rb new/yast2-3.2.12/library/cwm/src/lib/cwm/widget.rb --- old/yast2-3.2.11/library/cwm/src/lib/cwm/widget.rb 2017-01-05 12:49:01.024477638 +0100 +++ new/yast2-3.2.12/library/cwm/src/lib/cwm/widget.rb 2017-01-20 08:38:44.930398301 +0100 @@ -828,4 +828,76 @@ ReplacePoint(Id(replace_point_id), VBox(VStretch(), HStretch())) end end + + # Placeholder widget that is used to replace content on demand. + # The most important method is {#replace} which allows switching content + class ReplacePoint < CustomWidget + # @param id [Object] id of widget. Needed to redefine only if more than one + # placeholder needed to be in dialog. Parameter type is limited by component + # system + # @param widget [CWM::AbstractWidget] initial widget in placeholder + def initialize(id: :_placeholder, widget: Empty.new(:_initial_placeholder)) + self.handle_all_events = true + self.widget_id = id + @widget = widget + end + + def contents + ReplacePoint(Id(widget_id), widget_content(@widget)) + end + + def init + @widget.init if @widget.respond_to?(:init) + end + + # Replaces content with different widget. All its events are properly + # handled. + # @param widget [CWM::AbstractWidget] widget to display and process events + def replace(widget) + log.info "replacing with new widget #{widget.inspect}" + Yast::UI.ReplaceWidget(@id, widget_content(widget)) + @widget = widget + init + end + + def help + @widget.respond_to?(:help) ? @widget.help : "" + end + + def handle(event) + return unless @widget.respond_to?(:handle) + + if [email protected]_all_events + return if event["ID"] != @widget.widget_id + end + + m = @widget.method(:handle) + if m.arity == 0 + m.call + else + m.call(event) + end + end + + def validate + @widget.respond_to?(:validate) ? @widget.validate : true + end + + def store + @widget.store if @widget.respond_to?(:store) + end + + def cleanup + @widget.cleanup if @widget.respond_to?(:cleanup) + end + + private + + def widget_content(widget) + definition = widget.cwm_definition + definition["_cwm_key"] = widget.widget_id # a bit hacky way to pass widget id + definition = Yast::CWM.prepareWidget(definition) + definition["widget"] + end + end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.11/library/cwm/src/modules/CWM.rb new/yast2-3.2.12/library/cwm/src/modules/CWM.rb --- old/yast2-3.2.11/library/cwm/src/modules/CWM.rb 2017-01-05 12:49:01.024477638 +0100 +++ new/yast2-3.2.12/library/cwm/src/modules/CWM.rb 2017-01-20 08:38:44.930398301 +0100 @@ -787,7 +787,8 @@ # @param [Hash] functions map initialize/save/handle fallbacks if not specified # with the widgets. # @param [Array<Object>] skip_store_for list of events for which the value of the widget will not be stored - # Useful mainly for non-standard redraw of widgets, like :reset or :redraw + # Useful mainly for non-standard redraw of widgets, like :reset or :redraw. It will skip also + # validation, because it is not needed as nothing is stored. # @return [Symbol] wizard sequencer symbol def Run(widgets, functions, skip_store_for: []) widgets = deep_copy(widgets) @@ -855,11 +856,12 @@ next if ret.nil? - ret = nil if save && !validateWidgets(widgets, event_descr) - - if ret.nil? + # ok, so what happens here? event want to save widgets, so check that there is no explicit + # skip of storing for this event and there is a widget containing invalid value. + # In such case do not save and clear ret, so we are still in loop + if save && !skip_store_for.include?(ret) && !validateWidgets(widgets, event_descr) + ret = nil save = false - next end end saveWidgets(widgets, event_descr) if save && !skip_store_for.include?(ret) @@ -928,7 +930,8 @@ # @param [String] abort_button label for dialog abort button # @param [Array] skip_store_for list of events for which the value of the widget will not be stored. # Useful mainly when some widget returns an event that should not trigger the storing, - # like a reset button or a redrawing + # like a reset button or a redrawing. It will skip also validation, because it is not needed + # as nothing is stored. # @return [Symbol] wizard sequencer symbol def show(contents, caption: nil, back_button: nil, next_button: nil, abort_button: nil, skip_store_for: []) widgets = widgets_in_contents(contents) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.11/library/cwm/test/widgets_test.rb new/yast2-3.2.12/library/cwm/test/widgets_test.rb --- old/yast2-3.2.11/library/cwm/test/widgets_test.rb 2017-01-05 12:49:01.028477638 +0100 +++ new/yast2-3.2.12/library/cwm/test/widgets_test.rb 2017-01-20 08:38:44.934398301 +0100 @@ -213,3 +213,131 @@ end end end + +describe CWM::ReplacePoint do + + class ReplacePointTestWidget < CWM::InputField + def label + "test" + end + + def init + end + + def handle + end + + def help + "help" + end + + def validate + false + end + + def store + end + + def cleanup + end + end + + describe ".new" do + it "has widget_id as passed" do + subject = described_class.new(id: "test") + expect(subject.widget_id).to eq "test" + end + + it "uses passed widget as initial content" do + widget = ReplacePointTestWidget.new + subject = described_class.new(widget: widget) + expect(widget).to receive(:init) + subject.init + end + end + + describe "#contents" do + it "generates contents including current widget UI definition" do + widget = ReplacePointTestWidget.new + subject = described_class.new(widget: widget) + + expect(subject.contents).to eq( + ReplacePoint( + Id(subject.widget_id), + InputField(Id(widget.widget_id), Opt(:hstretch), "test") + ) + ) + end + end + + describe "#init" do + it "passes init to enclosed widget" do + widget = ReplacePointTestWidget.new + subject = described_class.new(widget: widget) + expect(widget).to receive(:init) + subject.init + end + end + + describe "#replace" do + it "changes enclosed widget" do + subject = described_class.new(widget: CWM::Empty.new(:initial)) + widget = ReplacePointTestWidget.new + expect(widget).to receive(:store) + subject.replace(widget) + subject.store + end + end + + describe "#help" do + it "returns help of enclosed widget" do + widget = ReplacePointTestWidget.new + subject = described_class.new(widget: widget) + expect(subject.help).to eq "help" + end + end + + class ComplexHandleTest < CWM::Empty + def handle(_event) + nil + end + end + + describe "#handle" do + # Cannot test arity based dispatcher, because if we mock expect call of widget.handle, it is + # replaced by rspec method with -1 arity, causing wrong dispatcher functionality + + it "do nothing if passed event is not widget_id and enclosed widget do not handle all events" do + widget = ReplacePointTestWidget.new + subject = described_class.new(widget: widget) + expect(widget).to_not receive(:handle) + subject.handle("ID" => "Not mine") + end + end + + describe "#validate" do + it "passes validate to enclosed widget" do + widget = ReplacePointTestWidget.new + subject = described_class.new(widget: widget) + expect(subject.validate).to eq false + end + end + + describe "#store" do + it "passes store to enclosed widget" do + widget = ReplacePointTestWidget.new + subject = described_class.new(widget: widget) + expect(widget).to receive(:store) + subject.store + end + end + + describe "#cleanup" do + it "passes cleanup to enclosed widget" do + widget = ReplacePointTestWidget.new + subject = described_class.new(widget: widget) + expect(widget).to receive(:cleanup) + subject.cleanup + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.11/library/general/src/lib/installation/proposal_client.rb new/yast2-3.2.12/library/general/src/lib/installation/proposal_client.rb --- old/yast2-3.2.11/library/general/src/lib/installation/proposal_client.rb 2017-01-05 12:49:01.032477639 +0100 +++ new/yast2-3.2.12/library/general/src/lib/installation/proposal_client.rb 2017-01-20 08:38:44.938398301 +0100 @@ -116,6 +116,12 @@ # submodules that translate any strings internally based on internal maps # (e.g., keyboard etc.) need to take more action. # + # @option attrs [Boolean] "simple_mode" + # Propose in a different format, + # pioneered in the CASP/CaaSP all-in-one dialog: we are short of space, + # and employ labels instead of RichText. + # The result must include `label_proposal`. + # # @return [Hash] containing: # # * **`"links"`** [Array<String>] --- @@ -126,12 +132,17 @@ # Human readable proposal preformatted in HTML. It is possible to use # the {Yast::HTMLClass Yast::HTML} module for such formatting. # - # * **`"raw_proposal"`** [Array<String>, nil] - # (only used if `preformatted_proposal` is not present) --- + # * **`"raw_proposal"`** [Array<String>, nil] --- + # (only used if `preformatted_proposal` is not present) # Human readable proposal, not formatted yet. # The caller will format each item as a HTML list item (`<li>`). The # proposal can contain hyperlinks with IDs listed in the list `links`. # + # * **`"label_proposal"`** [Array<String>, nil] --- + # (only used for `simple_mode`) + # Human readable proposal. + # The caller will format each item as Label. + # # * **`"warning"`** [String, nil] --- # Warning in human readable format without HTML tags other than `\<br>`. # The warning will be embedded in appropriate HTML format specifications diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.11/library/general/test/mode_test.rb new/yast2-3.2.12/library/general/test/mode_test.rb --- old/yast2-3.2.11/library/general/test/mode_test.rb 2017-01-05 12:49:01.044477640 +0100 +++ new/yast2-3.2.12/library/general/test/mode_test.rb 2017-01-20 08:38:44.950398301 +0100 @@ -9,6 +9,15 @@ Yast::Mode.Initialize() end + # restore the original modes to not accidentally influence the other tests + around(:example) do |example| + orig_mode = Yast::Mode.mode + orig_ui = Yast::Mode.ui + example.run + Yast::Mode.SetMode(orig_mode) + Yast::Mode.SetUI(orig_ui) + end + describe "#SetMode" do it "sets mode to given one" do Yast::Mode.SetMode("installation") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.11/library/packages/test/file_conflict_callbacks_test.rb new/yast2-3.2.12/library/packages/test/file_conflict_callbacks_test.rb --- old/yast2-3.2.11/library/packages/test/file_conflict_callbacks_test.rb 2017-01-05 12:49:01.072477643 +0100 +++ new/yast2-3.2.12/library/packages/test/file_conflict_callbacks_test.rb 2017-01-20 08:38:44.978398301 +0100 @@ -159,6 +159,10 @@ end context "in UI mode" do + before do + allow(Yast::Mode).to receive(:commandline).and_return(false) + end + it "reuses the package installation progress" do expect(Yast::UI).to receive(:WidgetExists).and_return(true) expect(Yast::UI).to receive(:ChangeWidget).twice @@ -209,6 +213,10 @@ end context "in UI mode" do + before do + allow(Yast::Mode).to receive(:commandline).and_return(false) + end + it "returns false to abort if user clicks Abort" do expect(Yast::UI).to receive(:PollInput).and_return(:abort) @@ -320,6 +328,7 @@ context "in UI mode" do before do + allow(Yast::Mode).to receive(:commandline).and_return(false) allow(Yast::UI).to receive(:OpenDialog) allow(Yast::UI).to receive(:CloseDialog) allow(Yast::UI).to receive(:SetFocus) @@ -368,6 +377,10 @@ end context "in UI mode" do + before do + allow(Yast::Mode).to receive(:commandline).and_return(false) + end + it "no change if installation progress was already displayed" do ui = double("no method call expected", WidgetExists: true) stub_const("Yast::UI", ui) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.11/package/yast2.changes new/yast2-3.2.12/package/yast2.changes --- old/yast2-3.2.11/package/yast2.changes 2017-01-05 12:49:01.124477650 +0100 +++ new/yast2-3.2.12/package/yast2.changes 2017-01-20 08:38:45.022398301 +0100 @@ -1,4 +1,16 @@ ------------------------------------------------------------------- +Thu Jan 19 13:49:10 UTC 2017 - [email protected] + +- Added a CWM::ReplacePoint widget +- 3.2.12 + +------------------------------------------------------------------- +Wed Jan 18 13:56:27 UTC 2017 - [email protected] + +- CWM: when skipping storing of widget values, skip also its + validation (FATE#322328) + +------------------------------------------------------------------- Thu Jan 5 11:35:23 UTC 2017 - [email protected] - bnc#1017716 @@ -6,7 +18,7 @@ Such file cannot be mapped to any existing device and providing empty device name could lead to unexpected crashes in other parts of yast. -- 3.2.11 +- 3.2.11 ------------------------------------------------------------------- Thu Jan 5 08:06:25 UTC 2017 - [email protected] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.11/package/yast2.spec new/yast2-3.2.12/package/yast2.spec --- old/yast2-3.2.11/package/yast2.spec 2017-01-05 12:49:01.124477650 +0100 +++ new/yast2-3.2.12/package/yast2.spec 2017-01-20 08:38:45.022398301 +0100 @@ -17,7 +17,7 @@ Name: yast2 -Version: 3.2.11 +Version: 3.2.12 Release: 0 Summary: YaST2 - Main Package License: GPL-2.0
