Hello community,

here is the log from the commit of package yast2-packager for openSUSE:Factory 
checked in at 2014-08-07 08:07:35
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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    
2014-07-31 21:49:22.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.yast2-packager.new/yast2-packager.changes       
2014-08-07 08:07:39.000000000 +0200
@@ -1,0 +2,7 @@
+Wed Aug  6 13:31:31 CEST 2014 - [email protected]
+
+- Cleanup in license dialog handling, especially in handling while
+  aborting the installation (bnc#886662)
+- 3.1.39
+
+-------------------------------------------------------------------

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

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

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

Other differences:
------------------
++++++ yast2-packager.spec ++++++
--- /var/tmp/diff_new_pack.3Ijtez/_old  2014-08-07 08:07:39.000000000 +0200
+++ /var/tmp/diff_new_pack.3Ijtez/_new  2014-08-07 08:07:39.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-packager
-Version:        3.1.38
+Version:        3.1.39
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build

++++++ yast2-packager-3.1.38.tar.bz2 -> yast2-packager-3.1.39.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-packager-3.1.38/package/yast2-packager.changes 
new/yast2-packager-3.1.39/package/yast2-packager.changes
--- old/yast2-packager-3.1.38/package/yast2-packager.changes    2014-07-31 
15:44:43.000000000 +0200
+++ new/yast2-packager-3.1.39/package/yast2-packager.changes    2014-08-06 
15:13:47.000000000 +0200
@@ -1,4 +1,11 @@
 -------------------------------------------------------------------
+Wed Aug  6 13:31:31 CEST 2014 - [email protected]
+
+- Cleanup in license dialog handling, especially in handling while
+  aborting the installation (bnc#886662)
+- 3.1.39
+
+-------------------------------------------------------------------
 Thu Jul 31 14:43:16 CEST 2014 - [email protected]
 
 - Added user confirmation for aborting the repositories dialogs
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-packager-3.1.38/package/yast2-packager.spec 
new/yast2-packager-3.1.39/package/yast2-packager.spec
--- old/yast2-packager-3.1.38/package/yast2-packager.spec       2014-07-31 
15:44:43.000000000 +0200
+++ new/yast2-packager-3.1.39/package/yast2-packager.spec       2014-08-06 
15:13:47.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-packager
-Version:        3.1.38
+Version:        3.1.39
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-packager-3.1.38/src/modules/ProductLicense.rb 
new/yast2-packager-3.1.39/src/modules/ProductLicense.rb
--- old/yast2-packager-3.1.38/src/modules/ProductLicense.rb     2014-07-31 
15:44:44.000000000 +0200
+++ new/yast2-packager-3.1.39/src/modules/ProductLicense.rb     2014-08-06 
15:13:47.000000000 +0200
@@ -16,6 +16,8 @@
   class ProductLicenseClass < Module
     attr_accessor :license_patterns, :license_file_print
 
+    include Yast::Logger
+
     def main
       Yast.import "Pkg"
       Yast.import "UI"
@@ -1058,95 +1060,79 @@
 
       while true
         ret = UI.UserInput
+        log.info "User ret: #{ret}"
 
-        if Ops.is_string?(ret) &&
-            Builtins.regexpmatch(Builtins.tostring(ret), "^license_language_")
+        if ret.is_a?(::String) && ret.start_with?("license_language_")
           licenses_ref = arg_ref(licenses.value)
-          UpdateLicenseContent(licenses_ref, GetId(Builtins.tostring(ret)))
+          UpdateLicenseContent(licenses_ref, GetId(ret))
           licenses.value = licenses_ref.value
           ret = :language
-          # bugzilla #303828
-          # disabled next button unless yes/no is selected
-        elsif Ops.is_string?(ret) && ret.start_with?("eula_")
+        # bugzilla #303828
+        # disabled next button unless yes/no is selected
+        elsif ret.is_a?(::String) && ret.start_with?("eula_")
           Wizard.EnableNextButton if AllLicensesAcceptedOrDeclined()
-          # Aborting the license dialog
+        # Aborting the license dialog
         elsif ret == :abort
-          # bugzilla #218677
-          if base_product
-            if Popup.ConfirmAbort(:painless)
-              Builtins.y2milestone("Aborting...")
-              ret = :abort
-              break
-            end
+          # bnc#886662
+          if Stage.initial
+            next unless Popup.ConfirmAbort(:painless)
           else
             # popup question
-            if Popup.YesNo(_("Really abort the add-on product installation?"))
-              Builtins.y2milestone("Aborting...")
-              ret = :abort
-              break
-            end
+            next unless Popup.YesNo(_("Really abort the add-on product 
installation?"))
           end
+
+          log.warn "Aborting..."
+          break
         elsif ret == :next
+          if AllLicensesAccepted()
+            log.info "All licenses have been accepted."
+            ret = :accepted
+            break
+          end
+
           # License declined
-          if AllLicensesAccepted() != true
-            # message is void in case not accepting license doesn't stop the 
installation
-            if action == "continue"
-              Builtins.y2milestone(
-                "action in case of license refusal is continue, not asking 
user"
-              )
-              ret = :accepted
-              break
-            end
-            # text changed due to bug #162499
-            refuse_popup_text = base_product ?
-              # text asking whether to refuse a license (Yes-No popup)
-              _(
-                "Refusing the license agreement cancels the 
installation.\nReally refuse the agreement?"
-              ) :
-              # text asking whether to refuse a license (Yes-No popup)
-              _(
-                "Refusing the license agreement cancels the add-on\nproduct 
installation. Really refuse the agreement?"
-              )
-            if !Popup.YesNo(refuse_popup_text)
-              next
-            else
-              Builtins.y2milestone("License has been declined.")
-              if action == "abort"
-                ret = :abort
-                break
-              elsif action == "continue"
-                ret = :accepted
-                break
-              elsif action == "halt"
-                ret = :halt
-                break
-                # timed ok/cancel popup
-                if !Popup.TimedOKCancel(_("The system is shutting down..."), 
10)
-                  next
-                else
-                  ret = :halt
-                  break
-                end
-              else
-                Builtins.y2error("Unknown action %1", action)
-                ret = :abort
-                break
-              end
-            end
-          else
-            Builtins.y2milestone("All licenses have been accepted.")
+
+          # message is void in case not accepting license doesn't stop the 
installation
+          if action == "continue"
+            log.info "action in case of license refusal is continue, not 
asking user"
             ret = :accepted
             break
           end
+
+          # text changed due to bug #162499
+          refuse_popup_text = base_product ?
+            # text asking whether to refuse a license (Yes-No popup)
+            _("Refusing the license agreement cancels the 
installation.\nReally refuse the agreement?")
+            :
+            # text asking whether to refuse a license (Yes-No popup)
+            _("Refusing the license agreement cancels the add-on\nproduct 
installation. Really refuse the agreement?")
+          next unless Popup.YesNo(refuse_popup_text)
+
+          log.info "License has been declined."
+
+          case action
+          when "abort"
+            ret = :abort
+          when "halt"
+            # timed ok/cancel popup
+            next unless Popup.TimedOKCancel(_("The system is shutting 
down..."), 10)
+            ret = :halt
+          else
+            log.error "Unknown action #{action}"
+            ret = :abort
+          end
+
+          break
         elsif ret == :back
           ret = :back
           break
         else
-          Builtins.y2error("Unhandled input: %1", ret)
+          log.error "Unhandled input: #{ret}"
         end
       end
 
-      Convert.to_symbol(ret)
+      log.info "Returning #{ret}"
+      ret
     end
 
     # Generic cleanup
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-packager-3.1.38/test/product_license_test.rb 
new/yast2-packager-3.1.39/test/product_license_test.rb
--- old/yast2-packager-3.1.38/test/product_license_test.rb      1970-01-01 
01:00:00.000000000 +0100
+++ new/yast2-packager-3.1.39/test/product_license_test.rb      2014-08-06 
15:13:47.000000000 +0200
@@ -0,0 +1,123 @@
+#! /usr/bin/env rspec
+
+require_relative "./test_helper"
+
+Yast.import "ProductLicense"
+Yast.import "UI"
+Yast.import "Wizard"
+Yast.import "Popup"
+Yast.import "Stage"
+
+describe Yast::ProductLicense do
+  describe "#HandleLicenseDialogRet" do
+    before(:each) do
+      # By default, always exit the dialog with :accepted (all licenses 
accepted)
+      allow(Yast::ProductLicense).to 
receive(:AllLicensesAccepted).and_return(true)
+
+      # Make sure that Yast::UI.:UserInput always returns a symbol as the last 
item
+      # to exit from the while loop, :back is a safe default
+      allow(Yast::UI).to receive(:UserInput).and_return(:back)
+    end
+
+    licenses_ref = Yast::ArgRef.new({})
+
+    context "while changing a license language" do
+      it "updates the UI with new license translation" do
+        expect(Yast::UI).to 
receive(:UserInput).and_return("license_language_pt_BR", :next)
+        expect(Yast::ProductLicense).to 
receive(:UpdateLicenseContent).and_return(nil)
+        expect(Yast::ProductLicense.HandleLicenseDialogRet(licenses_ref, 
"base_prod", "abort")).to eq(:accepted)
+      end
+    end
+
+    context "while adjusting EULA agreement buttons" do
+      it "enables the [Next] button" do
+        expect(Yast::UI).to receive(:UserInput).and_return("eula_some_ID", 
:next)
+        expect(Yast::ProductLicense).to 
receive(:AllLicensesAcceptedOrDeclined).and_return(true)
+        expect(Yast::Wizard).to receive(:EnableNextButton).and_return(true)
+        expect(Yast::ProductLicense.HandleLicenseDialogRet(licenses_ref, 
"base_prod", "abort")).to eq(:accepted)
+      end
+    end
+
+    context "while user wants to abort from the License Agreement dialog" do
+      context "in inst-sys" do
+        before(:each) do
+          expect(Yast::Stage).to receive(:stage).and_return("initial")
+        end
+
+        context "user confirms the aborting" do
+          it "returns :abort" do
+            expect(Yast::UI).to receive(:UserInput).and_return(:abort)
+            expect(Yast::Popup).to receive(:ConfirmAbort).and_return(true)
+            expect(Yast::ProductLicense.HandleLicenseDialogRet(licenses_ref, 
"base_prod", "abort")).to eq(:abort)
+          end
+        end
+
+        context "user declines the aborting" do
+          it "continues handling the user input" do
+            expect(Yast::UI).to receive(:UserInput).and_return(:abort, :next)
+            expect(Yast::Popup).to receive(:ConfirmAbort).and_return(false)
+            expect(Yast::ProductLicense.HandleLicenseDialogRet(licenses_ref, 
"base_prod", "abort")).to eq(:accepted)
+          end
+        end
+      end
+
+      context "on running system" do
+        before(:each) do
+          expect(Yast::Stage).to receive(:stage).and_return("normal")
+        end
+
+        context "user confirms the aborting" do
+          it "returns :abort" do
+            expect(Yast::UI).to receive(:UserInput).and_return(:abort)
+            expect(Yast::Popup).to receive(:YesNo).and_return(true)
+            expect(Yast::ProductLicense.HandleLicenseDialogRet(licenses_ref, 
"base_prod", "abort")).to eq(:abort)
+          end
+        end
+
+        context "user declines the aborting" do
+          it "continues handling the user input" do
+            expect(Yast::UI).to receive(:UserInput).and_return(:abort, :next)
+            expect(Yast::Popup).to receive(:YesNo).and_return(false)
+            expect(Yast::ProductLicense.HandleLicenseDialogRet(licenses_ref, 
"base_prod", "abort")).to eq(:accepted)
+          end
+        end
+      end
+    end
+
+    context "while going back to previous dialog" do
+      it "returns :back" do
+        expect(Yast::UI).to receive(:UserInput).and_return(:back)
+        expect(Yast::ProductLicense.HandleLicenseDialogRet(licenses_ref, 
"base_prod", "abort")).to eq(:back)
+      end
+    end
+
+    context "while going to the next dialog" do
+      before(:each) do
+        expect(Yast::UI).to 
receive(:UserInput).and_return(:next).at_least(:once)
+        # Confirm that I do not agree with the license
+        allow(Yast::Popup).to receive(:YesNo).and_return(true)
+      end
+
+      context "while all licenses have been accepted" do
+        it "returns :accepted" do
+          expect(Yast::ProductLicense).to 
receive(:AllLicensesAccepted).and_return(true)
+          expect(Yast::ProductLicense.HandleLicenseDialogRet(licenses_ref, 
"base_prod", "abort")).to eq(:accepted)
+        end
+      end
+
+      context "while some license(s) have not been accepted" do
+        it "returns symbol :abort, :accepted, :halt according to the third 
function parameter" do
+          expect(Yast::ProductLicense).to 
receive(:AllLicensesAccepted).and_return(false).at_least(:once)
+          # :halt case
+          allow(Yast::ProductLicense).to 
receive(:TimedOKCancel).and_return(true)
+
+          expect(Yast::ProductLicense.HandleLicenseDialogRet(licenses_ref, 
"base_prod", "abort")).to eq(:abort)
+          expect(Yast::ProductLicense.HandleLicenseDialogRet(licenses_ref, 
"base_prod", "continue")).to eq(:accepted)
+          expect(Yast::ProductLicense.HandleLicenseDialogRet(licenses_ref, 
"base_prod", "halt")).to eq(:halt)
+          expect(Yast::ProductLicense.HandleLicenseDialogRet(licenses_ref, 
"base_prod", "unknown")).to eq(:abort)
+        end
+      end
+    end
+
+  end
+end

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to