Hello community,

here is the log from the commit of package yast2-packager for openSUSE:Factory 
checked in at 2016-10-13 11:25:09
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-packager (Old)
 and      /work/SRC/openSUSE:Factory/.yast2-packager.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-packager"

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-packager/yast2-packager.changes    
2016-10-10 16:17:48.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.yast2-packager.new/yast2-packager.changes       
2016-10-13 11:25:15.000000000 +0200
@@ -1,0 +2,7 @@
+Mon Oct 10 14:07:57 UTC 2016 - lsle...@suse.cz
+
+- Do not ask for a CD when the add-on check box is unchecked
+  (bsc#955186)
+- 3.2.2
+
+-------------------------------------------------------------------

Old:
----
  yast2-packager-3.2.1.tar.bz2

New:
----
  yast2-packager-3.2.2.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ yast2-packager.spec ++++++
--- /var/tmp/diff_new_pack.Dcnfu9/_old  2016-10-13 11:25:19.000000000 +0200
+++ /var/tmp/diff_new_pack.Dcnfu9/_new  2016-10-13 11:25:19.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-packager
-Version:        3.2.1
+Version:        3.2.2
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build

++++++ yast2-packager-3.2.1.tar.bz2 -> yast2-packager-3.2.2.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-packager-3.2.1/package/yast2-packager.changes 
new/yast2-packager-3.2.2/package/yast2-packager.changes
--- old/yast2-packager-3.2.1/package/yast2-packager.changes     2016-10-07 
17:14:24.000000000 +0200
+++ new/yast2-packager-3.2.2/package/yast2-packager.changes     2016-10-11 
11:29:31.000000000 +0200
@@ -1,4 +1,11 @@
 -------------------------------------------------------------------
+Mon Oct 10 14:07:57 UTC 2016 - lsle...@suse.cz
+
+- Do not ask for a CD when the add-on check box is unchecked
+  (bsc#955186)
+- 3.2.2
+
+-------------------------------------------------------------------
 Thu Oct  6 08:01:38 UTC 2016 - lsle...@suse.cz
 
 - Disable autorefresh for newly added local repositories ("cd",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-packager-3.2.1/package/yast2-packager.spec 
new/yast2-packager-3.2.2/package/yast2-packager.spec
--- old/yast2-packager-3.2.1/package/yast2-packager.spec        2016-10-07 
17:14:24.000000000 +0200
+++ new/yast2-packager-3.2.2/package/yast2-packager.spec        2016-10-11 
11:29:31.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-packager
-Version:        3.2.1
+Version:        3.2.2
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-packager-3.2.1/src/modules/SourceDialogs.rb 
new/yast2-packager-3.2.2/src/modules/SourceDialogs.rb
--- old/yast2-packager-3.2.1/src/modules/SourceDialogs.rb       2016-10-07 
17:14:24.000000000 +0200
+++ new/yast2-packager-3.2.2/src/modules/SourceDialogs.rb       2016-10-11 
11:29:31.000000000 +0200
@@ -67,6 +67,9 @@
     VALID_URL_SCHEMES = ["ftp", "tftp", "http", "https", "nfs",
       "nfs4", "cifs", "smb", "cd", "dvd", "iso", "dir", "file", "hd"]
 
+    # repository types which need special handling
+    SPECIAL_TYPES = [:slp, :cd, :dvd, :comm_repos, :sccrepos]
+
     def main
       Yast.import "Pkg"
       Yast.import "UI"
@@ -2177,7 +2180,9 @@
     end
 
     def SelectValidate(key, event)
-      event = deep_copy(event)
+      # skip validation if disabled by the global checkbox
+      return true if global_disable
+
       selected = Convert.to_symbol(UI.QueryWidget(Id(:type), :CurrentButton))
       if selected == nil
         # error popup
@@ -2218,7 +2223,7 @@
     # @param [String] key widget key
     # @param [Hash] event event description
     # @return [Symbol]
-    def SelectHandle(key, event)
+    def SelectHandle(_key, event)
       case event["ID"]
       when :back
         # reset the preselected URL when going back
@@ -2236,17 +2241,25 @@
       #  TODO: disable "download" option when CD or DVD source is selected
 
       selected = UI.QueryWidget(Id(:type), :CurrentButton)
-      return :finish if [:slp, :cd, :dvd, :comm_repos, 
:sccrepos].include?(selected)
+      return :finish if SPECIAL_TYPES.include?(selected) && !global_disable
 
       nil
     end
 
-    def SelectStore(key, event)
-      event = deep_copy(event)
+    # Get the status of the global checkbox.
+    # @return [Boolean] true if the global checkbox is displayed and is 
unchecked,
+    #   false otherwise
+    def global_disable
+      UI.WidgetExists(:add_addon) && !UI.QueryWidget(:add_addon, :Value)
+    end
+
+    def SelectStore(_key, _event)
       @_url = ""
       @_plaindir = false
       @_repo_name = ""
-      @addon_enabled = UI.WidgetExists(:add_addon) ?  
UI.QueryWidget(:add_addon, :Value) : nil
+      @addon_enabled = !global_disable
+
+      return nil if global_disable
 
       selected = Convert.to_symbol(UI.QueryWidget(Id(:type), :CurrentButton))
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-packager-3.2.1/test/source_dialogs_test.rb 
new/yast2-packager-3.2.2/test/source_dialogs_test.rb
--- old/yast2-packager-3.2.1/test/source_dialogs_test.rb        2016-10-07 
17:14:24.000000000 +0200
+++ new/yast2-packager-3.2.2/test/source_dialogs_test.rb        2016-10-11 
11:29:31.000000000 +0200
@@ -4,6 +4,11 @@
 
 Yast.import "SourceDialogs"
 
+def allow_global_checkbox_state(enabled)
+  allow(Yast::UI).to receive(:WidgetExists).with(:add_addon).and_return(true)
+  allow(Yast::UI).to receive(:QueryWidget).with(:add_addon, 
:Value).and_return(enabled)
+end
+
 describe Yast::SourceDialogs do
   subject { Yast::SourceDialogs }
 
@@ -97,5 +102,73 @@
 
       expect(described_class.instance_variable_get("@_url")).to eq "dvd:///"
     end
+
+    context "the global add-on checkbox is disabled" do
+      before do
+        allow_global_checkbox_state(false)
+      end
+
+      it "ignores the selected RadioButton" do
+        expect(Yast::UI).to_not receive(:QueryWidget).with(Id(:type), 
:CurrentButton)
+        described_class.SelectStore(:type, {})
+      end
+
+      it "sets empty URL" do
+        described_class.SelectStore(:type, {})
+        expect(described_class.instance_variable_get("@_url")).to eq ""
+      end
+    end
+  end
+
+  describe "SelectHandle" do
+    context "the global add-on checkbox is disabled" do
+      before do
+        allow_global_checkbox_state(false)
+      end
+
+      it "returns nil after pressing [Next] even if the CD RadioButton is 
selected" do
+        expect(Yast::UI).to receive(:QueryWidget).with(Id(:type), 
:CurrentButton).and_return(:cd)
+        expect(described_class.SelectHandle(nil, "ID" => :next)).to eq(nil)
+      end
+    end
+
+    context "the global add-on checkbox is enabled" do
+      before do
+        allow_global_checkbox_state(true)
+      end
+
+      it "returns :finish after pressing [Next] if the CD RadioButton is 
selected" do
+        expect(Yast::UI).to receive(:QueryWidget).with(Id(:type), 
:CurrentButton).and_return(:cd)
+        expect(described_class.SelectHandle(nil, "ID" => :next)).to eq(:finish)
+      end
+    end
+  end
+
+  describe "SelectValidate" do
+    context "the global add-on checkbox is disabled" do
+      before do
+        allow_global_checkbox_state(false)
+      end
+
+      it "returns true" do
+        expect(described_class.SelectValidate(nil, nil)).to eq(true)
+      end
+
+      it "ignores the RadioButton state" do
+        expect(Yast::UI).to_not receive(:QueryWidget).with(Id(:type), 
:CurrentButton)
+        described_class.SelectValidate(nil, nil)
+      end
+    end
+
+    context "the global add-on checkbox is enabled" do
+      before do
+        allow_global_checkbox_state(true)
+      end
+
+      it "returns :finish after pressing [Next] if the CD RadioButton is 
selected" do
+        expect(Yast::UI).to receive(:QueryWidget).with(Id(:type), 
:CurrentButton).and_return(:cd)
+        expect(described_class.SelectHandle(nil, "ID" => :next)).to eq(:finish)
+      end
+    end
   end
 end


Reply via email to