Hello community,

here is the log from the commit of package yast2-ruby-bindings for 
openSUSE:Factory checked in at 2020-01-04 19:20:36
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-ruby-bindings (Old)
 and      /work/SRC/openSUSE:Factory/.yast2-ruby-bindings.new.6675 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-ruby-bindings"

Sat Jan  4 19:20:36 2020 rev:99 rq:758139 version:4.2.6

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-ruby-bindings/yast2-ruby-bindings.changes  
2019-12-11 12:03:46.616774380 +0100
+++ 
/work/SRC/openSUSE:Factory/.yast2-ruby-bindings.new.6675/yast2-ruby-bindings.changes
        2020-01-04 19:20:42.317120330 +0100
@@ -1,0 +2,8 @@
+Tue Dec 17 14:48:01 UTC 2019 - Josef Reidinger <[email protected]>
+
+- Fix returning error codes from y2start start point. Helps with
+  CLI exit codes and also with failed installation (helps e.g. with
+  bsc#1144351 and yast lan CLI)
+- 4.2.6
+
+-------------------------------------------------------------------

Old:
----
  yast2-ruby-bindings-4.2.5.tar.bz2

New:
----
  yast2-ruby-bindings-4.2.6.tar.bz2

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

Other differences:
------------------
++++++ yast2-ruby-bindings.spec ++++++
--- /var/tmp/diff_new_pack.Ttgidb/_old  2020-01-04 19:20:42.945120608 +0100
+++ /var/tmp/diff_new_pack.Ttgidb/_new  2020-01-04 19:20:42.945120608 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-ruby-bindings
-Version:        4.2.5
+Version:        4.2.6
 Release:        0
 Url:            https://github.com/yast/yast-ruby-bindings
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build

++++++ yast2-ruby-bindings-4.2.5.tar.bz2 -> yast2-ruby-bindings-4.2.6.tar.bz2 
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-ruby-bindings-4.2.5/package/yast2-ruby-bindings.changes 
new/yast2-ruby-bindings-4.2.6/package/yast2-ruby-bindings.changes
--- old/yast2-ruby-bindings-4.2.5/package/yast2-ruby-bindings.changes   
2019-12-06 11:56:45.000000000 +0100
+++ new/yast2-ruby-bindings-4.2.6/package/yast2-ruby-bindings.changes   
2019-12-19 11:55:34.000000000 +0100
@@ -1,4 +1,12 @@
 -------------------------------------------------------------------
+Tue Dec 17 14:48:01 UTC 2019 - Josef Reidinger <[email protected]>
+
+- Fix returning error codes from y2start start point. Helps with
+  CLI exit codes and also with failed installation (helps e.g. with
+  bsc#1144351 and yast lan CLI)
+- 4.2.6
+
+-------------------------------------------------------------------
 Thu Dec  5 10:37:29 CET 2019 - [email protected]
 
 - S390: Evaluating an architecture specific string which will be
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-ruby-bindings-4.2.5/package/yast2-ruby-bindings.spec 
new/yast2-ruby-bindings-4.2.6/package/yast2-ruby-bindings.spec
--- old/yast2-ruby-bindings-4.2.5/package/yast2-ruby-bindings.spec      
2019-12-06 11:56:45.000000000 +0100
+++ new/yast2-ruby-bindings-4.2.6/package/yast2-ruby-bindings.spec      
2019-12-19 11:55:34.000000000 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-ruby-bindings
-Version:        4.2.5
+Version:        4.2.6
 Url:            https://github.com/yast/yast-ruby-bindings
 Release:        0
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-ruby-bindings-4.2.5/src/ruby/yast/y2start_helpers.rb 
new/yast2-ruby-bindings-4.2.6/src/ruby/yast/y2start_helpers.rb
--- old/yast2-ruby-bindings-4.2.5/src/ruby/yast/y2start_helpers.rb      
2019-12-06 11:56:45.000000000 +0100
+++ new/yast2-ruby-bindings-4.2.6/src/ruby/yast/y2start_helpers.rb      
2019-12-19 11:55:34.000000000 +0100
@@ -98,6 +98,30 @@
       left_title + architecture.rjust(80-left_title.size)
     end
 
+
+    # client returned special result, this is used as offset (or as generic 
error)
+    RES_CLIENT_RESULT = 16
+    # yast succeed
+    RES_OK = 0
+    # Symbols representing failure
+    FAILED_SYMBOLS = [:abort, :cancel]
+    # transform various ruby objects to exit code. Useful to detection if YaST 
process failed
+    # and in CLI
+    def self.generate_exit_code(value)
+      case value
+      when nil, true
+        RES_OK
+      when false
+        RES_CLIENT_RESULT
+      when Integer
+        RES_CLIENT_RESULT + value
+      when Symbol
+        FAILED_SYMBOLS.include?(value) ? RES_CLIENT_RESULT : RES_OK
+      else
+        RES_OK
+      end
+    end
+
     private_class_method def self.read_values
       arch = `/usr/bin/read_values -c`.strip
       return "" unless $?.success?
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-ruby-bindings-4.2.5/src/y2start/y2start 
new/yast2-ruby-bindings-4.2.6/src/y2start/y2start
--- old/yast2-ruby-bindings-4.2.5/src/y2start/y2start   2019-12-06 
11:56:45.000000000 +0100
+++ new/yast2-ruby-bindings-4.2.6/src/y2start/y2start   2019-12-19 
11:55:34.000000000 +0100
@@ -55,6 +55,7 @@
 Yast::UI.SetApplicationTitle(
   Yast::Y2StartHelpers.application_title(args[:client_name])) if set_title
 
-Yast::WFM.CallFunction(args[:client_name], args[:client_options][:params])
 
-0
+Yast::Y2StartHelpers.generate_exit_code(
+  Yast::WFM.CallFunction(args[:client_name], args[:client_options][:params])
+)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-ruby-bindings-4.2.5/tests/integration/run.rb 
new/yast2-ruby-bindings-4.2.6/tests/integration/run.rb
--- old/yast2-ruby-bindings-4.2.5/tests/integration/run.rb      2019-12-06 
11:56:45.000000000 +0100
+++ new/yast2-ruby-bindings-4.2.6/tests/integration/run.rb      2019-12-19 
11:55:34.000000000 +0100
@@ -36,6 +36,7 @@
   exit true
 else
   puts "Test failed: '#{cmd}'."
+  puts "result: #{File.exist?(RESULT) ? "'#{File.read(RESULT)}'" : "file not 
exist"}"
   if File.exist?(OUTPUT)
     puts "Output was:"
     puts File.read(OUTPUT)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-ruby-bindings-4.2.5/tests/y2start_helpers_spec.rb 
new/yast2-ruby-bindings-4.2.6/tests/y2start_helpers_spec.rb
--- old/yast2-ruby-bindings-4.2.5/tests/y2start_helpers_spec.rb 2019-12-06 
11:56:45.000000000 +0100
+++ new/yast2-ruby-bindings-4.2.6/tests/y2start_helpers_spec.rb 2019-12-19 
11:55:34.000000000 +0100
@@ -107,4 +107,34 @@
     end
   end
 
+  describe ".generate_exit_code" do
+    it "returns 0 for nil" do
+      expect(subject.generate_exit_code(nil)).to eq 0
+    end
+
+    it "returns 0 for true" do
+      expect(subject.generate_exit_code(true)).to eq 0
+    end
+
+    it "returns 16 for false" do
+      expect(subject.generate_exit_code(false)).to eq 16
+    end
+
+    it "returns 16 for `:abort`" do
+      expect(subject.generate_exit_code(:abort)).to eq 16
+    end
+
+    it "returns 16 for `:cancel`" do
+      expect(subject.generate_exit_code(:cancel)).to eq 16
+    end
+
+    it "returns 0 for other symbols" do
+      expect(subject.generate_exit_code(:test)).to eq 0
+    end
+
+    it "returns 16+number for number" do
+      expect(subject.generate_exit_code(1)).to eq 17
+      expect(subject.generate_exit_code(3)).to eq 19
+    end
+  end
 end


Reply via email to