Control: severity -1 serious

Here is a patch that makes ruby-nora build for newer Ruby versions.

However, it doesn't work under Ruby 1.9 due to problems in the Ruby
code. The sample CGI script included in the package (sample/test.cgi)
dies with the following error:

/usr/lib/ruby/vendor_ruby/web/interface.rb:17:in `for_fd': not a socket file 
descriptor (ArgumentError)
  from /usr/lib/ruby/vendor_ruby/web/interface.rb:17:in `<module:Interface>'
  from /usr/lib/ruby/vendor_ruby/web/interface.rb:11:in `<module:Web>'
  from /usr/lib/ruby/vendor_ruby/web/interface.rb:10:in `<top (required)>'
  from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
  from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
  from 
/home/terceiro/src/debian/sprints/2014-ruby-paris/ruby-nora/cgi-bin/test.cgi:4:in
 `<main>'

Note that we need to remove ruby1.8 from the archive soon, please fix
yout package ASAP (otherwise it will be removed together with ruby1.8).

With my Ruby maintainer hat on, I am promoting this bug to serious now.

-- 
Antonio Terceiro <[email protected]>
diff --git a/debian/changelog b/debian/changelog
index 2ff06ad..309e907 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,13 @@
+ruby-nora (1:0.0.20041021-6) UNRELEASED; urgency=medium
+
+  * Add patch porting to Ruby 1.9+
+  * debian/rules: switch to gem2deb
+  * debian/control changes:
+    - replace ruby1.8 with gem2deb in Build-Depends
+    - drop transitional packakge
+
+ -- Antonio Terceiro <[email protected]>  Wed, 15 Jan 2014 11:37:34 +0100
+
 ruby-nora (1:0.0.20041021-5.1) unstable; urgency=low
 
   * Non-maintainer upload.
diff --git a/debian/control b/debian/control
index 4d49cf6..97d2ac2 100644
--- a/debian/control
+++ b/debian/control
@@ -4,9 +4,9 @@ Priority: extra
 Uploaders: Taku YASUI <[email protected]>
 Maintainer: Tatsuki Sugiura <[email protected]>
 DM-Upload-Allowed: yes
-Build-Depends: debhelper (>> 8.0.0), ruby1.8, ruby1.8-dev
+Build-Depends: debhelper (>> 8.0.0), gem2deb
 Standards-Version: 3.9.3
-XS-Ruby-Versions: ruby1.8
+XS-Ruby-Versions: all
 
 Package: ruby-nora
 Provides: libnora-ruby, libnora-ruby1.8
@@ -22,13 +22,3 @@ Description: Web Application Library for ruby
   * Persistent Framework
   * multipart/form-data support
   * Cookie support
-
-Package: libnora-ruby1.8
-Provides: libnora-ruby
-Section: oldlibs
-Priority: extra
-Architecture: all
-Depends: ${misc:Depends}, ruby-nora
-Description: Transitional package for ruby-nora
- This is a transitional package to ease upgrades to the ruby-nora
- package. It can safely be removed.
diff --git a/debian/patches/ruby1.9+-porting.patch b/debian/patches/ruby1.9+-porting.patch
new file mode 100644
index 0000000..9d7b858
--- /dev/null
+++ b/debian/patches/ruby1.9+-porting.patch
@@ -0,0 +1,79 @@
+diff --git a/ext/web/escape_ext/escape_ext.c b/ext/web/escape_ext/escape_ext.c
+index fbbdd0a..71d5c74 100755
+--- a/ext/web/escape_ext/escape_ext.c
++++ b/ext/web/escape_ext/escape_ext.c
+@@ -1,8 +1,8 @@
+ #include "ctype.h"
+ #include "string.h"
+ #include "ruby.h"
+-#include "intern.h"
+-#include "util.h"
++#include "ruby/intern.h"
++#include "ruby/util.h"
+ /*
+  * Web escape CopyRight (c)2002 MoonWolf <[email protected]>
+  */
+@@ -57,8 +57,8 @@ static VALUE webescape_url_escape(VALUE self, VALUE str) {
+ 
+   /* Check_Type(str, T_STRING); */
+   str = rb_obj_as_string(str);
+-  arglen = RSTRING(str)->len;
+-  argstr = RSTRING(str)->ptr;
++  arglen = RSTRING_LEN(str);
++  argstr = RSTRING_PTR(str);
+ 
+   /* get length */
+   retlen = 0;
+@@ -107,8 +107,8 @@ static VALUE webescape_url_unescape(VALUE self, VALUE str) {
+ 
+   /* Check_Type(str, T_STRING); */
+   str = rb_obj_as_string(str);
+-  arglen = RSTRING(str)->len;
+-  argstr = RSTRING(str)->ptr;
++  arglen = RSTRING_LEN(str);
++  argstr = RSTRING_PTR(str);
+ 
+   /* get length */
+   retlen = 0;
+@@ -171,8 +171,8 @@ static VALUE webescape_html_escape(VALUE self, VALUE str) {
+ 
+   /* Check_Type(str, T_STRING); */
+   str = rb_obj_as_string(str);
+-  arglen = RSTRING(str)->len;
+-  argstr = RSTRING(str)->ptr;
++  arglen = RSTRING_LEN(str);
++  argstr = RSTRING_PTR(str);
+ 
+   /* get length */
+   retlen = arglen;
+@@ -271,8 +271,8 @@ static VALUE webescape_html_unescape(int argc, VALUE *argv, VALUE self) {
+   Check_Type(htmlentity, T_HASH);
+   /* Check_Type(str, T_STRING); */
+   str = rb_obj_as_string(str);
+-  arglen = RSTRING(str)->len;
+-  argstr = RSTRING(str)->ptr;
++  arglen = RSTRING_LEN(str);
++  argstr = RSTRING_PTR(str);
+   
+   /* get length */
+   retlen = 0;
+@@ -361,7 +361,7 @@ static VALUE webescape_html_unescape(int argc, VALUE *argv, VALUE self) {
+                 rb_raise(rb_eRangeError, "character entity reference error");
+               }
+                 */
+-              retlen += RSTRING(entity)->len;
++              retlen += RSTRING_LEN(entity);
+             }
+           }
+         }
+@@ -461,8 +461,8 @@ static VALUE webescape_html_unescape(int argc, VALUE *argv, VALUE self) {
+               rb_raise(rb_eRangeError, "character entity reference error");
+               return Qnil;
+             } else {
+-              memcpy(retp, RSTRING(entity)->ptr,RSTRING(entity)->len);
+-              retp += RSTRING(entity)->len;
++              memcpy(retp, RSTRING_PTR(entity),RSTRING_LEN(entity));
++              retp += RSTRING_LEN(entity);
+             }
+           }
+         }
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..a264c3d
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+ruby1.9+-porting.patch
diff --git a/debian/rules b/debian/rules
index 49b9318..2498e60 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,38 +1,9 @@
 #!/usr/bin/make -f
 
-PKGDIR=$(CURDIR)/debian/ruby-nora
-RUBY_CONFIG=ruby$(CUR_RUBYVER) -rrbconfig -e 'print RbConfig::CONFIG[ARGV[0]]'
-SETUP_FILE=install.rb
-SETUP_OPTS=\
-	--site-ruby="`$(RUBY_CONFIG) vendorlibdir`" \
-	--site-ruby-common="`$(RUBY_CONFIG) vendorlibdir`" \
-	--so-dir="`$(RUBY_CONFIG) vendorarchdir`"
-
 %:
-	dh $@
-
-override_dh_auto_clean:
-	rm -rf build
-
-override_dh_auto_configure:
-	mkdir -p build
-	cp -a MANIFEST ext install.rb lib build
-
-override_dh_auto_install: install-1.8
-
-install-1.8: CUR_RUBYVER = 1.8
-install-1.8: install-common
-
-install-common:
-	cd build && \
-		ruby$(CUR_RUBYVER) $(SETUP_FILE) config $(SETUP_OPTS)
-	cd build && \
-		ruby$(CUR_RUBYVER) -Ku $(SETUP_FILE) setup
-	cd build && \
-		ruby$(CUR_RUBYVER) $(SETUP_FILE) install --prefix="$(PKGDIR)"
+	dh $@ --buildsystem=ruby --with ruby
 
 override_dh_installexamples:
 	dh_installexamples
-	find $(PKGDIR)/usr/share -type f -exec chmod 644 {} \;
+	find debian/ruby-nora/usr/share -type f -exec chmod 644 {} \;
 
-.PHONY: install-1.8 install-1.9 install-common

Attachment: signature.asc
Description: Digital signature

Reply via email to