[DRE-commits] [SCM] ruby-mkrf.git branch, master, updated. debian/0.2.3+dfsg-1-7-g0a0e804

Cédric Boutillier cedric.boutillier at gmail.com
Wed Jul 4 12:07:33 UTC 2012


The following commit has been merged in the master branch:
commit 0d155ad180a1a669cba428c99e9d4ad118b23416
Author: Cédric Boutillier <cedric.boutillier at gmail.com>
Date:   Wed Jul 4 12:31:24 2012 +0200

    add 0600_fix_test_libxml.patch and 0610_fix_test_syck.patch (Closes: #676204)

diff --git a/debian/patches/0600_fix_test_libxml.patch b/debian/patches/0600_fix_test_libxml.patch
new file mode 100644
index 0000000..4af237f
--- /dev/null
+++ b/debian/patches/0600_fix_test_libxml.patch
@@ -0,0 +1,150 @@
+Description: Port code from libxml example to Ruby1.9
+Author: Cédric Boutillier <cedric.boutillier at gmail.com>
+Last-Update: 2012-07-04
+
+--- a/test/sample_files/libxml-ruby-0.3.8/ext/xml/extconf.rb
++++ b/test/sample_files/libxml-ruby-0.3.8/ext/xml/extconf.rb
+@@ -5,7 +5,7 @@
+   exit 1
+ end
+ 
+-Mkrf::Generator.new('libxml_so', '*.c') do |g|
++Mkrf::Generator.new('libxml_so', ['*.c']) do |g|
+ 
+   g.include_library('socket','socket')
+   g.include_library('nsl','gethostbyname')
+@@ -46,4 +46,4 @@
+     crash('Need docbCreateFileParserCtxt')
+   end
+ 
+-end
+\ No newline at end of file
++end
+--- a/test/sample_files/libxml-ruby-0.3.8/ext/xml/libxml.h
++++ b/test/sample_files/libxml-ruby-0.3.8/ext/xml/libxml.h
+@@ -13,8 +13,13 @@
+ #define RUBY_LIBXML_VER_MIC   8
+ 
+ #include <ruby.h>
++#if RUBY_INTERN_H
++#include <ruby/backward/rubyio.h>
++#include <ruby/util.h>
++#else
+ #include <rubyio.h>
+ #include <util.h>
++#endif
+ #include <libxml/parser.h>
+ #include <libxml/parserInternals.h>
+ #include <libxml/debugXML.h>
+--- a/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_document.c
++++ b/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_document.c
+@@ -138,7 +138,7 @@
+  */
+ VALUE
+ ruby_xml_document_dump(int argc, VALUE *argv, VALUE self) {
+-  OpenFile *fptr;
++  rb_io_t *fptr;
+   VALUE io;
+   FILE *out;
+   ruby_xml_document *rxd;
+@@ -177,7 +177,7 @@
+ VALUE
+ ruby_xml_document_debug_dump(int argc, VALUE *argv, VALUE self) {
+ #ifdef LIBXML_DEBUG_ENABLED
+-  OpenFile *fptr;
++  rb_io_t *fptr;
+   VALUE io;
+   FILE *out;
+   ruby_xml_document *rxd;
+@@ -221,7 +221,7 @@
+ VALUE
+ ruby_xml_document_debug_dump_head(int argc, VALUE *argv, VALUE self) {
+ #ifdef LIBXML_DEBUG_ENABLED
+-  OpenFile *fptr;
++  rb_io_t *fptr;
+   VALUE io;
+   FILE *out;
+   ruby_xml_document *rxd;
+@@ -266,7 +266,7 @@
+  */
+ VALUE
+ ruby_xml_document_format_dump(int argc, VALUE *argv, VALUE self) {
+-  OpenFile *fptr;
++  rb_io_t *fptr;
+   VALUE bool, io;
+   FILE *out;
+   ruby_xml_document *rxd;
+--- a/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_xpath.c
++++ b/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_xpath.c
+@@ -163,31 +163,31 @@
+       ruby_xml_xpath_context_register_namespace(xxpc, rprefix, ruri);
+       break;
+     case T_ARRAY:
+-      for (i = 0; i < RARRAY(argv[2])->len; i++) {
+-	switch (TYPE(RARRAY(argv[2])->ptr[i])) {
++      for (i = 0; i < RARRAY_LEN(argv[2]); i++) {
++	switch (TYPE(RARRAY_PTR(argv[2])[i])) {
+ 	case T_STRING:
+-	  cp = strchr(StringValuePtr(RARRAY(argv[2])->ptr[i]), (int)':');
++	  cp = strchr(StringValuePtr(RARRAY_PTR(argv[2])[i]), (int)':');
+ 	  if (cp == NULL) {
+-	    rprefix = RARRAY(argv[2])->ptr[i];
++	    rprefix = RARRAY_PTR(argv[2])[i];
+ 	    ruri = Qnil;
+ 	  } else {
+-	    rprefix = rb_str_new(StringValuePtr(RARRAY(argv[2])->ptr[i]), (int)((long)cp - (long)StringValuePtr(RARRAY(argv[2])->ptr[i])));
++	    rprefix = rb_str_new(StringValuePtr(RARRAY_PTR(argv[2])[i]), (int)((long)cp - (long)StringValuePtr(RARRAY_PTR(argv[2])[i])));
+ 	    ruri = rb_str_new2(&cp[1]);
+ 	  }
+ 	  /* Should test the results of this */
+ 	  ruby_xml_xpath_context_register_namespace(xxpc, rprefix, ruri);
+ 	  break;
+ 	case T_ARRAY:
+-	  if (RARRAY(RARRAY(argv[2])->ptr[i])->len == 2) {
+-	    rprefix = RARRAY(RARRAY(argv[2])->ptr[i])->ptr[0];
+-	    ruri = RARRAY(RARRAY(argv[2])->ptr[i])->ptr[1];
++	  if (RARRAY_LEN(RARRAY_PTR(argv[2])[i]) == 2) {
++	    rprefix = RARRAY_PTR(RARRAY_PTR(argv[2])[i])[0];
++	    ruri = RARRAY_PTR(RARRAY_PTR(argv[2])[i])[1];
+ 	    ruby_xml_xpath_context_register_namespace(xxpc, rprefix, ruri);
+ 	  } else {
+ 	    rb_raise(rb_eArgError, "nested array must be an array of strings, prefix and href/uri");
+ 	  }
+ 	  break;
+ 	default:
+-	  if (rb_obj_is_kind_of(RARRAY(argv[2])->ptr[i], cXMLNS) == Qtrue) {
++	  if (rb_obj_is_kind_of(RARRAY_PTR(argv[2])[i], cXMLNS) == Qtrue) {
+ 	    Data_Get_Struct(argv[2], ruby_xml_ns, rxns);
+ 	    rprefix = rb_str_new2((const char*)rxns->ns->prefix);
+ 	    ruri = rb_str_new2((const char*)rxns->ns->href);
+--- a/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_parser.c
++++ b/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_parser.c
+@@ -895,7 +895,7 @@
+   ruby_xml_parser *rxp;
+   ruby_xml_parser_context *rxpc;
+   rx_io_data *data;
+-  OpenFile *fptr;
++  rb_io_t *fptr;
+   FILE *f;
+ 
+   if (!rb_obj_is_kind_of(io, rb_cIO))
+@@ -1214,7 +1214,7 @@
+   data->str = str;
+ 
+   Data_Get_Struct(rxp->ctxt, ruby_xml_parser_context, rxpc);
+-  rxpc->ctxt = xmlCreateMemoryParserCtxt(StringValuePtr(data->str), RSTRING(data->str)->len);
++  rxpc->ctxt = xmlCreateMemoryParserCtxt(StringValuePtr(data->str), RSTRING_LEN(data->str));
+ 
+   return(data->str);
+ }
+--- a/test/sample_files/libxml-ruby-0.3.8/ext/xml/libxml.c
++++ b/test/sample_files/libxml-ruby-0.3.8/ext/xml/libxml.c
+@@ -5,7 +5,7 @@
+ #include "libxml.h"
+ 
+ /* Ruby's util.h has ruby_strdup */
+-#include "util.h"
++//#include "util.h"
+ 
+ #ifdef xmlMalloc
+ #undef xmlMalloc
diff --git a/debian/patches/0610_fix_test_syck.patch b/debian/patches/0610_fix_test_syck.patch
new file mode 100644
index 0000000..d39680e
--- /dev/null
+++ b/debian/patches/0610_fix_test_syck.patch
@@ -0,0 +1,190 @@
+Description: Port syck example to Ruby1.9
+Author: Cédric Boutillier <cedric.boutillier at gmail.com>
+Last-Update: 2012-07-04
+
+--- a/test/sample_files/syck-0.55/ext/ruby/ext/syck/extconf.rb
++++ b/test/sample_files/syck-0.55/ext/ruby/ext/syck/extconf.rb
+@@ -5,5 +5,9 @@
+ end
+ 
+ Mkrf::Generator.new('syck') do |g|
+-  g.include_header("st.h")
++  if RUBY_VERSION =~ /1\.9/
++    g.include_header("ruby/backward/st.h")
++  else
++    g.include_header("st.h")
++  end
+ end
+--- a/test/sample_files/syck-0.55/lib/syck.h
++++ b/test/sample_files/syck-0.55/lib/syck.h
+@@ -20,6 +20,8 @@
+ #include <ctype.h>
+ #ifdef HAVE_ST_H
+ #include <st.h>
++#elif HAVE_RUBY_BACKWARD_ST_H
++#include <ruby/backward/st.h>
+ #else
+ #include "syck_st.h"
+ #endif
+--- a/test/sample_files/syck-0.55/ext/ruby/ext/syck/rubyext.c
++++ b/test/sample_files/syck-0.55/ext/ruby/ext/syck/rubyext.c
+@@ -154,8 +154,8 @@
+         if (!NIL_P(str2))
+         {
+             StringValue(str2);
+-            len = RSTRING(str2)->len;
+-            memcpy( buf + skip, RSTRING(str2)->ptr, len );
++            len = RSTRING_LEN(str2);
++            memcpy( buf + skip, RSTRING_PTR(str2), len );
+         }
+     }
+     len += skip;
+@@ -177,7 +177,7 @@
+     if (!NIL_P(tmp = rb_check_string_type(port))) {
+         taint = OBJ_TAINTED(port); /* original taintedness */
+         port = tmp;
+-        syck_parser_str( parser, RSTRING(port)->ptr, RSTRING(port)->len, NULL );
++        syck_parser_str( parser, RSTRING_PTR(port), RSTRING_LEN(port), NULL );
+     }
+     else if (rb_respond_to(port, s_read)) {
+         if (rb_respond_to(port, s_binmode)) {
+@@ -634,7 +634,7 @@
+     if ( bonus->taint)      OBJ_TAINT( obj );
+     if ( bonus->proc != 0 ) rb_funcall(bonus->proc, s_call, 1, obj);
+ 
+-    rb_hash_aset(bonus->data, INT2FIX(RHASH(bonus->data)->tbl->num_entries), obj);
++    rb_hash_aset(bonus->data, INT2FIX(RHASH_TBL(bonus->data)->num_entries), obj);
+     return obj;
+ }
+ 
+@@ -1032,10 +1032,10 @@
+     VALUE ivname = rb_ary_entry( vars, 0 );
+     char *ivn;
+     StringValue( ivname );
+-    ivn = S_ALLOC_N( char, RSTRING(ivname)->len + 2 );
++    ivn = S_ALLOC_N( char, RSTRING_LEN(ivname) + 2 );
+     ivn[0] = '@';
+     ivn[1] = '\0';
+-    strncat( ivn, RSTRING(ivname)->ptr, RSTRING(ivname)->len );
++    strncat( ivn, RSTRING_PTR(ivname), RSTRING_LEN(ivname) );
+     rb_iv_set( obj, ivn, rb_ary_entry( vars, 1 ) );
+     S_FREE( ivn );
+     return Qnil;
+@@ -1051,7 +1051,7 @@
+     VALUE tclass = rb_cObject;
+     VALUE tparts = rb_str_split( const_name, "::" );
+     int i = 0;
+-    for ( i = 0; i < RARRAY(tparts)->len; i++ ) {
++    for ( i = 0; i < RARRAY_LEN(tparts); i++ ) {
+         VALUE tpart = rb_to_id( rb_ary_entry( tparts, i ) );
+         if ( !rb_const_defined( tclass, tpart ) ) return Qnil;
+         tclass = rb_const_get( tclass, tpart );
+@@ -1066,12 +1066,12 @@
+ syck_resolver_transfer( self, type, val )
+     VALUE self, type, val;
+ {
+-    if (NIL_P(type) || RSTRING(StringValue(type))->len == 0) 
++    if (NIL_P(type) || RSTRING_LEN(StringValue(type)) == 0) 
+     {
+         type = rb_funcall( self, s_detect_implicit, 1, val );
+     }
+ 
+-    if ( ! (NIL_P(type) || RSTRING(StringValue(type))->len == 0) )
++    if ( ! (NIL_P(type) || RSTRING_LEN(StringValue(type)) == 0) )
+     {
+         VALUE str_xprivate = rb_str_new2( "x-private" );
+         VALUE colon = rb_str_new2( ":" );
+@@ -1088,7 +1088,7 @@
+             VALUE subclass_parts = rb_ary_new();
+             VALUE parts = rb_str_split( type, ":" );
+ 
+-            while ( RARRAY(parts)->len > 1 )
++            while ( RARRAY_LEN(parts) > 1 )
+             {
+                 VALUE partial;
+                 rb_ary_unshift( subclass_parts, rb_ary_pop( parts ) );
+@@ -1106,7 +1106,7 @@
+                 if ( ! NIL_P( target_class ) )
+                 {
+                     subclass = target_class;
+-                    if ( RARRAY(subclass_parts)->len > 0 && rb_respond_to( target_class, s_tag_subclasses ) &&
++                    if ( RARRAY_LEN(subclass_parts) > 0 && rb_respond_to( target_class, s_tag_subclasses ) &&
+                          RTEST( rb_funcall( target_class, s_tag_subclasses, 0 ) ) )
+                     {
+                         VALUE subclass_v;
+@@ -1121,7 +1121,7 @@
+                         else if ( rb_cObject == target_class && subclass_v == Qnil )
+                         {
+                             // StringValue(subclass);
+-                            // printf( "No class: %s\n", RSTRING(subclass)->ptr );
++                            // printf( "No class: %s\n", RSTRING_PTR(subclass) );
+                             target_class = cYObject;
+                             type = subclass;
+                             subclass = cYObject;
+@@ -1194,7 +1194,7 @@
+     {
+         char *taguri;
+         val = tmp;
+-        taguri = syck_type_id_to_uri( RSTRING(val)->ptr );
++        taguri = syck_type_id_to_uri( RSTRING_PTR(val) );
+         return rb_str_new2( taguri );
+     }
+ 
+@@ -1214,7 +1214,7 @@
+     if ( !NIL_P(tmp) )
+     {
+         val = tmp;
+-        type_id = syck_match_implicit( RSTRING(val)->ptr, RSTRING(val)->len );
++        type_id = syck_match_implicit( RSTRING_PTR(val), RSTRING_LEN(val) );
+         return rb_str_new2( type_id );
+     }
+ 
+@@ -1517,8 +1517,8 @@
+     Data_Get_Struct( self, SyckNode, node );
+ 
+     StringValue( val );
+-    node->data.str->ptr = RSTRING(val)->ptr;
+-    node->data.str->len = RSTRING(val)->len;
++    node->data.str->ptr = RSTRING_PTR(val);
++    node->data.str->len = RSTRING_LEN(val);
+     node->data.str->style = scalar_none;
+ 
+     rb_iv_set( self, "@value", val );
+@@ -1571,7 +1571,7 @@
+     if ( !NIL_P( val ) ) {
+         int i;
+         syck_seq_empty( node );
+-        for ( i = 0; i < RARRAY( val )->len; i++ )
++        for ( i = 0; i < RARRAY_LEN( val ); i++ )
+         {
+             syck_seq_add( node, rb_ary_entry(val, i) );
+         }
+@@ -1660,7 +1660,7 @@
+         }
+ 
+         keys = rb_funcall( hsh, s_keys, 0 );
+-        for ( i = 0; i < RARRAY(keys)->len; i++ )
++        for ( i = 0; i < RARRAY_LEN(keys); i++ )
+         {
+             VALUE key = rb_ary_entry(keys, i);
+             syck_map_add( node, key, rb_hash_aref(hsh, key) );
+@@ -1696,7 +1696,7 @@
+ 
+         syck_map_empty( node );
+         keys = rb_funcall( hsh, s_keys, 0 );
+-        for ( i = 0; i < RARRAY(keys)->len; i++ )
++        for ( i = 0; i < RARRAY_LEN(keys); i++ )
+         {
+             VALUE key = rb_ary_entry(keys, i);
+             syck_map_add( node, key, rb_hash_aref(hsh, key) );
+--- a/test/sample_files/syck-0.55/ext/ruby/ext/syck/syck.h
++++ b/test/sample_files/syck-0.55/ext/ruby/ext/syck/syck.h
+@@ -20,6 +20,8 @@
+ #include <ctype.h>
+ #ifdef HAVE_ST_H
+ #include <st.h>
++#elif HAVE_RUBY_BACKWARD_ST_H
++#include <ruby/backward/st.h>
+ #else
+ #include "syck_st.h"
+ #endif

-- 
ruby-mkrf.git



More information about the Pkg-ruby-extras-commits mailing list