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 2023-04-08 17:38:23
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-ruby-bindings (Old)
 and      /work/SRC/openSUSE:Factory/.yast2-ruby-bindings.new.19717 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-ruby-bindings"

Sat Apr  8 17:38:23 2023 rev:124 rq:1077500 version:4.6.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-ruby-bindings/yast2-ruby-bindings.changes  
2023-03-11 18:22:53.554521821 +0100
+++ 
/work/SRC/openSUSE:Factory/.yast2-ruby-bindings.new.19717/yast2-ruby-bindings.changes
       2023-04-08 17:38:25.161823960 +0200
@@ -1,0 +2,6 @@
+Mon Apr  3 10:46:37 UTC 2023 - Josef Reidinger <[email protected]>
+
+- Improve YaST memory consumption related to import+publish (bsc#1210051)
+- 4.6.2
+
+-------------------------------------------------------------------

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

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

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

Other differences:
------------------
++++++ yast2-ruby-bindings.spec ++++++
--- /var/tmp/diff_new_pack.SiuzUb/_old  2023-04-08 17:38:25.853827933 +0200
+++ /var/tmp/diff_new_pack.SiuzUb/_new  2023-04-08 17:38:25.857827956 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-ruby-bindings
-Version:        4.6.1
+Version:        4.6.2
 Release:        0
 URL:            https://github.com/yast/yast-ruby-bindings
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build

++++++ yast2-ruby-bindings-4.6.1.tar.bz2 -> yast2-ruby-bindings-4.6.2.tar.bz2 
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-ruby-bindings-4.6.1/package/yast2-ruby-bindings.changes 
new/yast2-ruby-bindings-4.6.2/package/yast2-ruby-bindings.changes
--- old/yast2-ruby-bindings-4.6.1/package/yast2-ruby-bindings.changes   
2023-03-09 11:48:09.000000000 +0100
+++ new/yast2-ruby-bindings-4.6.2/package/yast2-ruby-bindings.changes   
2023-04-05 12:40:18.000000000 +0200
@@ -1,4 +1,10 @@
 -------------------------------------------------------------------
+Mon Apr  3 10:46:37 UTC 2023 - Josef Reidinger <[email protected]>
+
+- Improve YaST memory consumption related to import+publish (bsc#1210051)
+- 4.6.2
+
+-------------------------------------------------------------------
 Thu Mar  9 10:36:23 UTC 2023 - Martin Vidner <[email protected]>
 
 - Use ruby-devel versioned to match the gems (bsc#1209098)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-ruby-bindings-4.6.1/package/yast2-ruby-bindings.spec 
new/yast2-ruby-bindings-4.6.2/package/yast2-ruby-bindings.spec
--- old/yast2-ruby-bindings-4.6.1/package/yast2-ruby-bindings.spec      
2023-03-09 11:48:09.000000000 +0100
+++ new/yast2-ruby-bindings-4.6.2/package/yast2-ruby-bindings.spec      
2023-04-05 12:40:18.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-ruby-bindings
-Version:        4.6.1
+Version:        4.6.2
 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.6.1/profiling/yast_import.rb 
new/yast2-ruby-bindings-4.6.2/profiling/yast_import.rb
--- old/yast2-ruby-bindings-4.6.1/profiling/yast_import.rb      1970-01-01 
01:00:00.000000000 +0100
+++ new/yast2-ruby-bindings-4.6.2/profiling/yast_import.rb      2023-04-05 
12:40:18.000000000 +0200
@@ -0,0 +1,18 @@
+require "memory_profiler"
+
+usage = <<CMD
+cd build # cmake ..; make
+# use the built version
+ruby -r ../tests/test_helper.rb ../profiling/yast_import.rb  # | head -n2
+# use the system version
+ruby                            ../profiling/yast_import.rb  # | head -n2
+CMD
+
+MemoryProfiler.report {
+  require "yast"
+
+  Yast.import "Pkg"
+  Yast.import "Bootloader"
+  Yast.import "UI"
+  Yast.import "Lan"
+}.pretty_print
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-ruby-bindings-4.6.1/src/binary/YRubyNamespace.cc 
new/yast2-ruby-bindings-4.6.2/src/binary/YRubyNamespace.cc
--- old/yast2-ruby-bindings-4.6.1/src/binary/YRubyNamespace.cc  2023-03-09 
11:48:09.000000000 +0100
+++ new/yast2-ruby-bindings-4.6.2/src/binary/YRubyNamespace.cc  2023-04-05 
12:40:18.000000000 +0200
@@ -36,6 +36,17 @@
 #include "YRuby.h"
 #include "Y2RubyUtils.h"
 
+
+// HELPER method to inspect ruby values from C++. Useful for debugging
+/*
+// usage: log_inspect("surely not nil, foobar", foobar);
+static void log_inspect(const char * message, VALUE v)
+{
+  VALUE inspect = rb_funcall(v, rb_intern("inspect"), 0);
+  y2internal("%s: %s", message, StringValueCStr(inspect));
+}
+*/
+
 /**
  * Exception raised when type signature in ruby class is invalid
  */
@@ -274,15 +285,12 @@
 int YRubyNamespace::addMethods(VALUE module)
 {
   VALUE methods = rb_funcall(module, rb_intern("published_functions"),0);
-  methods = rb_funcall(methods,rb_intern("values"),0);
   int j = 0;
   for (int i = 0; i < RARRAY_LEN(methods); ++i)
   {
-    VALUE method = rb_ary_entry(methods,i);
-    if (getenv("Y2ALLGLOBAL") == NULL && RTEST(rb_funcall(method, 
rb_intern("private?"), 0)))
-      continue;
-    VALUE method_name = rb_funcall(method, rb_intern("function"), 0);
-    VALUE type = rb_funcall(method,rb_intern("type"),0);
+    VALUE method = rb_ary_entry(methods, i);
+    VALUE method_name = rb_ary_entry(method, 0);
+    VALUE type = rb_ary_entry(method, 1);
     string signature = StringValueCStr(type);
 
     addMethod(rb_id2name(SYM2ID(method_name)), signature, j++);
@@ -293,18 +301,12 @@
 int YRubyNamespace::addVariables(VALUE module, int offset)
 {
   VALUE variables = rb_funcall(module, rb_intern("published_variables"),0);
-  variables = rb_funcall(variables,rb_intern("values"),0);
   int j=0;
   for (int i = 0; i < RARRAY_LEN(variables); ++i)
   {
-    VALUE variable = rb_ary_entry(variables,i);
-    VALUE variable_name = rb_funcall(variable, rb_intern("variable"), 0);
-    if (getenv("Y2ALLGLOBAL") == NULL && RTEST(rb_funcall(variable, 
rb_intern("private?"), 0)))
-    {
-      y2debug("variable: '%s' is private and not needed", 
rb_id2name(SYM2ID(variable_name)));
-      continue;
-    }
-    VALUE type = rb_funcall(variable,rb_intern("type"),0);
+    VALUE variable = rb_ary_entry(variables, i);
+    VALUE variable_name = rb_ary_entry(variable, 0);
+    VALUE type = rb_ary_entry(variable, 1);
     string signature = StringValueCStr(type);
     constTypePtr sym_tp = Type::fromSignature(signature);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-ruby-bindings-4.6.1/src/ruby/yast/exportable.rb 
new/yast2-ruby-bindings-4.6.2/src/ruby/yast/exportable.rb
--- old/yast2-ruby-bindings-4.6.1/src/ruby/yast/exportable.rb   2023-03-09 
11:48:09.000000000 +0100
+++ new/yast2-ruby-bindings-4.6.2/src/ruby/yast/exportable.rb   2023-04-05 
12:40:18.000000000 +0200
@@ -4,24 +4,26 @@
   # Provides ability to export functions and variables to Yast component 
system.
   # The most important method is {Yast::Exportable#publish}
   module Exportable
-    # Holder for exported data
-    class ExportData < OpenStruct
-      # Is exported data only for private purpose.
-      # It is useful only to test private methods from old Yast testsuite.
-      def private?
-        table = marshal_dump
-        !!table[:private]
-      end
-    end
-
-    # list of published functions
+    # @api private
+    # @return [Array<Array(Symbol,String)>] list of published functions
+    # @example
+    #   [
+    #     [:doit, "void()"],
+    #     [:is_odd, "boolean(integer)"]
+    #   ]
     def published_functions
-      @__published_functions ||= {}
+      @__published_functions ||= []
     end
 
-    # list of published variables
+    # @api private
+    # @return [Array<Array(Symbol,String)>] list of published variables
+    # @example
+    #   [
+    #     [:answer, "integer"],
+    #     [:having_fun, "boolean"]
+    #   ]
     def published_variables
-      @__published_variables ||= {}
+      @__published_variables ||= []
     end
 
     # Publishes function or variable to component system
@@ -37,16 +39,13 @@
       raise "Missing signature" unless options[:type]
       # convert type to full specification
       type = options[:type].delete " \t"
-      type = type.gsub(/map([^<]|$)/, 'map<any,any>\\1')
-      type = type.gsub(/list([^<]|$)/, 'list<any>\\1')
-      options[:type] = type
+      type.gsub!(/map([^<]|$)/, 'map<any,any>\\1')
+      type.gsub!(/list([^<]|$)/, 'list<any>\\1')
       if options[:function]
-        published_functions[options[:function]] = ExportData.new options
+        published_functions.push([options[:function], type])
       elsif options[:variable]
-        published_variables[options[:variable]] = ExportData.new options
-        if !options[:private] || ENV["Y2ALLGLOBAL"]
-          attr_accessor :"#{options[:variable]}"
-        end
+        published_variables.push([options[:variable], type])
+        attr_accessor options[:variable]
       else
         raise "Missing publish kind"
       end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-ruby-bindings-4.6.1/src/ruby/yast/path.rb 
new/yast2-ruby-bindings-4.6.2/src/ruby/yast/path.rb
--- old/yast2-ruby-bindings-4.6.1/src/ruby/yast/path.rb 2023-03-09 
11:48:09.000000000 +0100
+++ new/yast2-ruby-bindings-4.6.2/src/ruby/yast/path.rb 2023-04-05 
12:40:18.000000000 +0200
@@ -1,3 +1,4 @@
+# frozen_string_literal: true
 module Yast
   # Represents paths like it is in ycp. It is path elements separated by dot.
   # Elements can be simple or complex. Simple can contain only ascii 
characters [a-zA-Z0-9].
@@ -71,7 +72,7 @@
     def load_components(value)
       state = :initial
       skip_next = false
-      buffer = ""
+      buffer = "".dup
       value.each_char do |c|
         case state
         when :initial
@@ -91,7 +92,7 @@
             raise "Invalid path '#{value}'" if invalid_buffer?(buffer)
 
             @components << modify_buffer(buffer)
-            buffer = ""
+            buffer = "".dup
             next
           end
           buffer << c
@@ -107,7 +108,7 @@
             state = :initial
             buffer << c
             @components << buffer
-            buffer = ""
+            buffer = "".dup
             next
           when '\\'
             skip_next = true
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-ruby-bindings-4.6.1/src/ruby/yast/yast.rb 
new/yast2-ruby-bindings-4.6.2/src/ruby/yast/yast.rb
--- old/yast2-ruby-bindings-4.6.1/src/ruby/yast/yast.rb 2023-03-09 
11:48:09.000000000 +0100
+++ new/yast2-ruby-bindings-4.6.2/src/ruby/yast/yast.rb 2023-04-05 
12:40:18.000000000 +0200
@@ -179,7 +179,7 @@
     # do not reimport if already imported and contain some methods
     # ( in case namespace contain some methods )
     if base.constants.include?(modules.last.to_sym) &&
-        !(base.const_get(modules.last).methods - Object.methods).empty?
+        !base.const_get(modules.last).public_methods(false).empty?
       return
     end
 
@@ -187,7 +187,7 @@
 
     # do not create wrapper if module is in ruby and define itself object
     if base.constants.include?(modules.last.to_sym) &&
-        !(base.const_get(modules.last).methods - Object.methods).empty?
+        !base.const_get(modules.last).public_methods(false).empty?
       return
     end
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-ruby-bindings-4.6.1/tests/exportable_spec.rb 
new/yast2-ruby-bindings-4.6.2/tests/exportable_spec.rb
--- old/yast2-ruby-bindings-4.6.1/tests/exportable_spec.rb      2023-03-09 
11:48:09.000000000 +0100
+++ new/yast2-ruby-bindings-4.6.2/tests/exportable_spec.rb      2023-04-05 
12:40:18.000000000 +0200
@@ -27,22 +27,20 @@
 
 describe "ExportableTest" do
   it "tests publish methods" do
-    expect(MyTest.class.published_functions.keys).to eq([:test])
-    expect(MyTest.class.published_functions.values.first.function).to eq(:test)
-    expect(MyTest.class.published_functions[:test].type).to 
eq("string(integer,term)")
+    expect(MyTest.class.published_functions).to eq([
+      [:test, "string(integer,term)"]
+    ])
   end
 
   it "tests publish variables" do
-    expect(MyTest.class.published_variables[:variable_a].type).to 
eq("map<any,any>")
+    expect(MyTest.class.published_variables).to eq([
+      [:complex, "map<string,map<list<any>,map<any,any>>>"],
+      [:variable_a, "map<any,any>"]
+    ])
   end
 
   it "tests variable definition" do
     MyTest.variable_a = ({ a: 15 })
     expect(MyTest.variable_a).to eq(a: 15)
   end
-
-  it "tests type full specification" do
-    expect(MyTest.class.published_variables[:complex].type)
-      .to eq("map<string,map<list<any>,map<any,any>>>")
-  end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-ruby-bindings-4.6.1/tests/test_module/modules/InvalidTypeModule.rb 
new/yast2-ruby-bindings-4.6.2/tests/test_module/modules/InvalidTypeModule.rb
--- 
old/yast2-ruby-bindings-4.6.1/tests/test_module/modules/InvalidTypeModule.rb    
    2023-03-09 11:48:09.000000000 +0100
+++ 
new/yast2-ruby-bindings-4.6.2/tests/test_module/modules/InvalidTypeModule.rb    
    2023-04-05 12:40:18.000000000 +0200
@@ -1,5 +1,7 @@
 module Yast
   class InvalidTypeModuleClass < Module
+    include Yast::Logger
+
     def a
       puts "Fail"
     end

Reply via email to