Hello community, here is the log from the commit of package yast2-ruby-bindings for openSUSE:Factory checked in at 2015-05-19 23:21:11 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-ruby-bindings (Old) and /work/SRC/openSUSE:Factory/.yast2-ruby-bindings.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-ruby-bindings" Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-ruby-bindings/yast2-ruby-bindings.changes 2015-04-06 00:24:22.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.yast2-ruby-bindings.new/yast2-ruby-bindings.changes 2015-05-19 23:21:12.000000000 +0200 @@ -1,0 +2,7 @@ +Mon May 18 08:34:37 UTC 2015 - mvid...@suse.com + +- Initialize the YaST UI so that it can be called + when the main program is not y2base (bsc#922023). +- 3.1.32 + +------------------------------------------------------------------- Old: ---- yast2-ruby-bindings-3.1.31.tar.bz2 New: ---- yast2-ruby-bindings-3.1.32.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-ruby-bindings.spec ++++++ --- /var/tmp/diff_new_pack.joCnfB/_old 2015-05-19 23:21:13.000000000 +0200 +++ /var/tmp/diff_new_pack.joCnfB/_new 2015-05-19 23:21:13.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package yast2-ruby-bindings # -# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: yast2-ruby-bindings -Version: 3.1.31 +Version: 3.1.32 Release: 0 Url: https://github.com/yast/yast-ruby-bindings BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ yast2-ruby-bindings-3.1.31.tar.bz2 -> yast2-ruby-bindings-3.1.32.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-ruby-bindings-3.1.31/CONTRIBUTING.md new/yast2-ruby-bindings-3.1.32/CONTRIBUTING.md --- old/yast2-ruby-bindings-3.1.31/CONTRIBUTING.md 2015-04-02 12:55:15.000000000 +0200 +++ new/yast2-ruby-bindings-3.1.32/CONTRIBUTING.md 2015-05-18 15:25:10.000000000 +0200 @@ -12,13 +12,13 @@ ----------- If you find a problem, please report it either using -[Bugzilla](https://bugzilla.novell.com/enter_bug.cgi?format=guided&product=openSUSE+Factory&component=YaST2) +[Bugzilla](https://bugzilla.suse.com/enter_bug.cgi?format=guided&product=openSUSE+Factory&component=YaST2) or [GitHub issues](../../issues). (For Bugzilla, use the [simplified registration](https://secure-www.novell.com/selfreg/jsp/createSimpleAccount.jsp) if you don't have an account yet.) If you find a problem, please report it either using -[Bugzilla](https://bugzilla.novell.com/) or GitHub issues. We can't guarantee +[Bugzilla](https://bugzilla.suse.com/) or GitHub issues. We can't guarantee that every bug will be fixed, but we'll try. When creating a bug report, please follow our [bug reporting @@ -71,7 +71,7 @@ [widely used conventions](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html). -If your commit is related to a bug in Buzgilla or an issue on GitHub, make sure +If your commit is related to a bug in Bugzilla or an issue on GitHub, make sure you mention it in the commit message for cross-reference. Use format like bnc#775814 or gh#yast/yast-foo#42. See also [GitHub autolinking](https://help.github.com/articles/github-flavored-markdown#references) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-ruby-bindings-3.1.31/package/yast2-ruby-bindings.changes new/yast2-ruby-bindings-3.1.32/package/yast2-ruby-bindings.changes --- old/yast2-ruby-bindings-3.1.31/package/yast2-ruby-bindings.changes 2015-04-02 12:55:15.000000000 +0200 +++ new/yast2-ruby-bindings-3.1.32/package/yast2-ruby-bindings.changes 2015-05-18 15:25:10.000000000 +0200 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Mon May 18 08:34:37 UTC 2015 - mvid...@suse.com + +- Initialize the YaST UI so that it can be called + when the main program is not y2base (bsc#922023). +- 3.1.32 + +------------------------------------------------------------------- Wed Apr 1 15:38:04 UTC 2015 - an...@suse.com - Added new RSpec argument matcher: path_matching diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-ruby-bindings-3.1.31/package/yast2-ruby-bindings.spec new/yast2-ruby-bindings-3.1.32/package/yast2-ruby-bindings.spec --- old/yast2-ruby-bindings-3.1.31/package/yast2-ruby-bindings.spec 2015-04-02 12:55:15.000000000 +0200 +++ new/yast2-ruby-bindings-3.1.32/package/yast2-ruby-bindings.spec 2015-05-18 15:25:10.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-ruby-bindings -Version: 3.1.31 +Version: 3.1.32 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-3.1.31/src/CMakeLists.txt new/yast2-ruby-bindings-3.1.32/src/CMakeLists.txt --- old/yast2-ruby-bindings-3.1.31/src/CMakeLists.txt 2015-04-02 12:55:15.000000000 +0200 +++ new/yast2-ruby-bindings-3.1.32/src/CMakeLists.txt 2015-05-18 15:25:10.000000000 +0200 @@ -1,17 +1,2 @@ add_subdirectory(ruby) add_subdirectory(binary) - -# rdoc -set(rdoc_dir "${CMAKE_CURRENT_BINARY_DIR}/html") -ADD_CUSTOM_COMMAND ( - OUTPUT ${rdoc_dir} - COMMAND ${CMAKE_COMMAND} -E echo_append "Creating rdoc documentation ..." - COMMAND rm -rf ${rdoc_dir} - COMMAND rdoc -o ${rdoc_dir} ruby binary/Yast.cc - COMMAND ${CMAKE_COMMAND} -E echo "Done." - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src/ - DEPENDS ${CMAKE_SOURCE_DIR}/src/binary/Yast.cc ${CMAKE_SOURCE_DIR}/src/ruby/*.rb -) -add_custom_target(rdoc ALL DEPENDS "${rdoc_dir}") -add_dependencies(rdoc yastx) -add_dependencies(rdoc scrx) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-ruby-bindings-3.1.31/src/binary/CMakeLists.txt new/yast2-ruby-bindings-3.1.32/src/binary/CMakeLists.txt --- old/yast2-ruby-bindings-3.1.31/src/binary/CMakeLists.txt 2015-04-02 12:55:15.000000000 +0200 +++ new/yast2-ruby-bindings-3.1.32/src/binary/CMakeLists.txt 2015-05-18 15:25:10.000000000 +0200 @@ -76,8 +76,17 @@ # SET ( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-rpath,'${YAST_PLUGIN_DIR}'" ) +# Correct initialization depends on libraries being linked and providing +# global variables with certain names. (Y2PluginComponent: "g_y2cc*") +# Tell the linker not to optimize them away. +set_target_properties( yastx PROPERTIES LINK_FLAGS "-Wl,--no-as-needed") +set_target_properties( builtinx PROPERTIES LINK_FLAGS "-Wl,--no-as-needed") + target_link_libraries( yastx ${YAST_LIBRARY} ) target_link_libraries( yastx ${YAST_YCP_LIBRARY} ) +target_link_libraries( yastx ${YAST_PLUGIN_SCR_LIBRARY} ) +target_link_libraries( yastx ${YAST_PLUGIN_WFM_LIBRARY} ) +target_link_libraries( yastx ${YAST_PLUGIN_UI_LIBRARY} ) # # The WFM and SCR component can only be initialized statically # (e.g. through Y2CCWFM), thus we must link against the plugin libs @@ -89,6 +98,7 @@ target_link_libraries( builtinx ${YAST_YCP_LIBRARY} ) target_link_libraries( builtinx ${YAST_PLUGIN_SCR_LIBRARY} ) target_link_libraries( builtinx ${YAST_PLUGIN_WFM_LIBRARY} ) +target_link_libraries( builtinx ${YAST_PLUGIN_UI_LIBRARY} ) target_link_libraries( builtinx crypt ) find_library( OWCRYPT_LIBRARY owcrypt ) if ( OWCRYPT_LIBRARY ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-ruby-bindings-3.1.31/src/binary/Yast.cc new/yast2-ruby-bindings-3.1.32/src/binary/Yast.cc --- old/yast2-ruby-bindings-3.1.31/src/binary/Yast.cc 2015-04-02 12:55:15.000000000 +0200 +++ new/yast2-ruby-bindings-3.1.32/src/binary/Yast.cc 2015-05-18 15:25:10.000000000 +0200 @@ -32,6 +32,7 @@ #include <ycp/y2log.h> #include <ycp/YExpression.h> #include <ycp/YCPValue.h> +#include <ycp/YCPVoid.h> #include <ycp/YCPCode.h> #include <ycp/YCPByteblock.h> #include <ycp/Import.h> @@ -99,7 +100,7 @@ * Tries to import a YCP namespace * * call-seq: - * YCP::import("name") + * Yast.import("name") * */ @@ -384,6 +385,97 @@ rb_raise(rb_eRuntimeError, "YCode is empty"); } +/* + * Document-method: ui_component + * + * YaST component serving the UI: "gtk", "ncurses", "qt", + * or the dummy one "UI" + */ +static VALUE ui_get_component() +{ + string s; + YUIComponent *c = YUIComponent::uiComponent(); + if (c) + { + s = c->requestedUIName(); + } + return yrb_utf8_str_new(s); +} + +/* + * Document-method: ui_component= + * + * When Ruby is embedded in YaST (y2base is the main program), the UI + * is determined by the time Ruby code gets run. If ruby is the main program, + * we need to load the UI frontend if we need one. + * + * Assign "ncurses" or "qt" before UI calls. + * + * #! /usr/bin/env ruby + * require "yast" + * include Yast + * include Yast::UIShortcuts + * + * if Yast.ui_component == "" + * Yast.ui_component = ARGV[0] || "ncurses" + * end + * + * Builtins.y2milestone("UI component: %1", Yast.ui_component) + * Yast.import "UI" + * + * UI.OpenDialog(PushButton("This is a button")) + * UI.UserInput + * UI.CloseDialog + */ +static VALUE ui_set_component(VALUE self, VALUE name) +{ + YUIComponent *c = YUIComponent::uiComponent(); + if (c) + { + YUIComponent::setUseDummyUI(false); + + string s = StringValuePtr(name); + c->setRequestedUIName(s); + } + + return Qnil; +} + +static void init_ui() +{ + const char *ui_name = "UI"; + + Y2Component *c = YUIComponent::uiComponent(); + if (c == 0) + { + y2debug ("UI component not created yet, creating %s", ui_name); + + c = Y2ComponentBroker::createServer(ui_name); // just dummy ui if none is defined + if (c == 0) + { + y2error("can't create UI component"); + return; + } + + c->setServerOptions(0, NULL); + } + else + { + y2debug("UI component already present: %s", c->name ().c_str ()); + } +} + +static VALUE ui_finalizer() +{ + YUIComponent *c = YUIComponent::uiComponent(); + if (c) + { + // Shut down the component. + c->result(YCPVoid()); + } + return Qnil; +} + } //extern C extern "C" @@ -398,6 +490,7 @@ Init_yastx() { YCPPathSearch::initialize(); + init_ui(); /* * module YCP @@ -416,6 +509,11 @@ rb_define_method( rb_mYast, "y2_logger", RUBY_METHOD_FUNC(yast_y2_logger), -1); rb_define_singleton_method( rb_mYast, "y2_logger", RUBY_METHOD_FUNC(yast_y2_logger), -1); + // UI initialization + rb_define_singleton_method( rb_mYast, "ui_component", RUBY_METHOD_FUNC(ui_get_component), 0); + rb_define_singleton_method( rb_mYast, "ui_component=", RUBY_METHOD_FUNC(ui_set_component), 1); + rb_define_singleton_method( rb_mYast, "ui_finalizer", RUBY_METHOD_FUNC(ui_finalizer), 0); + // Y2 references rb_cYReference = rb_define_class_under(rb_mYast, "YReference", rb_cObject); rb_define_method(rb_cYReference, "call", RUBY_METHOD_FUNC(ref_call), -1); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-ruby-bindings-3.1.31/src/ruby/yast/ui.rb new/yast2-ruby-bindings-3.1.32/src/ruby/yast/ui.rb --- old/yast2-ruby-bindings-3.1.31/src/ruby/yast/ui.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-ruby-bindings-3.1.32/src/ruby/yast/ui.rb 2015-05-18 15:25:10.000000000 +0200 @@ -0,0 +1,5 @@ +module Yast + # This is a counterpart to init_ui in the C code. + # It really belongs near it but I don't know how to code a proc in C. + ObjectSpace.define_finalizer(Yast, proc { Yast.ui_finalizer } ) +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-ruby-bindings-3.1.31/src/ruby/yast.rb new/yast2-ruby-bindings-3.1.32/src/ruby/yast.rb --- old/yast2-ruby-bindings-3.1.31/src/ruby/yast.rb 2015-04-02 12:55:15.000000000 +0200 +++ new/yast2-ruby-bindings-3.1.32/src/ruby/yast.rb 2015-05-18 15:25:10.000000000 +0200 @@ -41,6 +41,7 @@ require "yast/path" require "yast/scr" require "yast/term" +require "yast/ui" require "yast/ui_shortcuts" require "yast/wfm"