Hello community,
here is the log from the commit of package yast2-ruby-bindings for
openSUSE:Factory
checked in at Tue Oct 4 17:05:37 CEST 2011.
--------
--- openSUSE:Factory/yast2-ruby-bindings/yast2-ruby-bindings.changes
2011-09-23 12:53:21.000000000 +0200
+++
/mounts/work_src_done/STABLE/yast2-ruby-bindings/yast2-ruby-bindings.changes
2011-10-03 17:24:19.000000000 +0200
@@ -1,0 +2,9 @@
+Mon Oct 3 17:18:29 CEST 2011 - [email protected]
+
+- WIP: Ruby objects usable from YCP (FATE#312825).
+ except those that get garbage collected :-/)
+- Run the tests at RPM build time.
+- Less log clutter when importing a Ruby namespace.
+- 0.3.8
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
Old:
----
yast2-ruby-bindings-0.3.7.tar.bz2
New:
----
yast2-ruby-bindings-0.3.8.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-ruby-bindings.spec ++++++
--- /var/tmp/diff_new_pack.UkaoL7/_old 2011-10-04 17:05:31.000000000 +0200
+++ /var/tmp/diff_new_pack.UkaoL7/_new 2011-10-04 17:05:31.000000000 +0200
@@ -19,8 +19,8 @@
Name: yast2-ruby-bindings
-Version: 0.3.7
-Release: 1
+Version: 0.3.8
+Release: 0
License: GPL
Group: System/YaST
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@@ -55,13 +55,18 @@
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_SKIP_RPATH=1 \
..
-make %{?jobs:-j %jobs}
+make %{?jobs:-j %jobs} VERBOSE=1
%install
cd build
make install DESTDIR=$RPM_BUILD_ROOT
cd ..
+%check
+cd build
+make test ARGS=-V
+cd ..
+
%clean
rm -rf "$RPM_BUILD_ROOT"
@@ -70,4 +75,5 @@
%{_libdir}/YaST2/plugin/libpy2lang_ruby.so
%{_libdir}/ruby/vendor_ruby/%{rb_ver}/ycp.rb
%{_libdir}/ruby/vendor_ruby/%{rb_ver}/%{rb_arch}/ycpx.so
+
%changelog
++++++ yast2-ruby-bindings-0.3.7.tar.bz2 -> yast2-ruby-bindings-0.3.8.tar.bz2
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-ruby-bindings-0.3.7/.mme-makepac
new/yast2-ruby-bindings-0.3.8/.mme-makepac
--- old/yast2-ruby-bindings-0.3.7/.mme-makepac 1970-01-01 01:00:00.000000000
+0100
+++ new/yast2-ruby-bindings-0.3.8/.mme-makepac 2011-10-03 17:37:50.000000000
+0200
@@ -0,0 +1,40 @@
+#! /bin/sh -x
+# mme getpac yast2-network sp1
+
+# fd3 will be our output, stdout goes stderr
+exec 3>&1 >&2
+
+set -o errexit
+
+if [ "$1" = --clone ]; then
+ DEST=$2
+ cp $0 $DEST
+ chmod +x $DEST
+ exit
+fi
+
+PKG=$1
+SHORT_PRJ=$2
+shift 2
+
+if test -f Makefile.cvs; then
+ # assuming yast2, svn
+ make -f Makefile.cvs
+ make package-local CHECK_SYNTAX=false
+elif test -f CMakeLists.txt; then
+ mkdir build
+ cd build
+ # from spec
+ cmake -DCMAKE_INSTALL_PREFIX=/usr \
+ -DLIB=lib \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DCMAKE_SKIP_RPATH=1 \
+ ..
+ make srcpackage
+else
+ echo >&2 "Did not recognize the build system"
+ exit 1
+fi
+
+cd package
+pwd >&3
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-ruby-bindings-0.3.7/CMakeLists.txt
new/yast2-ruby-bindings-0.3.8/CMakeLists.txt
--- old/yast2-ruby-bindings-0.3.7/CMakeLists.txt 2011-07-26
16:26:31.000000000 +0200
+++ new/yast2-ruby-bindings-0.3.8/CMakeLists.txt 2011-10-03
17:37:50.000000000 +0200
@@ -4,73 +4,71 @@
cmake_minimum_required(VERSION 2.4)
if(COMMAND cmake_policy)
- # escape preprocessor, see -DVERSION below
- cmake_policy(SET CMP0005 OLD)
-endif(COMMAND cmake_policy)
-
-PROJECT(yast2-ruby-bindings)
-SET(PACKAGE "yast2-ruby-bindings")
-SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O3 -Wall -Woverloaded-virtual" )
-SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O3 -Wall" )
+ # let cmake escape preprocessor definitions
+ cmake_policy(SET CMP0005 NEW)
+endif()
+
+project(yast2-ruby-bindings)
+set(PACKAGE "yast2-ruby-bindings")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O3 -Wall -Woverloaded-virtual")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O3 -Wall")
#
# Where is SWIG ?
#
-FIND_PACKAGE(SWIG)
-IF ( NOT SWIG_FOUND )
-
-FIND_PROGRAM(SWIG_EXECUTABLE
- NAMES swig-1.3 swig
- PATHS ${SWIG_DIR} ${SWIG_DIR}/.. ${SWIG_DIR}/../../bin /usr/bin
/usr/local/bin ${CMAKE_INSTALL_PREFIX}/bin
-)
-ENDIF ( NOT SWIG_FOUND )
-
-IF ( NOT SWIG_EXECUTABLE )
- MESSAGE( FATAL_ERROR "SWIG not found." )
-ELSE ( NOT SWIG_EXECUTABLE )
- MESSAGE( STATUS "SWIG found at ${SWIG_EXECUTABLE}" )
-ENDIF ( NOT SWIG_EXECUTABLE )
+find_package(SWIG)
+if(NOT SWIG_FOUND)
+ find_program(SWIG_EXECUTABLE
+ NAMES swig-1.3 swig
+ PATHS ${SWIG_DIR} ${SWIG_DIR}/.. ${SWIG_DIR}/../../bin /usr/bin
/usr/local/bin ${CMAKE_INSTALL_PREFIX}/bin)
+endif()
+
+if(NOT SWIG_EXECUTABLE)
+ message(FATAL_ERROR "SWIG not found.")
+else()
+ message(STATUS "SWIG found at ${SWIG_EXECUTABLE}")
+endif()
#
# Where is YaST ?
#
-FIND_PACKAGE(Yast REQUIRED)
-IF ( NOT YAST_LIBRARY )
- MESSAGE( FATAL_ERROR "Please install yast2-core-devel." )
-ENDIF ( NOT YAST_LIBRARY )
-
-IF ( NOT YAST_PLUGIN_UI_LIBRARY )
- MESSAGE( FATAL_ERROR "YAST_PLUGIN_UI_LIBRARY not set, please install
yast2-ycp-ui-bindings-devel." )
-ENDIF ( NOT YAST_PLUGIN_UI_LIBRARY )
+find_package(Yast REQUIRED)
+if(NOT YAST_LIBRARY)
+ message(FATAL_ERROR "Please install yast2-core-devel.")
+endif()
+
+if(NOT YAST_PLUGIN_UI_LIBRARY)
+ message(FATAL_ERROR "YAST_PLUGIN_UI_LIBRARY not set, please install
yast2-ycp-ui-bindings-devel.")
+endif()
#
# Where is Ruby ?
#
-FIND_PACKAGE(Ruby REQUIRED)
-IF ( NOT RUBY_EXECUTABLE )
- MESSAGE( FATAL_ERROR "Ruby not found." )
-ENDIF ( NOT RUBY_EXECUTABLE )
+find_package(Ruby REQUIRED)
+if(NOT RUBY_EXECUTABLE)
+ message(FATAL_ERROR "Ruby not found.")
+endif()
#
# -> src/
#
-ADD_SUBDIRECTORY(src)
+add_subdirectory(src)
#
# -> tests/
#
-INCLUDE(CTest)
-ENABLE_TESTING()
+include(CTest)
+enable_testing()
-ADD_SUBDIRECTORY(tests)
+add_subdirectory(tests)
#
# packaging
#
-SET( RPMNAME "yast2-ruby-bindings" )
+set(RPMNAME "yast2-ruby-bindings")
-GENERATE_PACKAGING(${RPMNAME} ${VERSION})
+generate_packaging(${RPMNAME} ${VERSION})
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-ruby-bindings-0.3.7/VERSION.cmake
new/yast2-ruby-bindings-0.3.8/VERSION.cmake
--- old/yast2-ruby-bindings-0.3.7/VERSION.cmake 2011-07-26 16:26:31.000000000
+0200
+++ new/yast2-ruby-bindings-0.3.8/VERSION.cmake 2011-10-03 17:37:50.000000000
+0200
@@ -1,3 +1,3 @@
SET(VERSION_MAJOR "0")
SET(VERSION_MINOR "3")
-SET(VERSION_PATCH "7")
+SET(VERSION_PATCH "8")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-ruby-bindings-0.3.7/examples/ruby/test.yml
new/yast2-ruby-bindings-0.3.8/examples/ruby/test.yml
--- old/yast2-ruby-bindings-0.3.7/examples/ruby/test.yml 2011-07-26
16:26:31.000000000 +0200
+++ new/yast2-ruby-bindings-0.3.8/examples/ruby/test.yml 1970-01-01
01:00:00.000000000 +0100
@@ -1,20 +0,0 @@
-# The list of services that could be operated by webYaST services module.
-# Add only name of service if there is /etc/init.d/<service-name> script
available.
-# Otherwise, provide also service description and paths to start, stop and
status scripts.
-
-#cron:
-# name: cron
-
-#beagle:
-# name: beagle
-# description: Desktop Search Application
-# start: "/usr/bin/beagled"
-# stop: "/usr/bin/beagle-shutdown"
-# status: "/usr/bin/beagle-ping"
-
-collectd:
- name: collectd
- description: Statistics Collection Daemon for filling RRD Files
- start: "/usr/sbin/rccollectd start"
- stop: "/usr/sbin/rccollectd stop"
- status: "/usr/sbin/rccollectd status"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-ruby-bindings-0.3.7/package/yast2-ruby-bindings.changes
new/yast2-ruby-bindings-0.3.8/package/yast2-ruby-bindings.changes
--- old/yast2-ruby-bindings-0.3.7/package/yast2-ruby-bindings.changes
2011-07-26 16:26:31.000000000 +0200
+++ new/yast2-ruby-bindings-0.3.8/package/yast2-ruby-bindings.changes
2011-10-03 17:37:50.000000000 +0200
@@ -1,4 +1,13 @@
-------------------------------------------------------------------
+Mon Oct 3 17:18:29 CEST 2011 - [email protected]
+
+- WIP: Ruby objects usable from YCP (FATE#312825).
+ except those that get garbage collected :-/)
+- Run the tests at RPM build time.
+- Less log clutter when importing a Ruby namespace.
+- 0.3.8
+
+-------------------------------------------------------------------
Tue Jul 26 07:58:02 UTC 2011 - [email protected]
- Re-init the Ruby stack when calling a Ruby function. bnc#708059
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-ruby-bindings-0.3.7/src/CMakeLists.txt
new/yast2-ruby-bindings-0.3.8/src/CMakeLists.txt
--- old/yast2-ruby-bindings-0.3.7/src/CMakeLists.txt 2011-07-26
16:26:31.000000000 +0200
+++ new/yast2-ruby-bindings-0.3.8/src/CMakeLists.txt 2011-10-03
17:37:50.000000000 +0200
@@ -1,2 +1 @@
-
-ADD_SUBDIRECTORY(ruby)
\ No newline at end of file
+add_subdirectory(ruby)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-ruby-bindings-0.3.7/src/ruby/CMakeLists.txt
new/yast2-ruby-bindings-0.3.8/src/ruby/CMakeLists.txt
--- old/yast2-ruby-bindings-0.3.7/src/ruby/CMakeLists.txt 2011-07-26
16:26:31.000000000 +0200
+++ new/yast2-ruby-bindings-0.3.8/src/ruby/CMakeLists.txt 2011-10-03
17:37:50.000000000 +0200
@@ -1,7 +1,6 @@
+add_definitions(-DY2LOG=\"Ruby\")
-ADD_DEFINITIONS(-DY2LOG=\\\"Ruby\\\")
-
-SET(yast_ruby_module_SRCS
+set(yast_ruby_module_SRCS
YCP.cc
Y2RubyTypePath.cc # YCP.cc -> ryast_path_init()
Y2RubyTypeTerm.cc # YCP.cc -> ryast_term_init()
@@ -11,7 +10,7 @@
RubyLogger.h
)
-SET(ruby_yast_plugin_SRCS
+set(ruby_yast_plugin_SRCS
RubyLogger.cc
Y2CCRuby.cc
Y2RubyComponent.cc
@@ -23,7 +22,7 @@
Y2RubyUtils.cc
)
-SET(ruby_yast_plugin_HEADERS
+set(ruby_yast_plugin_HEADERS
RubyLogger.h
Y2CCRuby.h
Y2RubyComponent.h
@@ -34,12 +33,12 @@
Y2RubyTypeTerm.h
)
-INCLUDE_DIRECTORIES( ${RUBY_INCLUDE_PATH} )
-INCLUDE_DIRECTORIES( ${YAST_INCLUDE_DIR} )
+include_directories( ${RUBY_INCLUDE_PATH} )
+include_directories( ${YAST_INCLUDE_DIR} )
-LINK_DIRECTORIES(${YAST_PLUGIN_DIR})
+link_directories(${YAST_PLUGIN_DIR})
-ADD_DEFINITIONS( ${CC_FLAGS} -Wno-deprecated)
+add_definitions(${CC_FLAGS} -Wno-deprecated)
#
# Ruby -> YCP/YaST
@@ -47,8 +46,9 @@
#
-ADD_LIBRARY( ycpx SHARED ${yast_ruby_module_SRCS})
-SET_TARGET_PROPERTIES( ycpx PROPERTIES PREFIX "" )
+add_library(ycpx SHARED ${yast_ruby_module_SRCS})
+# libycpx.so -> ycpx.so
+set_target_properties(ycpx PROPERTIES PREFIX "")
#
# Use rpath to find YaST plugin libs (wfm has static constructors :-( )
@@ -57,35 +57,35 @@
# tight control) CMake should be able to handle this. However, it somehow does
# not work.
#
-#SET_TARGET_PROPERTIES( ycpx PROPERTIES SKIP_BUILD_RPATH FALSE)
-#SET_TARGET_PROPERTIES( ycpx PROPERTIES BUILD_WITH_INSTALL_RPATH FALSE)
-#SET_TARGET_PROPERTIES( ycpx PROPERTIES INSTALL_RPATH_USE_LINK_PATH FALSE)
-#SET_TARGET_PROPERTIES( ycpx PROPERTIES INSTALL_RPATH "${YAST_PLUGIN_DIR}")
+#set_target_properties( ycpx PROPERTIES SKIP_BUILD_RPATH FALSE)
+#set_target_properties( ycpx PROPERTIES BUILD_WITH_INSTALL_RPATH FALSE)
+#set_target_properties( ycpx PROPERTIES INSTALL_RPATH_USE_LINK_PATH FALSE)
+#set_target_properties( ycpx PROPERTIES INSTALL_RPATH "${YAST_PLUGIN_DIR}")
#
# So using an explicit linker option instead:
# (http://www.cmake.org/pipermail/cmake/2008-January/019321.html)
#
SET ( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}
-Wl,-rpath,'${YAST_PLUGIN_DIR}'" )
-TARGET_LINK_LIBRARIES( ycpx ${YAST_LIBRARY} )
-TARGET_LINK_LIBRARIES( ycpx ${YAST_YCP_LIBRARY} )
+target_link_libraries( ycpx ${YAST_LIBRARY} )
+target_link_libraries( ycpx ${YAST_YCP_LIBRARY} )
#
# The WFM and SCR component can only be initialized statically
# (e.g. through Y2CCWFM), thus we must link against the plugin libs
# and set the executables 'rpath' accordingly
#
-TARGET_LINK_LIBRARIES( ycpx ${YAST_PLUGIN_WFM_LIBRARY} )
-TARGET_LINK_LIBRARIES( ycpx ${YAST_PLUGIN_SCR_LIBRARY} )
-TARGET_LINK_LIBRARIES( ycpx ${YAST_PLUGIN_UI_LIBRARY} )
-TARGET_LINK_LIBRARIES( ycpx ${RUBY_LIBRARY} )
+target_link_libraries( ycpx ${YAST_PLUGIN_WFM_LIBRARY} )
+target_link_libraries( ycpx ${YAST_PLUGIN_SCR_LIBRARY} )
+target_link_libraries( ycpx ${YAST_PLUGIN_UI_LIBRARY} )
+target_link_libraries( ycpx ${RUBY_LIBRARY} )
-INSTALL(TARGETS ycpx LIBRARY DESTINATION ${RUBY_VENDORARCH_DIR} )
+install(TARGETS ycpx LIBRARY DESTINATION ${RUBY_VENDORARCH_DIR} )
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ycp.rb DESTINATION
${RUBY_VENDORLIB_DIR} )
+install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ycp.rb DESTINATION
${RUBY_VENDORLIB_DIR} )
# rdoc
-SET(rdoc_dir "${CMAKE_CURRENT_BINARY_DIR}/html")
+set(rdoc_dir "${CMAKE_CURRENT_BINARY_DIR}/html")
ADD_CUSTOM_COMMAND (
OUTPUT ${rdoc_dir}
COMMAND ${CMAKE_COMMAND} -E echo_append "Creating rdoc documentation ..."
@@ -95,19 +95,17 @@
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src/ruby
DEPENDS ${CMAKE_SOURCE_DIR}/src/ruby/YCP.cc
${CMAKE_SOURCE_DIR}/src/ruby/*.rb
)
-ADD_CUSTOM_TARGET(ruby_rdoc ALL DEPENDS "${rdoc_dir}")
-ADD_DEPENDENCIES(ruby_rdoc ycpx)
+add_custom_target(ruby_rdoc ALL DEPENDS "${rdoc_dir}")
+add_dependencies(ruby_rdoc ycpx)
#
# YCP -> Ruby
# libpy2lang_ruby (YCP plugin library)
#
-ADD_LIBRARY( py2lang_ruby SHARED ${ruby_yast_plugin_SRCS})
-TARGET_LINK_LIBRARIES( py2lang_ruby ${YAST_LIBRARY} )
-TARGET_LINK_LIBRARIES( py2lang_ruby ${YAST_YCP_LIBRARY} )
-TARGET_LINK_LIBRARIES( py2lang_ruby ${YAST_PLUGIN_WFM_LIBRARY} )
-TARGET_LINK_LIBRARIES( py2lang_ruby ${RUBY_LIBRARY} )
-INSTALL(TARGETS py2lang_ruby LIBRARY DESTINATION ${YAST_PLUGIN_DIR} )
-
-#SET_TARGET_PROPERTIES( y2lang_ruby PROPERTIES PREFIX "" )
+add_library( py2lang_ruby SHARED ${ruby_yast_plugin_SRCS})
+target_link_libraries( py2lang_ruby ${YAST_LIBRARY} )
+target_link_libraries( py2lang_ruby ${YAST_YCP_LIBRARY} )
+target_link_libraries( py2lang_ruby ${YAST_PLUGIN_WFM_LIBRARY} )
+target_link_libraries( py2lang_ruby ${RUBY_LIBRARY} )
+install(TARGETS py2lang_ruby LIBRARY DESTINATION ${YAST_PLUGIN_DIR} )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-ruby-bindings-0.3.7/src/ruby/Y2RubyTypeConv.cc
new/yast2-ruby-bindings-0.3.8/src/ruby/Y2RubyTypeConv.cc
--- old/yast2-ruby-bindings-0.3.7/src/ruby/Y2RubyTypeConv.cc 2011-07-26
16:26:31.000000000 +0200
+++ new/yast2-ruby-bindings-0.3.8/src/ruby/Y2RubyTypeConv.cc 2011-10-03
17:37:50.000000000 +0200
@@ -43,8 +43,12 @@
#include <ycp/YCPSymbol.h>
#include <ycp/YCPPath.h>
#include <ycp/YCPVoid.h>
+#include <ycp/YCPExternal.h>
#include <ycp/Import.h>
+#include <cassert>
+
+#include "YRuby.h"
#include "Y2RubyTypePath.h"
#include "Y2RubyTypeTerm.h"
@@ -95,6 +99,39 @@
}
+#define YCP_EXTERNAL_MAGIC "Ruby object"
+
+static void ycpexternal_finalizer(void * value_v, string /*magic*/)
+{
+ VALUE value = (VALUE)value_v;
+
+ YRuby::refcount_map_t& vrby = YRuby::yRuby()->value_references_from_ycp;
+ YRuby::refcount_map_t::iterator it = vrby.find(value);
+ if (it == vrby.end()) {
+ // YRuby got re-constructed during final cleanup; do nothing
+ return;
+ }
+
+ int & count = it->second;
+ --count;
+ y2internal("Refcount of value %ld decremented to %d", value, count);
+ assert(count >= 0);
+
+ if (count == 0) {
+ vrby.erase(it);
+ }
+}
+
+static YCPExternal rbobject_2_ycpexternal( VALUE value )
+{
+ YCPExternal ex((void*) value, string(YCP_EXTERNAL_MAGIC),
ycpexternal_finalizer);
+
+ // defaults to zero, ok
+ int count = ++YRuby::yRuby()->value_references_from_ycp[value];
+ y2internal("Refcount of value %ld incremented to %d", value, count);
+ return ex;
+}
+
/**
*
* ycpvalue_2_rbvalue
@@ -169,6 +206,14 @@
YCPSymbol symbol = ycpval->asSymbol();
return rb_intern(symbol->symbol_cstr());
}
+ else if (ycpval->isExternal())
+ {
+ YCPExternal ex = ycpval->asExternal();
+ if (ex->magic() == string(YCP_EXTERNAL_MAGIC)) {
+ return (VALUE)(ex->payload()); // FIXME reference counting
+ }
+ y2error("Unexpected magic '%s'.", (ex->magic()).c_str());
+ }
rb_raise( rb_eTypeError, "Conversion of YCP type %s not supported",
ycpval->toString().c_str() );
return Qnil;
}
@@ -229,8 +274,8 @@
{
return ryast_yterm_from_rterm(value);
}
- rb_raise( rb_eTypeError, "Conversion of Ruby type %s not supported",
class_name);
- return YCPValue();
+
+ return rbobject_2_ycpexternal(value);
}
}
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-ruby-bindings-0.3.7/src/ruby/YCP.cc
new/yast2-ruby-bindings-0.3.8/src/ruby/YCP.cc
--- old/yast2-ruby-bindings-0.3.7/src/ruby/YCP.cc 2011-07-26
16:26:31.000000000 +0200
+++ new/yast2-ruby-bindings-0.3.8/src/ruby/YCP.cc 2011-10-03
17:37:50.000000000 +0200
@@ -23,6 +23,7 @@
#include <ycp-ui/YUIComponent.h>
#include <wfm/Y2WFMComponent.h>
+#include <wfm/WFM.h>
#include <y2/Y2ComponentBroker.h>
#include <y2/Y2Namespace.h>
@@ -646,6 +647,11 @@
void
Init_ycpx()
{
+ if (!WFM::registered)
+ {
+ y2milestone("WFM not registered (so what?!)");
+ }
+
YCPPathSearch::initialize();
/*
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-ruby-bindings-0.3.7/src/ruby/YRuby.cc
new/yast2-ruby-bindings-0.3.8/src/ruby/YRuby.cc
--- old/yast2-ruby-bindings-0.3.7/src/ruby/YRuby.cc 2011-07-26
16:26:31.000000000 +0200
+++ new/yast2-ruby-bindings-0.3.8/src/ruby/YRuby.cc 2011-10-03
17:37:50.000000000 +0200
@@ -82,6 +82,32 @@
//ruby_options(argc - 1, ++argv);
ruby_script("yast");
ruby_init_loadpath();
+
+ VALUE ycp_references = Data_Wrap_Struct(rb_cObject, gc_mark, gc_free, &
value_references_from_ycp);
+ rb_global_variable(&ycp_references);
+}
+
+void YRuby::gc_mark(void *object)
+{
+ refcount_map_t * vrby = (refcount_map_t *) object;
+
+ y2internal("mark: map size is %u", vrby->size());
+ refcount_map_t::iterator
+ b = vrby->begin(),
+ e = vrby->end(),
+ it;
+ for (it = b; it != e; ++it) {
+ y2internal("marking: value %ld refcount %d", it->first, it->second);
+ rb_gc_mark(it->first);
+ }
+}
+
+void YRuby::gc_free(void *object)
+{
+ refcount_map_t * vrby = (refcount_map_t *) object;
+
+ y2internal("free: map size is %u", vrby->size());
+ y2internal("should happen quite last or we are in trouble FIXME");
}
YRuby::~YRuby()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-ruby-bindings-0.3.7/src/ruby/YRuby.h
new/yast2-ruby-bindings-0.3.8/src/ruby/YRuby.h
--- old/yast2-ruby-bindings-0.3.7/src/ruby/YRuby.h 2011-07-26
16:26:31.000000000 +0200
+++ new/yast2-ruby-bindings-0.3.8/src/ruby/YRuby.h 2011-10-03
17:37:50.000000000 +0200
@@ -97,11 +97,23 @@
**/
YCPValue callInner (string module, string function, bool method,
YCPList argList, constTypePtr wanted_result_type);
+ /**
+ * Ruby VALUEs do not have a reference count like YCP or Perl.
+ * To protect them from being garbage-collected, they must be marked
+ * via ruby_gc_mark
+ *
+ * A set is not enough: one VALUE can be referenced by multiple
+ * YCPValueReps
+ */
+ typedef std::map<VALUE, int> refcount_map_t;
-protected:
-
+private:
+ static void gc_mark(void *object);
+ static void gc_free(void *object);
+
public:
static YRuby * _yRuby;
+ refcount_map_t value_references_from_ycp;
};
#endif // YRuby_h
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-ruby-bindings-0.3.7/src/ruby/YRubyNamespace.cc
new/yast2-ruby-bindings-0.3.8/src/ruby/YRubyNamespace.cc
--- old/yast2-ruby-bindings-0.3.7/src/ruby/YRubyNamespace.cc 2011-07-26
16:26:31.000000000 +0200
+++ new/yast2-ruby-bindings-0.3.8/src/ruby/YRubyNamespace.cc 2011-10-03
17:37:50.000000000 +0200
@@ -252,8 +252,8 @@
// enter it to the symbol table
enterSymbol (fun_se, 0);
y2milestone("method: '%s' added", RSTRING(current)->ptr);
- y2milestone("%s", symbolsToString().c_str());
}
+ y2milestone("%s", symbolsToString().c_str());
}
YRubyNamespace::~YRubyNamespace ()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-ruby-bindings-0.3.7/tests/CMakeLists.txt
new/yast2-ruby-bindings-0.3.8/tests/CMakeLists.txt
--- old/yast2-ruby-bindings-0.3.7/tests/CMakeLists.txt 2011-07-26
16:26:31.000000000 +0200
+++ new/yast2-ruby-bindings-0.3.8/tests/CMakeLists.txt 2011-10-03
17:37:50.000000000 +0200
@@ -2,10 +2,10 @@
# CMakeLists.txt for yast2/ruby-bindings/tests
#
-ENABLE_TESTING()
+enable_testing()
# Ruby -> YaST tests
-ADD_SUBDIRECTORY(ruby)
+add_subdirectory(ruby)
# YCP -> Ruby tests
-#ADD_SUBDIRECTORY(ycp)
+add_subdirectory(ycp)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-ruby-bindings-0.3.7/tests/ruby/module-arch.rb
new/yast2-ruby-bindings-0.3.8/tests/ruby/module-arch.rb
--- old/yast2-ruby-bindings-0.3.7/tests/ruby/module-arch.rb 2011-07-26
16:26:31.000000000 +0200
+++ new/yast2-ruby-bindings-0.3.8/tests/ruby/module-arch.rb 2011-10-03
17:37:50.000000000 +0200
@@ -4,6 +4,7 @@
$:.unshift "../../build/src/ruby" # ycpx.so
$:.unshift "../../src/ruby" # ycp.rb
+ENV["Y2DIR"] = File.dirname(__FILE__)
require 'test/unit'
Files old/yast2-ruby-bindings-0.3.7/tests/ruby/modules/Arch.ybc and
new/yast2-ruby-bindings-0.3.8/tests/ruby/modules/Arch.ybc differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-ruby-bindings-0.3.7/tests/ruby/modules/Arch.ycp
new/yast2-ruby-bindings-0.3.8/tests/ruby/modules/Arch.ycp
--- old/yast2-ruby-bindings-0.3.7/tests/ruby/modules/Arch.ycp 1970-01-01
01:00:00.000000000 +0100
+++ new/yast2-ruby-bindings-0.3.8/tests/ruby/modules/Arch.ycp 2011-10-03
17:37:50.000000000 +0200
@@ -0,0 +1,14 @@
+// mock Arch
+{
+ module "Arch";
+
+ global boolean sparc32() {
+ return false;
+ }
+ global boolean is_xen() {
+ return false;
+ }
+ global string arch_short() {
+ return "ZX Spectrum";
+ }
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-ruby-bindings-0.3.7/tests/ruby/ycp_import.rb
new/yast2-ruby-bindings-0.3.8/tests/ruby/ycp_import.rb
--- old/yast2-ruby-bindings-0.3.7/tests/ruby/ycp_import.rb 2011-07-26
16:26:31.000000000 +0200
+++ new/yast2-ruby-bindings-0.3.8/tests/ruby/ycp_import.rb 2011-10-03
17:37:50.000000000 +0200
@@ -4,6 +4,7 @@
$:.unshift "../../build/src/ruby"
$:.unshift "../../src/ruby"
+ENV["Y2DIR"] = File.dirname(__FILE__)
require 'test/unit'
require 'ycp'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-ruby-bindings-0.3.7/tests/ruby/ycp_iterators.rb
new/yast2-ruby-bindings-0.3.8/tests/ruby/ycp_iterators.rb
--- old/yast2-ruby-bindings-0.3.7/tests/ruby/ycp_iterators.rb 2011-07-26
16:26:31.000000000 +0200
+++ new/yast2-ruby-bindings-0.3.8/tests/ruby/ycp_iterators.rb 2011-10-03
17:37:50.000000000 +0200
@@ -6,6 +6,7 @@
$:.unshift "../../build/src/ruby"
$:.unshift "../../src/ruby"
+ENV["Y2DIR"] = File.dirname(__FILE__)
require 'test/unit'
require 'ycp'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-ruby-bindings-0.3.7/tests/ycp/CMakeLists.txt
new/yast2-ruby-bindings-0.3.8/tests/ycp/CMakeLists.txt
--- old/yast2-ruby-bindings-0.3.7/tests/ycp/CMakeLists.txt 1970-01-01
01:00:00.000000000 +0100
+++ new/yast2-ruby-bindings-0.3.8/tests/ycp/CMakeLists.txt 2011-10-03
17:37:50.000000000 +0200
@@ -0,0 +1,8 @@
+#
+# CMakeLists.txt for yast2/ruby-bindings/tests/ycp
+#
+
+enable_testing()
+
+add_test(from_ycp ${CMAKE_CURRENT_SOURCE_DIR}/run_ycp_test.sh
${CMAKE_CURRENT_SOURCE_DIR}/ruby_from_ycp.ycp)
+add_test(ruby_object ${CMAKE_CURRENT_SOURCE_DIR}/run_ycp_test.sh
${CMAKE_CURRENT_SOURCE_DIR}/ruby_object.ycp)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-ruby-bindings-0.3.7/tests/ycp/InRuby.rb
new/yast2-ruby-bindings-0.3.8/tests/ycp/InRuby.rb
--- old/yast2-ruby-bindings-0.3.7/tests/ycp/InRuby.rb 1970-01-01
01:00:00.000000000 +0100
+++ new/yast2-ruby-bindings-0.3.8/tests/ycp/InRuby.rb 2011-10-03
17:37:50.000000000 +0200
@@ -0,0 +1,5 @@
+module InRuby
+ def self.multiply_by_eight(n)
+ n * 8
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-ruby-bindings-0.3.7/tests/ycp/URI.rb
new/yast2-ruby-bindings-0.3.8/tests/ycp/URI.rb
--- old/yast2-ruby-bindings-0.3.7/tests/ycp/URI.rb 1970-01-01
01:00:00.000000000 +0100
+++ new/yast2-ruby-bindings-0.3.8/tests/ycp/URI.rb 2011-10-03
17:37:50.000000000 +0200
@@ -0,0 +1,13 @@
+require 'uri'
+module URI
+ # URI::parse works even without glue
+
+ def self.scheme(instance)
+ instance.scheme
+ end
+
+ # garbage_collect
+ class << self;
+ include GC
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-ruby-bindings-0.3.7/tests/ycp/ruby_from_ycp.ycp
new/yast2-ruby-bindings-0.3.8/tests/ycp/ruby_from_ycp.ycp
--- old/yast2-ruby-bindings-0.3.7/tests/ycp/ruby_from_ycp.ycp 1970-01-01
01:00:00.000000000 +0100
+++ new/yast2-ruby-bindings-0.3.8/tests/ycp/ruby_from_ycp.ycp 2011-10-03
17:37:50.000000000 +0200
@@ -0,0 +1,6 @@
+//
+{
+ import "InRuby";
+ string result = tostring(InRuby::multiply_by_eight(10));
+ y2milestone("result: %1", result);
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-ruby-bindings-0.3.7/tests/ycp/ruby_object.ycp
new/yast2-ruby-bindings-0.3.8/tests/ycp/ruby_object.ycp
--- old/yast2-ruby-bindings-0.3.7/tests/ycp/ruby_object.ycp 1970-01-01
01:00:00.000000000 +0100
+++ new/yast2-ruby-bindings-0.3.8/tests/ycp/ruby_object.ycp 2011-10-03
17:37:50.000000000 +0200
@@ -0,0 +1,18 @@
+//
+{
+ // URI is a local ruby file to glue the standard uri.rb
+ import "URI";
+
+ // Ruby:
+ // uri = URI.parse("http://www.ruby-lang.org/")
+ // assert_equal "http", uri.scheme
+
+ // my_uri is an opaque ruby object
+ any my_uri = URI::parse("http://www.ruby-lang.org/");
+
+ // URI::garbage_collect();
+
+ string scheme = (string) URI::scheme(my_uri);
+ y2milestone("scheme: %1", scheme);
+ return scheme == "http";
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-ruby-bindings-0.3.7/tests/ycp/run_ycp_test.sh
new/yast2-ruby-bindings-0.3.8/tests/ycp/run_ycp_test.sh
--- old/yast2-ruby-bindings-0.3.7/tests/ycp/run_ycp_test.sh 1970-01-01
01:00:00.000000000 +0100
+++ new/yast2-ruby-bindings-0.3.8/tests/ycp/run_ycp_test.sh 2011-10-03
17:37:50.000000000 +0200
@@ -0,0 +1,9 @@
+#!/bin/sh
+# $1 is the test case
+DIR=${1%/*}
+# RPM_BUILD_ROOT will hold the YCP Ruby plugin at rpm build time
+export Y2DIR=$RPM_BUILD_ROOT/usr/lib*/YaST2
+# DEBUG=valgrind
+# DEBUG="strace -s1000 -o log -e trace=file"
+: ${PREFIX=/usr}
+$DEBUG $PREFIX/lib/YaST2/bin/y2base -l - -M $DIR $1 UI
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-ruby-bindings-0.3.7/yast2-ruby-bindings.spec.in
new/yast2-ruby-bindings-0.3.8/yast2-ruby-bindings.spec.in
--- old/yast2-ruby-bindings-0.3.7/yast2-ruby-bindings.spec.in 2011-07-26
16:26:31.000000000 +0200
+++ new/yast2-ruby-bindings-0.3.8/yast2-ruby-bindings.spec.in 2011-10-03
17:37:50.000000000 +0200
@@ -41,13 +41,18 @@
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_SKIP_RPATH=1 \
..
-make %{?jobs:-j %jobs}
+make %{?jobs:-j %jobs} VERBOSE=1
%install
cd build
make install DESTDIR=$RPM_BUILD_ROOT
cd ..
+%check
+cd build
+make test ARGS=-V
+cd ..
+
@CLEAN@
%files
continue with "q"...
Remember to have fun...
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]