diff options
author | Diego Elio Pettenò <flameeyes@gentoo.org> | 2010-02-01 16:39:24 +0000 |
---|---|---|
committer | Diego Elio Pettenò <flameeyes@gentoo.org> | 2010-02-01 16:39:24 +0000 |
commit | 25e99df144a4dd7b43b4ff8f12b6788831b3ce41 (patch) | |
tree | da5bb9914173102518b62510c5eca092a4769cc2 /dev-ruby/hpricot | |
parent | Stable on amd64 wrt bug #302733 (diff) | |
download | gentoo-2-25e99df144a4dd7b43b4ff8f12b6788831b3ce41.tar.gz gentoo-2-25e99df144a4dd7b43b4ff8f12b6788831b3ce41.tar.bz2 gentoo-2-25e99df144a4dd7b43b4ff8f12b6788831b3ce41.zip |
Add a patch to fix a big bug on JRuby.
(Portage version: 2.2_rc62/cvs/Linux x86_64)
Diffstat (limited to 'dev-ruby/hpricot')
-rw-r--r-- | dev-ruby/hpricot/ChangeLog | 8 | ||||
-rw-r--r-- | dev-ruby/hpricot/files/hpricot-0.8.2-jruby.patch | 203 | ||||
-rw-r--r-- | dev-ruby/hpricot/hpricot-0.8.2-r1.ebuild | 44 |
3 files changed, 254 insertions, 1 deletions
diff --git a/dev-ruby/hpricot/ChangeLog b/dev-ruby/hpricot/ChangeLog index 98f8f0ff2fa6..e73fc4b3f8c2 100644 --- a/dev-ruby/hpricot/ChangeLog +++ b/dev-ruby/hpricot/ChangeLog @@ -1,6 +1,12 @@ # ChangeLog for dev-ruby/hpricot # Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/dev-ruby/hpricot/ChangeLog,v 1.19 2010/01/16 08:33:22 fauli Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-ruby/hpricot/ChangeLog,v 1.20 2010/02/01 16:39:24 flameeyes Exp $ + +*hpricot-0.8.2-r1 (01 Feb 2010) + + 01 Feb 2010; Diego E. Pettenò <flameeyes@gentoo.org> + +hpricot-0.8.2-r1.ebuild, +files/hpricot-0.8.2-jruby.patch: + Add a patch to fix a big bug on JRuby. 16 Jan 2010; Christian Faulhammer <fauli@gentoo.org> hpricot-0.8.2.ebuild: Transfer Prefix keywords diff --git a/dev-ruby/hpricot/files/hpricot-0.8.2-jruby.patch b/dev-ruby/hpricot/files/hpricot-0.8.2-jruby.patch new file mode 100644 index 000000000000..4c47951ec239 --- /dev/null +++ b/dev-ruby/hpricot/files/hpricot-0.8.2-jruby.patch @@ -0,0 +1,203 @@ +From 26708b9e80110c14a9d9fe7f974fc544f86b702a Mon Sep 17 00:00:00 2001 +From: Ola Bini <ola.bini@gmail.com> +Date: Mon, 1 Feb 2010 16:46:02 +0100 +Subject: [PATCH] Fix bug #11 - sort out some bad casts on JRuby + +--- + ext/hpricot_scan/HpricotScanService.java | 33 +++++++++++++++++++---------- + ext/hpricot_scan/hpricot_scan.java.rl | 33 +++++++++++++++++++---------- + 2 files changed, 42 insertions(+), 24 deletions(-) + +diff --git a/ext/hpricot_scan/HpricotScanService.java b/ext/hpricot_scan/HpricotScanService.java +index d921309..c5fe796 100644 +--- a/ext/hpricot_scan/HpricotScanService.java ++++ b/ext/hpricot_scan/HpricotScanService.java +@@ -139,62 +139,62 @@ public class HpricotScanService implements BasicLibraryService { + + // H_ATTR(target) + public static IRubyObject hpricot_ele_set_target(IRubyObject self, IRubyObject x) { +- ((RubyHash)H_ELE_GET(self, H_ELE_ATTR)).fastASet(self.getRuntime().newSymbol("target"), x); ++ H_ELE_GET_asHash(self, H_ELE_ATTR).fastASet(self.getRuntime().newSymbol("target"), x); + return self; + } + + public static IRubyObject hpricot_ele_get_target(IRubyObject self) { +- return ((RubyHash)H_ELE_GET(self, H_ELE_ATTR)).op_aref(self.getRuntime().getCurrentContext(), self.getRuntime().newSymbol("target")); ++ return H_ELE_GET_asHash(self, H_ELE_ATTR).op_aref(self.getRuntime().getCurrentContext(), self.getRuntime().newSymbol("target")); + } + + // H_ATTR(encoding) + public static IRubyObject hpricot_ele_set_encoding(IRubyObject self, IRubyObject x) { +- ((RubyHash)H_ELE_GET(self, H_ELE_ATTR)).fastASet(self.getRuntime().newSymbol("encoding"), x); ++ ((RubyHash)H_ELE_GET_asHash(self, H_ELE_ATTR)).fastASet(self.getRuntime().newSymbol("encoding"), x); + return self; + } + + public static IRubyObject hpricot_ele_get_encoding(IRubyObject self) { +- return ((RubyHash)H_ELE_GET(self, H_ELE_ATTR)).op_aref(self.getRuntime().getCurrentContext(), self.getRuntime().newSymbol("encoding")); ++ return ((RubyHash)H_ELE_GET_asHash(self, H_ELE_ATTR)).op_aref(self.getRuntime().getCurrentContext(), self.getRuntime().newSymbol("encoding")); + } + + // H_ATTR(version) + public static IRubyObject hpricot_ele_set_version(IRubyObject self, IRubyObject x) { +- ((RubyHash)H_ELE_GET(self, H_ELE_ATTR)).fastASet(self.getRuntime().newSymbol("version"), x); ++ ((RubyHash)H_ELE_GET_asHash(self, H_ELE_ATTR)).fastASet(self.getRuntime().newSymbol("version"), x); + return self; + } + + public static IRubyObject hpricot_ele_get_version(IRubyObject self) { +- return ((RubyHash)H_ELE_GET(self, H_ELE_ATTR)).op_aref(self.getRuntime().getCurrentContext(), self.getRuntime().newSymbol("version")); ++ return ((RubyHash)H_ELE_GET_asHash(self, H_ELE_ATTR)).op_aref(self.getRuntime().getCurrentContext(), self.getRuntime().newSymbol("version")); + } + + // H_ATTR(standalone) + public static IRubyObject hpricot_ele_set_standalone(IRubyObject self, IRubyObject x) { +- ((RubyHash)H_ELE_GET(self, H_ELE_ATTR)).fastASet(self.getRuntime().newSymbol("standalone"), x); ++ ((RubyHash)H_ELE_GET_asHash(self, H_ELE_ATTR)).fastASet(self.getRuntime().newSymbol("standalone"), x); + return self; + } + + public static IRubyObject hpricot_ele_get_standalone(IRubyObject self) { +- return ((RubyHash)H_ELE_GET(self, H_ELE_ATTR)).op_aref(self.getRuntime().getCurrentContext(), self.getRuntime().newSymbol("standalone")); ++ return ((RubyHash)H_ELE_GET_asHash(self, H_ELE_ATTR)).op_aref(self.getRuntime().getCurrentContext(), self.getRuntime().newSymbol("standalone")); + } + + // H_ATTR(system_id) + public static IRubyObject hpricot_ele_set_system_id(IRubyObject self, IRubyObject x) { +- ((RubyHash)H_ELE_GET(self, H_ELE_ATTR)).fastASet(self.getRuntime().newSymbol("system_id"), x); ++ ((RubyHash)H_ELE_GET_asHash(self, H_ELE_ATTR)).fastASet(self.getRuntime().newSymbol("system_id"), x); + return self; + } + + public static IRubyObject hpricot_ele_get_system_id(IRubyObject self) { +- return ((RubyHash)H_ELE_GET(self, H_ELE_ATTR)).op_aref(self.getRuntime().getCurrentContext(), self.getRuntime().newSymbol("system_id")); ++ return ((RubyHash)H_ELE_GET_asHash(self, H_ELE_ATTR)).op_aref(self.getRuntime().getCurrentContext(), self.getRuntime().newSymbol("system_id")); + } + + // H_ATTR(public_id) + public static IRubyObject hpricot_ele_set_public_id(IRubyObject self, IRubyObject x) { +- ((RubyHash)H_ELE_GET(self, H_ELE_ATTR)).fastASet(self.getRuntime().newSymbol("public_id"), x); ++ ((RubyHash)H_ELE_GET_asHash(self, H_ELE_ATTR)).fastASet(self.getRuntime().newSymbol("public_id"), x); + return self; + } + + public static IRubyObject hpricot_ele_get_public_id(IRubyObject self) { +- return ((RubyHash)H_ELE_GET(self, H_ELE_ATTR)).op_aref(self.getRuntime().getCurrentContext(), self.getRuntime().newSymbol("public_id")); ++ return ((RubyHash)H_ELE_GET_asHash(self, H_ELE_ATTR)).op_aref(self.getRuntime().getCurrentContext(), self.getRuntime().newSymbol("public_id")); + } + + public static class Scanner { +@@ -1903,6 +1903,15 @@ case 5: + return ((IRubyObject[])recv.dataGetStruct())[n]; + } + ++ public static RubyHash H_ELE_GET_asHash(IRubyObject recv, int n) { ++ IRubyObject obj = ((IRubyObject[])recv.dataGetStruct())[n]; ++ if(obj.isNil()) { ++ obj = RubyHash.newHash(recv.getRuntime()); ++ ((IRubyObject[])recv.dataGetStruct())[n] = obj; ++ } ++ return (RubyHash)obj; ++ } ++ + public static IRubyObject H_ELE_SET(IRubyObject recv, int n, IRubyObject value) { + ((IRubyObject[])recv.dataGetStruct())[n] = value; + return value; +diff --git a/ext/hpricot_scan/hpricot_scan.java.rl b/ext/hpricot_scan/hpricot_scan.java.rl +index d1fb04b..1821761 100644 +--- a/ext/hpricot_scan/hpricot_scan.java.rl ++++ b/ext/hpricot_scan/hpricot_scan.java.rl +@@ -137,62 +137,62 @@ public class HpricotScanService implements BasicLibraryService { + + // H_ATTR(target) + public static IRubyObject hpricot_ele_set_target(IRubyObject self, IRubyObject x) { +- ((RubyHash)H_ELE_GET(self, H_ELE_ATTR)).fastASet(self.getRuntime().newSymbol("target"), x); ++ H_ELE_GET_asHash(self, H_ELE_ATTR).fastASet(self.getRuntime().newSymbol("target"), x); + return self; + } + + public static IRubyObject hpricot_ele_get_target(IRubyObject self) { +- return ((RubyHash)H_ELE_GET(self, H_ELE_ATTR)).op_aref(self.getRuntime().getCurrentContext(), self.getRuntime().newSymbol("target")); ++ return H_ELE_GET_asHash(self, H_ELE_ATTR).op_aref(self.getRuntime().getCurrentContext(), self.getRuntime().newSymbol("target")); + } + + // H_ATTR(encoding) + public static IRubyObject hpricot_ele_set_encoding(IRubyObject self, IRubyObject x) { +- ((RubyHash)H_ELE_GET(self, H_ELE_ATTR)).fastASet(self.getRuntime().newSymbol("encoding"), x); ++ ((RubyHash)H_ELE_GET_asHash(self, H_ELE_ATTR)).fastASet(self.getRuntime().newSymbol("encoding"), x); + return self; + } + + public static IRubyObject hpricot_ele_get_encoding(IRubyObject self) { +- return ((RubyHash)H_ELE_GET(self, H_ELE_ATTR)).op_aref(self.getRuntime().getCurrentContext(), self.getRuntime().newSymbol("encoding")); ++ return ((RubyHash)H_ELE_GET_asHash(self, H_ELE_ATTR)).op_aref(self.getRuntime().getCurrentContext(), self.getRuntime().newSymbol("encoding")); + } + + // H_ATTR(version) + public static IRubyObject hpricot_ele_set_version(IRubyObject self, IRubyObject x) { +- ((RubyHash)H_ELE_GET(self, H_ELE_ATTR)).fastASet(self.getRuntime().newSymbol("version"), x); ++ ((RubyHash)H_ELE_GET_asHash(self, H_ELE_ATTR)).fastASet(self.getRuntime().newSymbol("version"), x); + return self; + } + + public static IRubyObject hpricot_ele_get_version(IRubyObject self) { +- return ((RubyHash)H_ELE_GET(self, H_ELE_ATTR)).op_aref(self.getRuntime().getCurrentContext(), self.getRuntime().newSymbol("version")); ++ return ((RubyHash)H_ELE_GET_asHash(self, H_ELE_ATTR)).op_aref(self.getRuntime().getCurrentContext(), self.getRuntime().newSymbol("version")); + } + + // H_ATTR(standalone) + public static IRubyObject hpricot_ele_set_standalone(IRubyObject self, IRubyObject x) { +- ((RubyHash)H_ELE_GET(self, H_ELE_ATTR)).fastASet(self.getRuntime().newSymbol("standalone"), x); ++ ((RubyHash)H_ELE_GET_asHash(self, H_ELE_ATTR)).fastASet(self.getRuntime().newSymbol("standalone"), x); + return self; + } + + public static IRubyObject hpricot_ele_get_standalone(IRubyObject self) { +- return ((RubyHash)H_ELE_GET(self, H_ELE_ATTR)).op_aref(self.getRuntime().getCurrentContext(), self.getRuntime().newSymbol("standalone")); ++ return ((RubyHash)H_ELE_GET_asHash(self, H_ELE_ATTR)).op_aref(self.getRuntime().getCurrentContext(), self.getRuntime().newSymbol("standalone")); + } + + // H_ATTR(system_id) + public static IRubyObject hpricot_ele_set_system_id(IRubyObject self, IRubyObject x) { +- ((RubyHash)H_ELE_GET(self, H_ELE_ATTR)).fastASet(self.getRuntime().newSymbol("system_id"), x); ++ ((RubyHash)H_ELE_GET_asHash(self, H_ELE_ATTR)).fastASet(self.getRuntime().newSymbol("system_id"), x); + return self; + } + + public static IRubyObject hpricot_ele_get_system_id(IRubyObject self) { +- return ((RubyHash)H_ELE_GET(self, H_ELE_ATTR)).op_aref(self.getRuntime().getCurrentContext(), self.getRuntime().newSymbol("system_id")); ++ return ((RubyHash)H_ELE_GET_asHash(self, H_ELE_ATTR)).op_aref(self.getRuntime().getCurrentContext(), self.getRuntime().newSymbol("system_id")); + } + + // H_ATTR(public_id) + public static IRubyObject hpricot_ele_set_public_id(IRubyObject self, IRubyObject x) { +- ((RubyHash)H_ELE_GET(self, H_ELE_ATTR)).fastASet(self.getRuntime().newSymbol("public_id"), x); ++ ((RubyHash)H_ELE_GET_asHash(self, H_ELE_ATTR)).fastASet(self.getRuntime().newSymbol("public_id"), x); + return self; + } + + public static IRubyObject hpricot_ele_get_public_id(IRubyObject self) { +- return ((RubyHash)H_ELE_GET(self, H_ELE_ATTR)).op_aref(self.getRuntime().getCurrentContext(), self.getRuntime().newSymbol("public_id")); ++ return ((RubyHash)H_ELE_GET_asHash(self, H_ELE_ATTR)).op_aref(self.getRuntime().getCurrentContext(), self.getRuntime().newSymbol("public_id")); + } + + public static class Scanner { +@@ -965,6 +965,15 @@ public class HpricotScanService implements BasicLibraryService { + return ((IRubyObject[])recv.dataGetStruct())[n]; + } + ++ public static RubyHash H_ELE_GET_asHash(IRubyObject recv, int n) { ++ IRubyObject obj = ((IRubyObject[])recv.dataGetStruct())[n]; ++ if(obj.isNil()) { ++ obj = RubyHash.newHash(recv.getRuntime()); ++ ((IRubyObject[])recv.dataGetStruct())[n] = obj; ++ } ++ return (RubyHash)obj; ++ } ++ + public static IRubyObject H_ELE_SET(IRubyObject recv, int n, IRubyObject value) { + ((IRubyObject[])recv.dataGetStruct())[n] = value; + return value; +-- +1.6.6.1 + diff --git a/dev-ruby/hpricot/hpricot-0.8.2-r1.ebuild b/dev-ruby/hpricot/hpricot-0.8.2-r1.ebuild new file mode 100644 index 000000000000..0d4263736fcc --- /dev/null +++ b/dev-ruby/hpricot/hpricot-0.8.2-r1.ebuild @@ -0,0 +1,44 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-ruby/hpricot/hpricot-0.8.2-r1.ebuild,v 1.1 2010/02/01 16:39:24 flameeyes Exp $ + +EAPI=2 + +USE_RUBY="ruby18 ruby19 jruby" + +RUBY_FAKEGEM_DOCDIR="doc" +RUBY_FAKEGEM_EXTRADOC="CHANGELOG README" + +inherit ruby-fakegem eutils + +DESCRIPTION="A fast and liberal HTML parser for Ruby." +HOMEPAGE="http://wiki.github.com/why/hpricot" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64 ~ppc ~ppc64 ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos ~x86-solaris" +IUSE="" + +# Probably needs the same jdk as JRuby but I'm not sure how to express +# that just yet. +DEPEND="dev-util/ragel + ruby_targets_jruby? ( >=virtual/jdk-1.5 )" + +ruby_add_bdepend dev-ruby/rake +ruby_add_bdepend test virtual/ruby-test-unit + +all_ruby_prepare() { + # Fix issue #11 from upstream + epatch "${FILESDIR}"/${P}-jruby.patch +} + +each_ruby_compile() { + case $(basename ${RUBY}) in + jruby) + ${RUBY} -S rake compile_java || die "rake compile failed" + ;; + *) + ${RUBY} -S rake compile || die "rake compile failed" + ;; + esac +} |