Hello community,
here is the log from the commit of package yast2-ruby-bindings for openSUSE:Factory
checked in at Fri Jul 3 17:07:15 CEST 2009.
--------
--- yast2-ruby-bindings/yast2-ruby-bindings.changes 2008-05-06 10:29:16.000000000 +0200
+++ /mounts/work_src_done/STABLE/yast2-ruby-bindings/yast2-ruby-bindings.changes 2009-04-15 13:16:41.000000000 +0200
@@ -1,0 +2,9 @@
+Thu Apr 9 15:15:09 CEST 2009 - kkaempf@suse.de
+
+- add and enable CTest
+- generate rdoc documentation
+- pass explicit rpath to linker so plugins are found
+- general code cleanup
+- 0.3.3
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
Old:
----
yast2-ruby-bindings-0.3.2.tar.bz2
New:
----
yast2-ruby-bindings-0.3.3.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-ruby-bindings.spec ++++++
--- /var/tmp/diff_new_pack.b19991/_old 2009-07-03 17:07:00.000000000 +0200
+++ /var/tmp/diff_new_pack.b19991/_new 2009-07-03 17:07:00.000000000 +0200
@@ -1,5 +1,5 @@
#
-# spec file for package yast2-ruby-bindings (Version 0.3.2)
+# spec file for package yast2-ruby-bindings (Version 0.3.3)
#
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@@ -19,9 +19,9 @@
Name: yast2-ruby-bindings
-Version: 0.3.2
-Release: 58
-License: GPL v2 or later
+Version: 0.3.3
+Release: 1
+License: GPL
Group: System/YaST
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Source0: yast2-ruby-bindings-%{version}.tar.bz2
@@ -31,8 +31,9 @@
# libzypp-devel is missing .la requires
BuildRequires: ruby-devel
Requires: yast2-core >= 2.16.37
-BuildRequires: yast2-ycp-ui-bindings-devel >= 2.16.37
+BuildRequires: yast2-core-devel >= 2.16.37
Requires: yast2-ycp-ui-bindings >= 2.16.37
+BuildRequires: yast2-ycp-ui-bindings-devel >= 2.16.37
Requires: ruby
Summary: Ruby bindings for the YaST platform
@@ -40,8 +41,6 @@
The bindings allow YaST modules to be written using the Ruby language
and also Ruby scripts can use YaST agents, APIs and modules.
-
-
%prep
%setup -n yast2-ruby-bindings-%{version}
@@ -70,27 +69,4 @@
%{_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
-* Tue May 06 2008 aj@suse.de
-- Fix spec file for last change.
-* Wed Apr 16 2008 dmacvicar@suse.de
-- find yast pugins without requiring LD_LIBRARY_PATH
- (bnc #353405)
-- require 'yast' is now require 'ycp'
-- misc. fixes
-- 0.3.2
-* Thu Feb 21 2008 sh@suse.de
-- Added new UI packages to Requires/BuildRequires in .spec file
-- V 0.3.1
-* Wed Feb 20 2008 coolo@suse.de
-- fix against latest yast2-core
-* Wed Sep 19 2007 dmacvicar@suse.de
-- Lot of improvements, examples and
- support for the YaST UI
-- 0.2.0
-* Thu Aug 09 2007 dmacvicar@suse.de
-- Fix build on 64 bits
-- Use ruby vendor arch dir
-* Mon Aug 06 2007 dmacvicar@suse.de
-- Initial release 0.1.0
++++++ yast2-ruby-bindings-0.3.2.tar.bz2 -> yast2-ruby-bindings-0.3.3.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ruby-bindings-0.3.2/CMakeLists.txt new/yast2-ruby-bindings-0.3.3/CMakeLists.txt
--- old/yast2-ruby-bindings-0.3.2/CMakeLists.txt 2008-04-16 17:46:52.000000000 +0200
+++ new/yast2-ruby-bindings-0.3.3/CMakeLists.txt 2009-06-21 20:32:50.000000000 +0200
@@ -1,30 +1,76 @@
+#
+# CMakeLists.txt for yast2/ruby-bindings
+#
+
+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" )
+#
+# 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 "SWIG not found." )
+ MESSAGE( FATAL_ERROR "SWIG not found." )
ELSE ( NOT SWIG_EXECUTABLE )
MESSAGE( STATUS "SWIG found at ${SWIG_EXECUTABLE}" )
ENDIF ( NOT SWIG_EXECUTABLE )
-FIND_PACKAGE(Yast REQUIRED)
-INCLUDE(YastCommon)
+#
+# 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 )
+
+#
+# Where is Ruby ?
+#
FIND_PACKAGE(Ruby REQUIRED)
-
-#RUBY_RUBY_LIB_PATH
-MESSAGE( STATUS "Ruby vendor arch dir: ${RUBY_VENDORARCH_DIR}" )
+IF ( NOT RUBY_EXECUTABLE )
+ MESSAGE( FATAL_ERROR "Ruby not found." )
+ENDIF ( NOT RUBY_EXECUTABLE )
+
+#
+# -> src/
+#
ADD_SUBDIRECTORY(src)
+#
+# -> tests/
+#
+INCLUDE(CTest)
+ENABLE_TESTING()
+
+ADD_SUBDIRECTORY(tests)
+
+#
+# packaging
+#
SET( RPMNAME "yast2-ruby-bindings" )
GENERATE_PACKAGING(${RPMNAME} ${VERSION})
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ruby-bindings-0.3.2/examples/ruby/module-arch.rb new/yast2-ruby-bindings-0.3.3/examples/ruby/module-arch.rb
--- old/yast2-ruby-bindings-0.3.2/examples/ruby/module-arch.rb 2008-04-16 17:46:52.000000000 +0200
+++ new/yast2-ruby-bindings-0.3.3/examples/ruby/module-arch.rb 2009-06-21 20:32:50.000000000 +0200
@@ -1,4 +1,4 @@
-require 'yast'
+require 'ycp'
require 'ycp/arch'
puts YCP::Arch::sparc32
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ruby-bindings-0.3.2/package/yast2-ruby-bindings.changes new/yast2-ruby-bindings-0.3.3/package/yast2-ruby-bindings.changes
--- old/yast2-ruby-bindings-0.3.2/package/yast2-ruby-bindings.changes 2008-04-16 17:46:52.000000000 +0200
+++ new/yast2-ruby-bindings-0.3.3/package/yast2-ruby-bindings.changes 2009-06-21 20:32:50.000000000 +0200
@@ -1,4 +1,18 @@
-------------------------------------------------------------------
+Thu Apr 9 15:15:09 CEST 2009 - kkaempf@suse.de
+
+- add and enable CTest
+- generate rdoc documentation
+- pass explicit rpath to linker so plugins are found
+- general code cleanup
+- 0.3.3
+
+-------------------------------------------------------------------
+Tue May 6 10:00:50 CEST 2008 - aj@suse.de
+
+- Fix spec file for last change.
+
+-------------------------------------------------------------------
Wed Apr 16 17:27:57 CEST 2008 - dmacvicar@suse.de
- find yast pugins without requiring LD_LIBRARY_PATH
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ruby-bindings-0.3.2/src/ruby/CMakeLists.txt new/yast2-ruby-bindings-0.3.3/src/ruby/CMakeLists.txt
--- old/yast2-ruby-bindings-0.3.2/src/ruby/CMakeLists.txt 2008-04-16 17:46:52.000000000 +0200
+++ new/yast2-ruby-bindings-0.3.3/src/ruby/CMakeLists.txt 2009-06-21 20:32:50.000000000 +0200
@@ -3,7 +3,9 @@
SET(yast_ruby_module_SRCS
YCP.cc
- Y2RubyTypeConv.cc
+ Y2RubyTypePath.cc # YCP.cc -> ryast_path_init()
+ Y2RubyTypeTerm.cc # YCP.cc -> ryast_term_init()
+ Y2RubyTypeConv.cc # YCP.cc -> ycpvalue_2_rbvalue(), rbvalue_2_ycpvalue()
RubyLogger.cc
RubyLogger.h
)
@@ -29,31 +31,74 @@
Y2RubyTypeTerm.h
)
-# skip the full RPATH for the build tree
-SET(CMAKE_SKIP_BUILD_RPATH TRUE)
-# when building, use the install RPATH already
-# (so it doesn't need to relink when installing)
-SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
-# the RPATH to be used when installing
-SET(CMAKE_INSTALL_RPATH "${LIB_INSTALL_DIR}/YaST2/plugins")
-# add the automatically determined parts of the RPATH
-# which point to directories outside the build tree to the install RPATH
-SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
-
INCLUDE_DIRECTORIES( ${RUBY_INCLUDE_PATH} )
INCLUDE_DIRECTORIES( ${YAST_INCLUDE_DIR} )
-
+
+LINK_DIRECTORIES(${YAST_PLUGIN_DIR})
+
+ADD_DEFINITIONS( ${CC_FLAGS} -Wno-deprecated)
+
+#
+# Ruby -> YCP/YaST
+# ycp.rb + ycpx.so
+#
+
+
ADD_LIBRARY( ycpx SHARED ${yast_ruby_module_SRCS})
SET_TARGET_PROPERTIES( ycpx PROPERTIES PREFIX "" )
+
+#
+# Use rpath to find YaST plugin libs (wfm has static constructors :-( )
+#
+# According to http://www.cmake.org/Wiki/CMake_RPATH_handling(Always full RPATH,
+# 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}")
+#
+# 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} )
+#
+# 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 ${RUBY_LIBRARY} )
+
+
INSTALL(TARGETS ycpx LIBRARY DESTINATION ${RUBY_VENDORARCH_DIR} )
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ycp.rb DESTINATION ${RUBY_VENDORLIB_DIR} )
+# 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} ycp.rb YCP.cc
+ COMMAND ${CMAKE_COMMAND} -E echo "Done."
+ 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)
+
+#
+# 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} )
@@ -61,4 +106,4 @@
TARGET_LINK_LIBRARIES( py2lang_ruby ${RUBY_LIBRARY} )
INSTALL(TARGETS py2lang_ruby LIBRARY DESTINATION ${YAST_PLUGIN_DIR} )
-#SET_TARGET_PROPERTIES( y2lang_ruby PROPERTIES PREFIX "" )
\ No newline at end of file
+#SET_TARGET_PROPERTIES( y2lang_ruby PROPERTIES PREFIX "" )
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ruby-bindings-0.3.2/src/ruby/Makefile.am new/yast2-ruby-bindings-0.3.3/src/ruby/Makefile.am
--- old/yast2-ruby-bindings-0.3.2/src/ruby/Makefile.am 2008-04-16 17:46:52.000000000 +0200
+++ new/yast2-ruby-bindings-0.3.3/src/ruby/Makefile.am 1970-01-01 01:00:00.000000000 +0100
@@ -1,93 +0,0 @@
-#
-# Makefile.am for perl-bindings/src
-#
-
-AM_CXXFLAGS = -DY2LOG=\"Perl\" -DMODULEDIR=\"$(moduledir)\"
-
-MY_PERL_VENDORARCH = $(subst /usr,$(prefix),$(PERL_VENDORARCH))
-perlpmdir = $(MY_PERL_VENDORARCH)/YaST
-perlsodir = $(MY_PERL_VENDORARCH)/auto/YaST/YCP
-
-perlpm_DATA = YCP.pm
-
-# plugin, libtool forces 'lib' prefix
-plugin_LTLIBRARIES = libpy2lang_perl.la
-noinst_LTLIBRARIES = liby2lang_perl.la
-perlso_LTLIBRARIES = libYCP.la
-
-# binary part of the Perl module
-libYCP_la_SOURCES = \
- $(liby2lang_perl_la_SOURCES) \
- YCP.cc \
- PerlLogger.cc PerlLogger.h
-
-
-# are there enough yast libraries?
-# check with y2base, integrate them like y2pm does
-# Originally, of the py2* there was only py2plugin here
-# with the assumption that it would bring in the other plugins.
-# But it does not work.
-libYCP_la_LDFLAGS = $(PERL_LDFLAGS) \
- -L$(libdir) -L$(plugindir) \
- -Xlinker --whole-archive \
- -lpy2scr \
- -lpy2wfm \
- -lscr -lyui \
- -lycp -ly2 \
- -Xlinker --no-whole-archive \
- ${ZYPP_LIBS} -ly2util \
- -version-info 2:0
-
-
-libpy2lang_perl_la_LDFLAGS = -version-info 2:0
-
-liby2lang_perl_la_LDFLAGS = -version-info 2:0
-
-
-# the yast libraries are apparently necessary when we're loaded by perl.
-libpy2lang_perl_la_LIBADD = $(PERL_LDFLAGS) \
- -L$(libdir) -L$(plugindir) \
- -lycp -ly2 ${ZYPP_LIBS} -ly2util
-#libpy2lang_perl_la_LIBADD = $(PERL_LDFLAGS)
-
-liby2lang_perl_la_LIBADD = $(PERL_LDFLAGS)
-
-
-liby2lang_perl_la_SOURCES = \
- YPerl.cc YPerl.h \
- perlxsi.c
-
-# Auto-generated stub for dynamic loading of Perl modules.
-# And also register the interface to the YCP module
-## which is linked in already and won't be in the standard Perl location.
-#
-# This results in a linker warning:
-# *** Warning: Linking the shared library libpy2lang_perl.la against the
-# *** static library /usr/lib/perl5/.../DynaLoader.a is not portable!
-#
-# According to mls@suse.de this warning can safely be disregarded:
-# The SuSE DynaLoader is compiled with -fPIC for just this situation.
-#
-# -- sh@suse.de 2003-07-24
-perlxsi.c:
- perl -MExtUtils::Embed -e xsinit -- -o perlxsi.c -std
-# See "man perlembed"
-
-
-# the plugin adds the liby2 component interface
-
-libpy2lang_perl_la_SOURCES = \
- $(liby2lang_perl_la_SOURCES) \
- Y2CCPerl.cc Y2CCPerl.h \
- YPerlNamespace.cc YPerlNamespace.h \
- Y2PerlComponent.cc Y2PerlComponent.h
-
-CLEANFILES = \
- perlxsi.c
-
-INCLUDES = -I$(srcdir)/include -I$(includedir) ${ZYPP_CFLAGS}
-
-# generated from YaPI.pm.in by configure
-nodist_module_DATA = YaPI.pm
-
-EXTRA_DIST = $(perlpm_DATA) $(module_DATA)
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ruby-bindings-0.3.2/src/ruby/Y2RubyTypeConv.cc new/yast2-ruby-bindings-0.3.3/src/ruby/Y2RubyTypeConv.cc
--- old/yast2-ruby-bindings-0.3.2/src/ruby/Y2RubyTypeConv.cc 2008-04-16 17:46:52.000000000 +0200
+++ new/yast2-ruby-bindings-0.3.3/src/ruby/Y2RubyTypeConv.cc 2009-06-21 20:32:50.000000000 +0200
@@ -19,6 +19,16 @@
*/
+/*
+ * Y2RubyTypeConv.cc provides type mapping between YaST (YCPValue)
+ * and Ruby (VALUE) with
+ *
+ * extern "C" VALUE ycpvalue_2_rbvalue( YCPValue ycpval )
+ *
+ * YCPValue rbvalue_2_ycpvalue( VALUE value )
+ *
+ */
+
#include
#include
@@ -42,6 +52,13 @@
#define IS_A(obj,klass) ((rb_obj_is_kind_of((obj),(klass))==Qtrue)?1:0)
+/*
+ * rbhash_2_ycpmap
+ *
+ * Internal helper for Hash -> YCPMap
+ *
+ */
+
static YCPMap rbhash_2_ycpmap( VALUE value )
{
YCPMap map;
@@ -57,6 +74,14 @@
return map;
}
+
+/*
+ * rbarray_2_ycplist
+ *
+ * Internal helper for Array -> YCPList
+ *
+ */
+
static YCPList rbarray_2_ycplist( VALUE value )
{
YCPList list;
@@ -71,9 +96,13 @@
/**
+ *
+ * ycpvalue_2_rbvalue
+ *
* Converts a YCPValue into a Ruby Value
* Supports neested lists using recursion.
*/
+
extern "C" VALUE
ycpvalue_2_rbvalue( YCPValue ycpval )
{
@@ -115,10 +144,10 @@
YCPMap map = ycpval->asMap();
//y2internal("map size %d\n", (int) map.size());
- for ( YCPMapIterator it = map.begin(); it != map.end(); ++it )
+ for (YCPMap::const_iterator it = map->begin(); it != map->end(); ++it)
{
- YCPValue key = it.key();
- YCPValue value = it.value();
+ YCPValue key = it->first;
+ YCPValue value = it->second;
rb_hash_aset(rbhash, ycpvalue_2_rbvalue(key), ycpvalue_2_rbvalue(value) );
}
return rbhash;
@@ -144,20 +173,29 @@
return Qnil;
}
+
// isEmpty size add remove (value n) toString
+
+/*
+ * rbvalue_2_ycpvalue
+ *
+ * Converts Ruby VALUE to YCP YCPValue
+ *
+ */
+
YCPValue
rbvalue_2_ycpvalue( VALUE value )
{
- VALUE klass = rb_funcall( value, rb_intern("class"), 0);
- //std::cout << RSTRING( rb_funcall( klass, rb_intern("to_s"), 0))->ptr << " | " << RSTRING(rb_funcall( value, rb_intern("inspect"), 0))->ptr << std::endl;
+ //VALUE klass = rb_funcall( value, rb_intern("class"), 0);
+ //std::cout << StringValuePtr( rb_funcall( klass, rb_intern("to_s"), 0)) << " | " << StringValuePtr(rb_funcall( value, rb_intern("inspect"), 0)) << std::endl;
//y2internal("type: '%d'", TYPE(value));
- // TODO conver integers, and add support for lists, ah, and boleans!
+ // TODO convert integers, and add support for lists
switch (TYPE(value))
{
case T_NIL:
return YCPVoid();
case T_STRING:
- return YCPString(RSTRING (value)->ptr);
+ return YCPString(StringValuePtr(value));
break;
case T_TRUE:
return YCPBoolean(true);
@@ -183,21 +221,31 @@
// rb_raise( rb_eRuntimeError, "Object");
break;
default:
- string class_name(RSTRING(rb_funcall(rb_funcall(value, rb_intern("class"), 0), rb_intern("to_s"), 0))->ptr);
- /* get the Term class object */
- if ( class_name == "YaST::Term" )
- {
- return ryast_yterm_from_rterm(value);
- }
- rb_raise( rb_eTypeError, "Conversion of Ruby type not supported");
- return YCPValue();
+ {
+ VALUE cname = rb_funcall(rb_funcall(value, rb_intern("class"), 0), rb_intern("to_s"), 0);
+ const char *class_name = StringValuePtr(cname);
+ /* get the Term class object */
+ if ( !strcmp(class_name, "Yast::Term") )
+ {
+ return ryast_yterm_from_rterm(value);
+ }
+ rb_raise( rb_eTypeError, "Conversion of Ruby type not supported");
+ return YCPValue();
+ }
}
}
+
+/*
+ * rbvalue_2_ycppath
+ *
+ * Converts Ruby value to YCPPath
+ *
+ */
+
YCPValue
rbvalue_2_ycppath( VALUE value )
{
VALUE stringrep = rb_funcall(value, rb_intern("to_s"), 0);
- return YCPPath(RSTRING(stringrep)->ptr);
+ return YCPPath(StringValuePtr(stringrep));
}
-
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ruby-bindings-0.3.2/src/ruby/Y2RubyTypeConv.h new/yast2-ruby-bindings-0.3.3/src/ruby/Y2RubyTypeConv.h
--- old/yast2-ruby-bindings-0.3.2/src/ruby/Y2RubyTypeConv.h 2008-04-16 17:46:52.000000000 +0200
+++ new/yast2-ruby-bindings-0.3.3/src/ruby/Y2RubyTypeConv.h 2009-06-21 20:32:50.000000000 +0200
@@ -23,7 +23,7 @@
#define Y2RUBYTYPECONV_H
#include
-#include "ruby.h"
+#include
/**
* Converts a YCPValue into a Ruby Value
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ruby-bindings-0.3.2/src/ruby/YCP.cc new/yast2-ruby-bindings-0.3.3/src/ruby/YCP.cc
--- old/yast2-ruby-bindings-0.3.2/src/ruby/YCP.cc 2008-04-16 17:46:52.000000000 +0200
+++ new/yast2-ruby-bindings-0.3.3/src/ruby/YCP.cc 2009-06-21 20:32:50.000000000 +0200
@@ -31,17 +31,8 @@
#include
#include
-#include
#include
-#include
#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
#include
#include
@@ -54,17 +45,12 @@
#include "Y2RubyTypeConv.h"
#include "YRuby.h"
-#define GetY2Object(obj, po) \
- Data_Get_Struct(obj, Y2Namespace, po)
-
-static VALUE rb_mYaST;
-static VALUE rb_mUi;
-static VALUE rb_mYCP;
+//forward declaration
+extern "C" YCPValue _call_ycp_builtin ( const string &module_name, const string &func_name, int argc, VALUE *argv );
// make the compiler happy when
// calling rb_define_method()
typedef VALUE (ruby_method)(...);
-
// more useful macros
#define RB_FINALIZER(func) ((void (*)(...))func)
@@ -73,14 +59,23 @@
// in rb_define_method
#define RB_METHOD(func) ((VALUE (*)(...))func)
-Y2Component *owned_uic = 0;
-Y2Component *owned_wfmc = 0;
-//Y2Component *owned_scr = 0;
+#define GetY2Object(obj, po) \
+ Data_Get_Struct(obj, Y2Namespace, po)
+
+/*
+ * Ruby module anchors
+ *
+ */
+static VALUE rb_mYaST;
+static VALUE rb_mUi;
+static VALUE rb_mYCP;
+
+
+static Y2Component *owned_uic = 0;
extern "C" {
-static
-Y2Namespace *
+static Y2Namespace *
getNs (const char * ns_name)
{
Import import(ns_name); // has a static cache
@@ -96,43 +91,32 @@
return ns;
}
-void init_wfm()
-{
- y2milestone("init_wfm");
-// if (Y2WFMComponent::instance () == 0)
-// {
- y2milestone("WFM init");
- owned_wfmc = Y2ComponentBroker::createClient ("wfm");
- if (owned_wfmc == 0)
- {
- y2error ("Cannot create WFM component");
- }
-// }
-}
-
-// void init_scr()
-// {
-// y2milestone("init_scr");
-// // if (Y2WFMComponent::instance () == 0)
-// // {
-// y2milestone("WFM init");
-// owned_scr = Y2ComponentBroker::createClient ("scr");
-// if (owned_scr == 0)
-// {
-// y2error ("Cannot create WFM component");
-// }
-// // }
-// }
+
+/*--------------------------------------------
+ *
+ * Document-module: Ui
+ *
+ *--------------------------------------------
+ */
+
+/*
+ * ui_init()
+ *
+ * Load and initialize UI component
+ *
+ * call-seq:
+ * Ui::init( name = "ncurses" )
+ *
+ */
static VALUE
-rb_init_ui( int argc, VALUE *argv, VALUE self )
+ui_init( int argc, VALUE *argv, VALUE self )
{
const char *ui_name = "ncurses";
if (argc == 1)
{
- Check_Type(argv[0], T_STRING);
- ui_name = RSTRING(argv[0])->ptr;
+ ui_name = StringValuePtr(argv[0]);
}
else if (argc != 0)
{
@@ -171,38 +155,58 @@
return Qnil;
}
-//forward declaration
-YCPValue _call_ycp_builtin ( const string &module_name, const string &func_name, int argc, VALUE *argv );
-/**
+/*--------------------------------------------
+ *
+ * Document-module: YCP
+ *
+ * The YCP module gives access to primitives of the YCP language.
+ *
+ * Its here for completeness, you're mostly better off using Ruby library functions.
+ *
+ *--------------------------------------------
+ */
+
+
+
+/*
+ * Helper
+ *
+ * lookup_namespace_component()
+ *
* looks a component for a namespace
- * throws
+ * throws RuntimeError is namespace cannot be found
+ *
*/
-static VALUE
-ycp_module_lookup_namespace_component(VALUE self, VALUE name)
+
+static void
+lookup_namespace_component(const char *name)
{
- Y2Component *c;
- c = Y2ComponentBroker::getNamespaceComponent(RSTRING(name)->ptr);
+ Y2Component *c = Y2ComponentBroker::getNamespaceComponent(name);
if (c == NULL)
{
- y2internal("no component can provide namespace %s\n", RSTRING (name)->ptr);
- rb_raise( rb_eRuntimeError, "no YaST component can provide namespace %s\n", RSTRING (name)->ptr);
+ y2internal("no component can provide namespace '%s'\n", name);
+ rb_raise( rb_eRuntimeError, "no YaST component can provide namespace '%s'", name);
}
y2internal("component name %s\n", c->name().c_str());
- return Qtrue;
+ return;
}
+
/*
- tries to import a namespace and throws a NameError if
- failed
-*/
+ * import_namespace
+ *
+ * tries to import a namespace
+ * throws a NameError if failed
+ *
+ */
static VALUE
-ycp_module_import_namespace( VALUE self, VALUE namespace_name)
+import_namespace( const char *name)
{
- Y2Namespace *ns = getNs( RSTRING (namespace_name)->ptr);
+ Y2Namespace *ns = getNs(name);
if (ns == NULL)
{
- rb_raise( rb_eNameError, "component cannot import namespace '%s'", RSTRING (namespace_name)->ptr);
+ rb_raise( rb_eNameError, "component cannot import namespace '%s'", name );
return Qnil;
}
else
@@ -212,24 +216,45 @@
return Qtrue;
}
+
+/*
+ * import( name )
+ *
+ * Tries to import a YCP namespace
+ *
+ * call-seq:
+ * YCP::import("name")
+ *
+ */
+
static VALUE
ycp_module_import( VALUE self, VALUE name)
{
- ycp_module_lookup_namespace_component(self,name);
- return ycp_module_import_namespace(self,name);
+ const char *s = StringValuePtr(name);
+ lookup_namespace_component(s); /* throws if not found */
+ return import_namespace(s);
}
-/**
+
+/*
+ * ycp_module_each_symbol(namespace) -> iterator
+ *
* iterates all symbols in a namespace and yields the
* symbol name and category
+ *
+ * call-seq:
+ * each_symbol("namespace") { |symbol,category| ... }
+ *
*/
+
static VALUE
ycp_module_each_symbol(VALUE self, VALUE namespace_name)
{
- Y2Namespace *ns = getNs( RSTRING (namespace_name)->ptr);
+ const char *name = StringValuePtr(namespace_name);
+ Y2Namespace *ns = getNs(name);
if (ns == NULL)
{
- rb_raise( rb_eRuntimeError, "error getting namespace '%s'", RSTRING (namespace_name)->ptr );
+ rb_raise( rb_eRuntimeError, "error getting namespace '%s'", name );
return Qnil;
}
else
@@ -248,8 +273,11 @@
return Qnil;
}
+
/**
* helper method
+ *
+ * yield a SymbolEntry as [ name, category ]
*/
static bool _yield_symbol_entry(const SymbolEntry & s)
{
@@ -260,6 +288,7 @@
return true;
}
+
/**
* helper for each_builtin_symbol
*/
@@ -277,22 +306,39 @@
return true;
}
-/**
- * iterates all symbols in a namespace and yields the
- * symbol name and category
+
+/*
+ * each_builtin_symbol(name) -> iterator
+ *
+ * each_builtin_symbol iterates all symbols in a +namespace+
+ * and yields the symbol name and category
+ *
+ * YCP.each_builtin do |ns, cat|
+ * if cat == :namespace
+ * YCP.each_builtin_symbol(ns) do |sym, cat|
+ * ...
+ * end
+ * end
+ * end
+ *
+ *
+ * call-seq:
+ * each_builtin_symbol("name") { |name, category| ... }
+ *
*/
+
static VALUE
ycp_module_each_builtin_symbol(VALUE self, VALUE name)
{
extern StaticDeclaration static_declarations;
- __name = RSTRING(name)->ptr;
+ __name = StringValuePtr(name);
static_declarations.symbolTable()->forEach(__find_symbol);
const SymbolEntry *se = __symbol;
if (se == NULL)
{
- y2error ("no such builtin '%s'", RSTRING(name)->ptr);
- rb_raise( rb_eRuntimeError, "no YCP builtin %s\n", RSTRING(name)->ptr);
+ y2error ("no such builtin '%s'", __name.c_str());
+ rb_raise( rb_eRuntimeError, "no YCP builtin %s\n", __name.c_str());
}
// convert to a YSymbol to access child symbols
@@ -304,6 +350,19 @@
return Qnil;
}
+
+/*
+ * each_builtin
+ *
+ * each_builtin iterates through YCP builtin symbols,
+ * those of category +namespace+ can be
+ * imported with import_builtin
+ *
+ * call-seq:
+ * each_builtin { |name, category| ... }
+ *
+ */
+
static VALUE
ycp_module_each_builtin(VALUE self)
{
@@ -312,39 +371,45 @@
return Qnil;
}
-/**
+/*
+ * call_ycp_function
+ *
* Forwards a ruby call to the namespace
+ *
* First argument is the namespace
* then function name and arguments
+ *
*/
+
static VALUE
ycp_module_call_ycp_function(int argc, VALUE *argv, VALUE self)
{
y2internal("Dynamic Proxy: [%d] params\n", argc);
+ const char *namespace_name = StringValuePtr(argv[0]);
+ const char *function_name;
VALUE symbol = argv[1];
- VALUE namespace_name = argv[0];
- // the func name (1st argument, is a symbol
- // lets convert it to string
- VALUE symbol_str = rb_funcall(symbol, rb_intern("to_s"), 0);
- y2internal("Dynamic Proxy: [%s::%s] with [%d] params\n", RSTRING(namespace_name)->ptr, RSTRING(symbol_str)->ptr, argc);
+ if (SYMBOL_P(symbol))
+ function_name = (const char *)rb_id2name( SYM2ID( symbol ) );
+ else
+ function_name = StringValuePtr( symbol );
+
+ y2internal("Dynamic Proxy: [%s::%s] with [%d] params\n", namespace_name, function_name, argc);
- //Check_Type(argv[0], T_STRING);
- //y2internal(RSTRING (symbol)->ptr);
//Data_Get_Struct( self, class Y2Namespace, ns );
//ns = gNameSpaces[self];
// get the name of the module
//VALUE namespace_name = rb_funcall(self, rb_intern("name"), 0);
- ycp_module_lookup_namespace_component(self, namespace_name);
+ lookup_namespace_component(namespace_name);
// import the namespace
- //Y2Namespace *ns = c->import(RSTRING (namespace_name)->ptr);
- Y2Namespace *ns = getNs( RSTRING (namespace_name)->ptr);
+ //Y2Namespace *ns = c->import(namespace_name);
+ Y2Namespace *ns = getNs(namespace_name);
if (ns == NULL)
{
- rb_raise( rb_eRuntimeError, "Component cannot import namespace '%s' for symbol '%s'", RSTRING (namespace_name)->ptr, RSTRING(symbol_str)->ptr );
+ rb_raise( rb_eRuntimeError, "Component cannot import namespace '%s' for symbol '%s'", namespace_name, function_name );
return Qnil;
}
else
@@ -352,32 +417,32 @@
y2internal("Namespace created from %s\n", ns->filename().c_str());
}
- y2internal("Namespace %s initialized\n", RSTRING (namespace_name)->ptr);
+ y2internal("Namespace %s initialized\n", namespace_name);
- TableEntry *sym_te = ns->table()->find (RSTRING(symbol_str)->ptr);
+ TableEntry *sym_te = ns->table()->find(function_name);
if (sym_te == NULL)
{
- y2error ("No such symbol %s::%s", RSTRING (namespace_name)->ptr, RSTRING(symbol_str)->ptr);
- rb_raise( rb_eNameError, "YCP symbol '%s' not found in namespace '%s'", RSTRING(symbol_str)->ptr, RSTRING (namespace_name)->ptr );
+ y2error ("No such symbol %s::%s", namespace_name, function_name);
+ rb_raise( rb_eNameError, "YCP symbol '%s' not found in namespace '%s'", function_name, namespace_name );
return Qnil;
}
if (sym_te->sentry ()->isVariable () ||
sym_te->sentry ()->isReference ())
{
- y2internal ("Variable or reference %s\n", RSTRING(symbol_str)->ptr);
+ y2internal ("Variable or reference %s\n", function_name);
// set the variable
//ret_yv = YCP_getset_variable (aTHX_ ns_name, sym_te->sentry (), args);
}
else
{ // no indent yet
- Y2Function* call = ns->createFunctionCall (RSTRING(symbol_str)->ptr, 0 /*Type::fromSignature("list<string>()")*/);
+ Y2Function* call = ns->createFunctionCall(function_name, 0 /*Type::fromSignature("list<string>()")*/);
if (call == NULL)
{
- y2internal ("cannot create function call %s\n", RSTRING(symbol_str)->ptr);
- rb_raise( rb_eRuntimeError, "can't create call to %s::%s", RSTRING (namespace_name)->ptr, RSTRING(symbol_str)->ptr);
+ y2internal ("cannot create function call %s\n", function_name);
+ rb_raise( rb_eRuntimeError, "can't create call to %s::%s", namespace_name, function_name);
}
// add the parameters
@@ -397,7 +462,14 @@
return Qnil;
}
-YCPValue _call_ycp_builtin ( const string &module_name, const string &func_name, int argc, VALUE *argv )
+
+/*
+ * helper for call_ycp_builtin
+ *
+ */
+
+YCPValue
+_call_ycp_builtin ( const string &module_name, const string &func_name, int argc, VALUE *argv )
{
// access directly the statically declared builtins
extern StaticDeclaration static_declarations;
@@ -411,12 +483,12 @@
if (bi_dt == NULL)
{
y2error ("no such builtin '%s'", qualified_name);
- rb_raise( rb_eRuntimeError, "no YCP builtin %s\n", RSTRING(qualified_name)->ptr);
+ rb_raise( rb_eRuntimeError, "no YCP builtin '%s'", qualified_name);
return YCPNull ();
}
y2milestone("builtin '%s' found.", module_name.c_str());
// construct a builtin call using the proper overloaded builtin
- YEBuiltin *bi_call = new YEBuiltin (bi_dt);
+ YEBuiltin *bi_call = new YEBuiltin(bi_dt);
// attach the parameters:
@@ -492,27 +564,64 @@
return ret_yv;
}
+
VALUE
ycp_module_call_ycp_builtin( int argc, VALUE *argv, VALUE self )
{
+ YCPValue res;
+ VALUE symbol_s;
VALUE symbol = argv[1];
- VALUE namespace_name = argv[0];
+ const char *namespace_name = StringValuePtr(argv[0]);
// the func name (1st argument, is a symbol
// lets convert it to string
- VALUE symbol_str = rb_funcall(symbol, rb_intern("to_s"), 0);
+ symbol_s = rb_funcall(symbol, rb_intern("to_s"), 0);
+ const char *symbol_str = StringValuePtr(symbol_s);
+
+ y2internal("builtin proxy: [%s::%s] is a builtin call with %d params\n", namespace_name, symbol_str, argc);
+ res = _call_ycp_builtin( namespace_name, symbol_str, argc-2, argv+2);
+ return ycpvalue_2_rbvalue(res);
+}
- y2internal("builtin proxy: [%s::%s] is a builtin call with %d params\n", RSTRING(namespace_name)->ptr, RSTRING(symbol_str)->ptr, argc);
+
+/*
+ * YCP::method_missing
+ *
+ */
+
+VALUE
+ycp_method_missing( int argc, VALUE *argv, VALUE self )
+{
+ const char *function_name;
+ VALUE symbol = argv[0];
+
+ if (SYMBOL_P(symbol))
+ function_name = (const char *)rb_id2name( SYM2ID( symbol ) );
+ else
+ function_name = StringValuePtr( symbol );
+
+ y2internal("builtin proxy: [%s] is a builtin call with %d params\n", function_name, argc);
YCPValue res;
- res = _call_ycp_builtin( RSTRING(namespace_name)->ptr, RSTRING(symbol_str)->ptr, argc-2, argv+2);
+ res = _call_ycp_builtin( "", function_name, argc-1, argv+1);
return ycpvalue_2_rbvalue(res);
}
+
+
+/*--------------------------------------------
+ *
+ * Document-module: YaST
+ *
+ * The YaST module gives access to the YaST infrastructure, mostly implemented in the YCP language.
+ *
+ *--------------------------------------------
+ */
+
//y2_logger_helper
//y2_logger (level, comp, file, line, function, "%s", message);
static VALUE
-rb_y2_logger( int argc, VALUE *argv, VALUE self )
+yast_y2_logger( int argc, VALUE *argv, VALUE self )
{
Check_Type(argv[0], T_FIXNUM);
Check_Type(argv[1], T_STRING);
@@ -533,37 +642,56 @@
extern "C"
{
+ /*
+ * Ruby module initializer
+ *
+ * "require 'ycpx'" will call Init_ycpx()
+ */
+
void
Init_ycpx()
{
- YCPPathSearch::initialize ();
- init_wfm();
-
- for ( list<string>::const_iterator it = YCPPathSearch::searchListBegin (YCPPathSearch::Module); it != YCPPathSearch::searchListEnd (YCPPathSearch::Module) ; ++it )
+ YCPPathSearch::initialize();
+
+ /*
+ * Debug: log search pathes
+ */
+ for ( list<string>::const_iterator it = YCPPathSearch::searchListBegin (YCPPathSearch::Module);
+ it != YCPPathSearch::searchListEnd (YCPPathSearch::Module) ; ++it )
{
y2internal("search path %s\n", (*it).c_str() );
}
- rb_mYaST = rb_define_module("YaST");
-
- //rb_mYCP = rb_define_module_under(rb_mYaST, "YCP");
+ /*
+ * module YCP
+ */
rb_mYCP = rb_define_module("YCP");
rb_define_singleton_method( rb_mYCP, "import", RB_METHOD(ycp_module_import), 1);
rb_define_singleton_method( rb_mYCP, "call_ycp_function", RB_METHOD(ycp_module_call_ycp_function), -1);
rb_define_singleton_method( rb_mYCP, "call_ycp_builtin", RB_METHOD(ycp_module_call_ycp_builtin), -1);
+ rb_define_singleton_method( rb_mYCP, "method_missing", RB_METHOD(ycp_method_missing), -1);
rb_define_singleton_method( rb_mYCP, "each_symbol", RB_METHOD(ycp_module_each_symbol), 1);
rb_define_singleton_method( rb_mYCP, "each_builtin_symbol", RB_METHOD(ycp_module_each_builtin_symbol), 1);
rb_define_singleton_method( rb_mYCP, "each_builtin", RB_METHOD(ycp_module_each_builtin), 0);
+ /*
+ * module YCP::Ui
+ */
rb_mUi = rb_define_module_under(rb_mYCP, "Ui");
- rb_define_singleton_method( rb_mUi, "init", RB_METHOD(rb_init_ui), -1);
-
-
- rb_define_method( rb_mYaST, "y2_logger", RB_METHOD(rb_y2_logger), -1);
+ rb_define_singleton_method( rb_mUi, "init", RB_METHOD(ui_init), -1);
+ /*
+ * module YaST
+ */
+ rb_mYaST = rb_define_module("YaST");
+ rb_define_method( rb_mYaST, "logger", RB_METHOD(yast_y2_logger), -1);
+
+ y2internal("ryast_path_init\n");
ryast_path_init(rb_mYaST);
+ y2internal("ryast_term_init\n");
ryast_term_init(rb_mYaST);
+
+ y2internal("Init_ycpx done\n");
}
}
-
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ruby-bindings-0.3.2/src/ruby/ycp.rb new/yast2-ruby-bindings-0.3.3/src/ruby/ycp.rb
--- old/yast2-ruby-bindings-0.3.2/src/ruby/ycp.rb 2008-04-16 17:46:52.000000000 +0200
+++ new/yast2-ruby-bindings-0.3.3/src/ruby/ycp.rb 2009-06-21 20:32:50.000000000 +0200
@@ -21,49 +21,21 @@
# Load the native part (.so)
require 'ycpx'
-module YaST
- def y2_logger_helper(*args)
- level = args.shift
-
- caller[0] =~ /(.+):(\d+):in `([^']+)'/
- y2_logger(level,"Ruby",$1,$2.to_i,"",args[0])
- end
-
- def y2debug(*args)
- y2_logger_helper(0, args)
- end
-
- def y2milestone(*args)
- y2_logger_helper(1, args)
- end
-
- def y2warning(*args)
- y2_logger_helper(2, args)
- end
-
- def y2error(*args)
- y2_logger_helper(3, args)
- end
-
- def y2security(*args)
- y2_logger_helper(4, args)
- end
-
- def y2internal(*args)
- y2_logger_helper(5, args)
- end
-end # module YaST
+#--------------------------------------
+#
+# YCP
+#
module YCP
# inserts a builtin in the
# ycp module
def self.import_builtin(name)
- YCP::each_builtin do |bi, cat|
+ self.each_builtin do |bi, cat|
if name == bi
if cat == :namespace
m = Module.new
- YCP::each_builtin_symbol(bi) do |bs, scat|
+ self.each_builtin_symbol(bi) do |bs, scat|
if scat == :builtin
m.module_eval <<-"END"
def self.#{bs.downcase.to_s}(*args)
@@ -72,7 +44,7 @@
END
end
end # each builtin symbol
- YCP.const_set(bi.to_s, m)
+ self.const_set(bi.to_s, m)
return
else
raise "builtin #{bi} can't be imported (not namespace)"
@@ -85,14 +57,14 @@
# initialize builtins and add them to
# the ycp module
def self.init_builtins
-
+ $stderr.puts "YCP::init_builtins"
end
def self.add_ycp_module(mname)
- #y2internal("tryng to add import #{mname}")
- YCP::import(mname)
+ #y2internal("trying to add import #{mname}")
+ self.import(mname)
m = Module.new
- YCP::each_symbol(mname) do |sname,stype|
+ self.each_symbol(mname) do |sname,stype|
if (stype == :function) and !sname.empty?
m.module_eval <<-"END"
def self.#{sname}(*args)
@@ -101,11 +73,14 @@
END
end # if function
end
- YCP.const_set(mname, m)
+ self.const_set(mname, m)
end
end
-YCP::init_builtins
+#--------------------------------------
+#
+# Kernel
+#
module Kernel
alias require_ require
@@ -123,7 +98,6 @@
begin
YCP::add_ycp_module(ycpns.upcase)
rescue RuntimeError => e
- puts e
YCP::add_ycp_module(ycpns.capitalize)
end
return true
@@ -133,6 +107,11 @@
end
+#--------------------------------------
+#
+# YCP::Ui
+#
+
module YCP
module Ui
#my @e_logging = qw(y2debug y2milestone y2warning y2error y2security y2internal);
@@ -177,8 +156,14 @@
end # end Ui module
end
+
+#--------------------------------------
+#
+# YaST::TermBuilder
+#
+
module YaST
- class TermBuilder
+ class Term
# blank slate
instance_methods.each { |m| undef_method m unless (m =~ /^__|instance_eval$/)}
@@ -216,3 +201,41 @@
end
end # module YaST
+
+#--------------------------------------
+#
+# YaST::logger
+#
+
+module YaST
+ def y2_logger_helper(*args)
+ level = args.shift
+
+ caller[0] =~ /(.+):(\d+):in `([^']+)'/
+ y2_logger(level, "Ruby", $1, $2.to_i, "", args[0])
+ end
+
+ def y2debug(*args)
+ y2_logger_helper(0, args)
+ end
+
+ def y2milestone(*args)
+ y2_logger_helper(1, args)
+ end
+
+ def y2warning(*args)
+ y2_logger_helper(2, args)
+ end
+
+ def y2error(*args)
+ y2_logger_helper(3, args)
+ end
+
+ def y2security(*args)
+ y2_logger_helper(4, args)
+ end
+
+ def y2internal(*args)
+ y2_logger_helper(5, args)
+ end
+end # module YaST
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ruby-bindings-0.3.2/tests/CMakeLists.txt new/yast2-ruby-bindings-0.3.3/tests/CMakeLists.txt
--- old/yast2-ruby-bindings-0.3.2/tests/CMakeLists.txt 1970-01-01 01:00:00.000000000 +0100
+++ new/yast2-ruby-bindings-0.3.3/tests/CMakeLists.txt 2009-06-21 20:32:50.000000000 +0200
@@ -0,0 +1,11 @@
+#
+# CMakeLists.txt for yast2/ruby-bindings/tests
+#
+
+ENABLE_TESTING()
+
+# Ruby -> YaST tests
+ADD_SUBDIRECTORY(ruby)
+
+# YCP -> Ruby tests
+#ADD_SUBDIRECTORY(ycp)
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ruby-bindings-0.3.2/tests/ruby/CMakeLists.txt new/yast2-ruby-bindings-0.3.3/tests/ruby/CMakeLists.txt
--- old/yast2-ruby-bindings-0.3.2/tests/ruby/CMakeLists.txt 1970-01-01 01:00:00.000000000 +0100
+++ new/yast2-ruby-bindings-0.3.3/tests/ruby/CMakeLists.txt 2009-06-21 20:32:50.000000000 +0200
@@ -0,0 +1,10 @@
+#
+# CMakeLists.txt for yast2/ruby-bindings/tests/ruby
+#
+
+ENABLE_TESTING()
+
+ADD_TEST(ruby_loading ruby -C ${CMAKE_CURRENT_SOURCE_DIR} loading.rb)
+ADD_TEST(ycp_iterators ruby -C ${CMAKE_CURRENT_SOURCE_DIR} ycp_iterators.rb)
+ADD_TEST(ycp_import ruby -C ${CMAKE_CURRENT_SOURCE_DIR} ycp_import.rb)
+ADD_TEST(module-arch ruby -C ${CMAKE_CURRENT_SOURCE_DIR} module-arch.rb)
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ruby-bindings-0.3.2/tests/ruby/loading.rb new/yast2-ruby-bindings-0.3.3/tests/ruby/loading.rb
--- old/yast2-ruby-bindings-0.3.2/tests/ruby/loading.rb 1970-01-01 01:00:00.000000000 +0100
+++ new/yast2-ruby-bindings-0.3.3/tests/ruby/loading.rb 2009-06-21 20:32:50.000000000 +0200
@@ -0,0 +1,20 @@
+#
+# Test loading of the bindings
+#
+
+$:.unshift "../../build/src/ruby" # ycpx.so
+$:.unshift "../../src/ruby" # ycp.rb
+
+# test loading of extension
+require 'test/unit'
+
+class LoadTest < Test::Unit::TestCase
+ def test_loadingx
+ require 'ycpx'
+ assert true
+ end
+ def test_loading
+ require 'ycp'
+ assert true
+ end
+end
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ruby-bindings-0.3.2/tests/ruby/module-arch.rb new/yast2-ruby-bindings-0.3.3/tests/ruby/module-arch.rb
--- old/yast2-ruby-bindings-0.3.2/tests/ruby/module-arch.rb 1970-01-01 01:00:00.000000000 +0100
+++ new/yast2-ruby-bindings-0.3.3/tests/ruby/module-arch.rb 2009-06-21 20:32:50.000000000 +0200
@@ -0,0 +1,20 @@
+#
+# Test Arch.ycp
+#
+
+$:.unshift "../../build/src/ruby" # ycpx.so
+$:.unshift "../../src/ruby" # ycp.rb
+
+require 'test/unit'
+
+class ArchTest < Test::Unit::TestCase
+ def test_arch
+ require 'ycp'
+ # testing implicit import of ycp module
+ # see also ycp_import.rb
+ require 'ycp/arch'
+ puts YCP::Arch::sparc32
+ puts YCP::Arch::arch_short
+ puts YCP::Arch::is_xen
+ end
+end
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ruby-bindings-0.3.2/tests/ruby/ycp_import.rb new/yast2-ruby-bindings-0.3.3/tests/ruby/ycp_import.rb
--- old/yast2-ruby-bindings-0.3.2/tests/ruby/ycp_import.rb 1970-01-01 01:00:00.000000000 +0100
+++ new/yast2-ruby-bindings-0.3.3/tests/ruby/ycp_import.rb 2009-06-21 20:32:50.000000000 +0200
@@ -0,0 +1,21 @@
+#
+# Test Ycp.import
+#
+
+$:.unshift "../../build/src/ruby"
+$:.unshift "../../src/ruby"
+
+require 'test/unit'
+require 'ycp'
+
+class YcpTest < Test::Unit::TestCase
+ def test_import
+ assert YCP
+ # testing explicit import of ycp module
+ # see also module-arch.rb
+ assert YCP.import( "Arch" )
+ YCP.each_symbol("Arch") do |sym,cat|
+ puts "Arch::#{sym}"
+ end
+ end
+end
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ruby-bindings-0.3.2/tests/ruby/ycp_iterators.rb new/yast2-ruby-bindings-0.3.3/tests/ruby/ycp_iterators.rb
--- old/yast2-ruby-bindings-0.3.2/tests/ruby/ycp_iterators.rb 1970-01-01 01:00:00.000000000 +0100
+++ new/yast2-ruby-bindings-0.3.3/tests/ruby/ycp_iterators.rb 2009-06-21 20:32:50.000000000 +0200
@@ -0,0 +1,40 @@
+#
+# Test Ycp.each_symbol
+# Test Ycp.each_builtin_symbol
+# Test Ycp.each_builtin
+#
+
+$:.unshift "../../build/src/ruby"
+$:.unshift "../../src/ruby"
+
+require 'test/unit'
+require 'ycp'
+
+class YcpTest < Test::Unit::TestCase
+ def test_each_symbol
+ puts "\ntest_each_symbol\n"
+ YCP.each_symbol("Arch") do |sym,cat|
+ puts "Ycp symbol #{sym}, category #{cat}"
+ end
+ assert true
+ end
+ def test_each_builtin
+ puts "\ntest_each_builtin\n"
+ YCP.each_builtin do |ns, cat|
+ puts "Ycp builtin #{ns}, category #{cat}"
+ if cat == :namespace
+ YCP.each_builtin_symbol(ns) do |sym, cat|
+ puts " #{ns}.#{sym}, category #{cat}"
+ end
+ end
+ end
+ assert true
+ end
+ def test_each_builtin_symbol
+ puts "\ntest_each_builtin_symbol\n"
+ YCP.each_builtin_symbol("float") do |sym, cat|
+ puts "Ycp builtin symbol #{sym}, category #{cat}"
+ end
+ assert true
+ end
+end
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ruby-bindings-0.3.2/VERSION.cmake new/yast2-ruby-bindings-0.3.3/VERSION.cmake
--- old/yast2-ruby-bindings-0.3.2/VERSION.cmake 2008-04-16 17:46:52.000000000 +0200
+++ new/yast2-ruby-bindings-0.3.3/VERSION.cmake 2009-06-21 20:32:50.000000000 +0200
@@ -1,3 +1,3 @@
SET(VERSION_MAJOR "0")
SET(VERSION_MINOR "3")
-SET(VERSION_PATCH "2")
+SET(VERSION_PATCH "3")
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ruby-bindings-0.3.2/yast2-ruby-bindings.spec.in new/yast2-ruby-bindings-0.3.3/yast2-ruby-bindings.spec.in
--- old/yast2-ruby-bindings-0.3.2/yast2-ruby-bindings.spec.in 2008-04-16 17:46:52.000000000 +0200
+++ new/yast2-ruby-bindings-0.3.3/yast2-ruby-bindings.spec.in 2009-06-21 20:32:50.000000000 +0200
@@ -19,16 +19,15 @@
# libzypp-devel is missing .la requires
BuildRequires: ruby-devel
Requires: yast2-core >= 2.16.37
-BuildRequires: yast2-ycp-ui-bindings-devel >= 2.16.37
+BuildRequires: yast2-core-devel >= 2.16.37
Requires: yast2-ycp-ui-bindings >= 2.16.37
+BuildRequires: yast2-ycp-ui-bindings-devel >= 2.16.37
Requires: ruby
-Summary: Ruby bindings for the YaST platform.
+Summary: Ruby bindings for the YaST platform
%description
-The bindings allow YaST modules to be written using the Ruby language and also
-Ruby scripts can use YaST agents, APIs and modules.
-
-Author
+The bindings allow YaST modules to be written using the Ruby language
+and also Ruby scripts can use YaST agents, APIs and modules.
%prep
%setup -n yast2-ruby-bindings-%{version}
@@ -54,9 +53,5 @@
%files
%defattr (-, root, root)
%{_libdir}/YaST2/plugin/libpy2lang_ruby.so
-%{_libdir}/ruby/vendor_ruby/%{rb_ver}/%{rb_arch}/yastx.so
-%{_libdir}/ruby/%{rb_ver}/%{rb_arch}/ycpx.so
-%{_libdir}/ruby/vendor_ruby/%{rb_ver}/yast.rb
%{_libdir}/ruby/vendor_ruby/%{rb_ver}/ycp.rb
-
-
+%{_libdir}/ruby/vendor_ruby/%{rb_ver}/%{rb_arch}/ycpx.so
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org