Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package yast2-ruby-bindings for
openSUSE:Factory checked in at 2022-10-27 13:53:59
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-ruby-bindings (Old)
and /work/SRC/openSUSE:Factory/.yast2-ruby-bindings.new.2275 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-ruby-bindings"
Thu Oct 27 13:53:59 2022 rev:121 rq:1031174 version:4.5.4
Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-ruby-bindings/yast2-ruby-bindings.changes
2022-10-10 18:43:24.714720057 +0200
+++
/work/SRC/openSUSE:Factory/.yast2-ruby-bindings.new.2275/yast2-ruby-bindings.changes
2022-10-27 13:54:33.048683339 +0200
@@ -1,0 +2,9 @@
+Mon Oct 24 12:51:30 UTC 2022 - Ladislav Slez??k <[email protected]>
+
+- Added "log.group" method for grouping the log messages
+ (bsc#1204625)
+- Update Rakefile to allow installing the Ruby files in inst-sys
+ using the "yupdate" command
+- 4.5.4
+
+-------------------------------------------------------------------
Old:
----
yast2-ruby-bindings-4.5.3.tar.bz2
New:
----
yast2-ruby-bindings-4.5.4.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-ruby-bindings.spec ++++++
--- /var/tmp/diff_new_pack.8ZdCEt/_old 2022-10-27 13:54:33.628686298 +0200
+++ /var/tmp/diff_new_pack.8ZdCEt/_new 2022-10-27 13:54:33.632686318 +0200
@@ -17,7 +17,7 @@
Name: yast2-ruby-bindings
-Version: 4.5.3
+Version: 4.5.4
Release: 0
URL: https://github.com/yast/yast-ruby-bindings
BuildRoot: %{_tmppath}/%{name}-%{version}-build
++++++ yast2-ruby-bindings-4.5.3.tar.bz2 -> yast2-ruby-bindings-4.5.4.tar.bz2
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-ruby-bindings-4.5.3/Rakefile
new/yast2-ruby-bindings-4.5.4/Rakefile
--- old/yast2-ruby-bindings-4.5.3/Rakefile 2022-10-06 17:04:38.000000000
+0200
+++ new/yast2-ruby-bindings-4.5.4/Rakefile 2022-10-25 17:18:54.000000000
+0200
@@ -1,6 +1,16 @@
require "yast/rake"
+require "rbconfig"
Yast::Tasks.configuration do |conf|
# lets ignore license check for now
conf.skip_license_check << /.*/
+
+ # support installation via "yupdate" script in the inst-sys,
+ # we can only install the Ruby scripts because the C compiler and the
development
+ # files are missing in the inst-sys, but this might be enough in some
cases...
+ # this replicates the tasks from src/CMakeLists.txt
+ conf.install_locations["src/y2start/y2start"] =
File.join(Packaging::Configuration::YAST_LIB_DIR, "bin")
+ vendor_dir = File.join(Packaging::Configuration::DESTDIR,
RbConfig::CONFIG["vendorlibdir"])
+ conf.install_locations["src/ruby/yast.rb"] = vendor_dir
+ conf.install_locations["src/ruby/yast"] = vendor_dir
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-ruby-bindings-4.5.3/package/yast2-ruby-bindings.changes
new/yast2-ruby-bindings-4.5.4/package/yast2-ruby-bindings.changes
--- old/yast2-ruby-bindings-4.5.3/package/yast2-ruby-bindings.changes
2022-10-06 17:04:38.000000000 +0200
+++ new/yast2-ruby-bindings-4.5.4/package/yast2-ruby-bindings.changes
2022-10-25 17:18:54.000000000 +0200
@@ -1,4 +1,13 @@
-------------------------------------------------------------------
+Mon Oct 24 12:51:30 UTC 2022 - Ladislav Slez??k <[email protected]>
+
+- Added "log.group" method for grouping the log messages
+ (bsc#1204625)
+- Update Rakefile to allow installing the Ruby files in inst-sys
+ using the "yupdate" command
+- 4.5.4
+
+-------------------------------------------------------------------
Thu Oct 6 14:26:41 UTC 2022 - Stefan Hundhammer <[email protected]>
- Dropped support for profiler / Y2PROFILER env var (bsc#1189647)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-ruby-bindings-4.5.3/package/yast2-ruby-bindings.spec
new/yast2-ruby-bindings-4.5.4/package/yast2-ruby-bindings.spec
--- old/yast2-ruby-bindings-4.5.3/package/yast2-ruby-bindings.spec
2022-10-06 17:04:38.000000000 +0200
+++ new/yast2-ruby-bindings-4.5.4/package/yast2-ruby-bindings.spec
2022-10-25 17:18:54.000000000 +0200
@@ -17,7 +17,7 @@
Name: yast2-ruby-bindings
-Version: 4.5.3
+Version: 4.5.4
Release: 0
URL: https://github.com/yast/yast-ruby-bindings
BuildRoot: %{_tmppath}/%{name}-%{version}-build
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-ruby-bindings-4.5.3/src/ruby/yast/y2logger.rb
new/yast2-ruby-bindings-4.5.4/src/ruby/yast/y2logger.rb
--- old/yast2-ruby-bindings-4.5.3/src/ruby/yast/y2logger.rb 2022-10-06
17:04:38.000000000 +0200
+++ new/yast2-ruby-bindings-4.5.4/src/ruby/yast/y2logger.rb 2022-10-25
17:18:54.000000000 +0200
@@ -6,6 +6,44 @@
require "yast/logger"
module Yast
+
+ # Stores the log group result data, used in {Y2Logger.group}.
+ class LogGroupResult
+ # @return [String,nil] result of the step as a textual description
+ attr_accessor :summary
+
+ # @return [Object] result of the block
+ attr_accessor :result
+
+ # @param value [Boolean] set to false if the result of the group is a
failure,
+ # overrides the state evaluated from the the {#result} attribute
+ attr_writer :success
+
+ # @return [Array] list of error values (*result* values that will make
*success* false)
+ attr_accessor :error_values
+
+ # was the execution of the block successful?
+ # @return [Boolean] true if the block succeeded, false otherwise
+ def success?
+ if success.nil?
+ !error_values.include?(result)
+ else
+ success
+ end
+ end
+
+ def initialize
+ # these return values are considered failures by default,
+ # can be overridden by modifying the `error_values` list
+ @error_values = [:abort, :cancel, false]
+ end
+
+ private
+
+ # @return [Boolean,nil] explicit failure
+ attr_reader :success
+ end
+
# A Ruby Logger which wraps Yast.y2*() calls
class Y2Logger < ::Logger
include Singleton
@@ -40,6 +78,41 @@
# process also debug messages but might not be logged in the end
self.level = ::Logger::DEBUG
end
+
+ # log a block of commands, adds a special begin and end markers into the
log,
+ # the block should be one big logical step in the process,
+ # can be used recursively, e.g. log.group might call another log.group
inside
+ # @param description [String] short description of the block
+ # @param block [Proc] block to call
+ # @yieldparam group [LogGroupResult] can be optionally used to pass result
details
+ # @yieldreturn [Object] passed on;
+ # if one of `false`, `:abort`, `:cancel` ({LogGroupResult#error_values}),
+ # the group is logged as failed (log.error)
+ # @return [Object] whatever the *block* returned
+ def group(description, &block)
+ details = LogGroupResult.new
+ # mark start of the group
+ info
"::group::#{Process.clock_gettime(Process::CLOCK_MONOTONIC)}::#{description}"
+
+ if block_given?
+ ret = block.call(details)
+ else
+ raise ArgumentError, "Missing a block"
+ end
+ details.result = ret
+
+ ret
+ rescue StandardError => e
+ # mark a failure
+ details.success = false
+ details.summary = "Raised exception: #{e}"
+ # reraise the original exception
+ raise
+ ensure
+ # mark end of the group with result data, if it failed log as an error
+ level = details.success? ? :info : :error
+ public_send(level,
"::endgroup::#{Process.clock_gettime(Process::CLOCK_MONOTONIC)}::#{details.summary}")
+ end
end
# This module provides access to Yast specific logging
@@ -60,6 +133,23 @@
#
# # Builtins.y2error() replacement
# log.error "error"
+ #
+ # # log a logical group of commands, useful for big tasks which
+ # # log too many details
+ # log.group("Adding repositories") do
+ # add_repositories
+ # end
+ #
+ # # log a logical group of commands with result details
+ # log.group("Adding repositories") do |group|
+ # ret, repos = add_repositories
+ # if ret == :failed
+ # group.summary = "Could not add repositories"
+ # group.success = false
+ # else
+ # group.summary = "Added #{repos.size} repositories"
+ # end
+ # end
# end
# end
# end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-ruby-bindings-4.5.3/tests/y2logger_spec.rb
new/yast2-ruby-bindings-4.5.4/tests/y2logger_spec.rb
--- old/yast2-ruby-bindings-4.5.3/tests/y2logger_spec.rb 2022-10-06
17:04:38.000000000 +0200
+++ new/yast2-ruby-bindings-4.5.4/tests/y2logger_spec.rb 2022-10-25
17:18:54.000000000 +0200
@@ -5,6 +5,10 @@
require "yast/y2logger"
module Yast
+
+ # testing exception class
+ class TestException < StandardError; end
+
describe Y2Logger do
TEST_MESSAGE = "Testing".freeze
@@ -42,6 +46,76 @@
@test_logger.info { TEST_MESSAGE }
end
+ context "group logging" do
+ it "raises ArgumentError exception when no block is not passed" do
+ expect{ @test_logger.group(TEST_MESSAGE) }.to
raise_error(ArgumentError)
+ end
+
+ it "evaluates the passed block" do
+ expect{ |b| @test_logger.group(TEST_MESSAGE, &b) }.to yield_control
+ end
+
+ it "returns the block result" do
+ value = "test"
+ ret = @test_logger.group(TEST_MESSAGE) { value }
+
+ # test the object identity, same object must be returned
+ expect(ret).to equal(value)
+ end
+
+ it "logs special group begin and group end markers" do
+ expect(Yast).to receive(:y2milestone).with(Y2Logger::CALL_FRAME,
/::group::/)
+ expect(Yast).to receive(:y2milestone).with(Y2Logger::CALL_FRAME,
/::endgroup::/)
+ @test_logger.group("") { }
+ end
+
+ it "logs the group description" do
+ allow(Yast).to receive(:y2milestone)
+ expect(Yast).to receive(:y2milestone) do |frame, message|
+ expect(message).to end_with(TEST_MESSAGE)
+ end
+
+ @test_logger.group(TEST_MESSAGE) { }
+ end
+
+ it "logs the optional summary text" do
+ summary = "optional summary text"
+ # remember whether the summary was logged or not
+ summary_included = false
+
+ allow(Yast).to receive(:y2milestone)
+ expect(Yast).to receive(:y2milestone) do |frame, message|
+ summary_included = true if summary.end_with?(summary)
+ end
+
+ @test_logger.group(TEST_MESSAGE) { |g| g.summary = summary }
+ expect(summary_included).to be true
+ end
+
+ it "logs error result when the block returns :abort" do
+ expect(Yast).to receive(:y2error).with(Y2Logger::CALL_FRAME,
/::endgroup::/)
+ @test_logger.group(TEST_MESSAGE) { :abort }
+ end
+
+ it "allows using a custom error value" do
+ expect(Yast).to receive(:y2error).with(Y2Logger::CALL_FRAME,
/::endgroup::/)
+ @test_logger.group(TEST_MESSAGE) do |g|
+ g.error_values << :error
+ :error
+ end
+ end
+
+ it "logs error result when the success status is explicitly set to
false" do
+ expect(Yast).to receive(:y2error).with(Y2Logger::CALL_FRAME,
/::endgroup::/)
+ @test_logger.group(TEST_MESSAGE) { |g| g.success = false }
+ end
+
+ it "logs error result when reraises the exception from the block" do
+ expect(Yast).to receive(:y2error).with(Y2Logger::CALL_FRAME,
/::endgroup::/)
+ expect{ @test_logger.group(TEST_MESSAGE) { raise TestException } }.to
raise_error(TestException)
+ end
+ end
+
it "does not crash when logging an invalid UTF-8 string" do
# do not process this string otherwise you'll get an exception :-)
invalid_utf8 = "invalid sequence: " + 0xE3.chr + 0x80.chr