diff options
author | Diego Elio Pettenò <flameeyes@gentoo.org> | 2012-01-25 01:21:18 +0000 |
---|---|---|
committer | Diego Elio Pettenò <flameeyes@gentoo.org> | 2012-01-25 01:21:18 +0000 |
commit | c288c8f14c62ac9300c292e95de9fc3210bbce48 (patch) | |
tree | dfc305572a6af4b6e7cd182c08911644e288cc5f /dev-ruby/hpricot | |
parent | Add ruby19 to the supported targets (with a patch to fix the tests). (diff) | |
download | gentoo-2-c288c8f14c62ac9300c292e95de9fc3210bbce48.tar.gz gentoo-2-c288c8f14c62ac9300c292e95de9fc3210bbce48.tar.bz2 gentoo-2-c288c8f14c62ac9300c292e95de9fc3210bbce48.zip |
Version bump; unbundle fast_xs (for all but JRuby) and add a dependency over it instead.
(Portage version: 2.2.0_alpha84/cvs/Linux x86_64)
Diffstat (limited to 'dev-ruby/hpricot')
-rw-r--r-- | dev-ruby/hpricot/ChangeLog | 12 | ||||
-rw-r--r-- | dev-ruby/hpricot/files/hpricot-0.8.2-jruby.patch | 203 | ||||
-rw-r--r-- | dev-ruby/hpricot/files/hpricot-0.8.6-fast_xs.patch | 24 | ||||
-rw-r--r-- | dev-ruby/hpricot/hpricot-0.8.6.ebuild | 75 |
4 files changed, 109 insertions, 205 deletions
diff --git a/dev-ruby/hpricot/ChangeLog b/dev-ruby/hpricot/ChangeLog index 1275b1edf244..ffe69ddaf9ec 100644 --- a/dev-ruby/hpricot/ChangeLog +++ b/dev-ruby/hpricot/ChangeLog @@ -1,6 +1,14 @@ # ChangeLog for dev-ruby/hpricot -# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/dev-ruby/hpricot/ChangeLog,v 1.34 2011/12/27 07:52:31 graaff Exp $ +# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/dev-ruby/hpricot/ChangeLog,v 1.35 2012/01/25 01:21:18 flameeyes Exp $ + +*hpricot-0.8.6 (25 Jan 2012) + + 25 Jan 2012; Diego E. Pettenò <flameeyes@gentoo.org> + +files/hpricot-0.8.6-fast_xs.patch, +hpricot-0.8.6.ebuild, + -files/hpricot-0.8.2-jruby.patch: + Version bump; unbundle fast_xs (for all but JRuby) and add a dependency over + it instead. *hpricot-0.8.5 (27 Dec 2011) diff --git a/dev-ruby/hpricot/files/hpricot-0.8.2-jruby.patch b/dev-ruby/hpricot/files/hpricot-0.8.2-jruby.patch deleted file mode 100644 index 4c47951ec239..000000000000 --- a/dev-ruby/hpricot/files/hpricot-0.8.2-jruby.patch +++ /dev/null @@ -1,203 +0,0 @@ -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/files/hpricot-0.8.6-fast_xs.patch b/dev-ruby/hpricot/files/hpricot-0.8.6-fast_xs.patch new file mode 100644 index 000000000000..0b16b6c61b93 --- /dev/null +++ b/dev-ruby/hpricot/files/hpricot-0.8.6-fast_xs.patch @@ -0,0 +1,24 @@ +Index: hpricot-0.8.6/metadata +=================================================================== +--- hpricot-0.8.6.orig/metadata ++++ hpricot-0.8.6/metadata +@@ -16,7 +16,18 @@ bindir: bin + cert_chain: [] + + date: 2012-01-17 00:00:00 Z +-dependencies: [] ++dependencies: ++- !ruby/object:Gem::Dependency ++ name: fast_xs ++ prerelease: false ++ requirement: &id003 !ruby/object:Gem::Requirement ++ none: false ++ requirements: ++ - - ">=" ++ - !ruby/object:Gem::Version ++ version: 0.7.3 ++ type: :runtime ++ version_requirements: *id003 + + description: a swift, liberal HTML parser with a fantastic library + email: why@ruby-lang.org diff --git a/dev-ruby/hpricot/hpricot-0.8.6.ebuild b/dev-ruby/hpricot/hpricot-0.8.6.ebuild new file mode 100644 index 000000000000..5fdffc33c757 --- /dev/null +++ b/dev-ruby/hpricot/hpricot-0.8.6.ebuild @@ -0,0 +1,75 @@ +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-ruby/hpricot/hpricot-0.8.6.ebuild,v 1.1 2012/01/25 01:21:18 flameeyes Exp $ + +EAPI=2 + +USE_RUBY="ruby18 ree18 ruby19 jruby" + +RUBY_FAKEGEM_DOCDIR="doc" +RUBY_FAKEGEM_EXTRADOC="CHANGELOG README.md" + +inherit ruby-fakegem eutils + +DESCRIPTION="A fast and liberal HTML parser for Ruby." +HOMEPAGE="http://wiki.github.com/hpricot/hpricot" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64 ~ia64 ~ppc ~ppc64 ~sparc ~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="${DEPEND} + dev-util/ragel + ruby_targets_jruby? ( >=virtual/jdk-1.5 )" +RDEPEND="${RDEPEND}" + +ruby_add_bdepend "dev-ruby/rake + dev-ruby/rake-compiler + test? ( virtual/ruby-test-unit )" + +# dev-ruby/fast_xs does not cover JRuby so still bundle it here for now +RUBY_TARGETS="${RUBY_TARGETS/jruby/}" \ + ruby_add_rdepend="dev-ruby/fast_xs" + +all_ruby_prepare() { + sed -i -e '/[Bb]undler/ s:^:#:' Rakefile || die + + # Fix encoding assumption of environment for Ruby 1.9. + # https://github.com/hpricot/hpricot/issues/52 + # sed -i -e '1 iEncoding.default_external=Encoding::UTF_8 if RUBY_VERSION =~ /1.9/' test/load_files.rb || die +} + +each_ruby_prepare() { + # dev-ruby/fast_xs does not cover JRuby so still bundle it here for now + [[ ${RUBY} == */jruby ]] && continue + + pushd .. &>/dev/null + epatch "${FILESDIR}"/${P}-fast_xs.patch + popd .. &>/dev/null +} + +each_ruby_configure() { + # dev-ruby/fast_xs does not cover JRuby so still bundle it here for now + if [[ ${RUBY} == */jruby ]]; then + ${RUBY} -Cext/fast_xs extconf.rb || die "fast_xs/extconf.rb failed" + fi + + ${RUBY} -Cext/hpricot_scan extconf.rb || die "hpricot_scan/extconf.rb failed" +} + +each_ruby_compile() { + local modname=$(get_modname) + + # dev-ruby/fast_xs does not cover JRuby so still bundle it here for now + if [[ ${RUBY} == */jruby ]]; then + modname=".jar" + emake -Cext/fast_xs || die "make fast_xs failed" + cp ext/fast_xs/fast_xs.jar lib/ || die + fi + + emake -Cext/hpricot_scan CFLAGS="${CFLAGS} -fPIC" archflag="${LDFLAGS}" || die "make hpricot_scan failed" + cp ext/hpricot_scan/hpricot_scan${modname} lib/ || die +} |