From c69ef444565894e8cae36f16a6098259365376dd Mon Sep 17 00:00:00 2001 From: Richard Brown Date: Thu, 11 Oct 2007 18:06:30 +0000 Subject: Add rexml patch svn path=/; revision=63 --- dev-lang/ruby/files/ruby-1.8.6_p110-rexml.patch | 312 ++++++++++++++++++++++++ dev-lang/ruby/ruby-1.8.6_p110-r2.ebuild | 179 ++++++++++++++ 2 files changed, 491 insertions(+) create mode 100644 dev-lang/ruby/files/ruby-1.8.6_p110-rexml.patch create mode 100644 dev-lang/ruby/ruby-1.8.6_p110-r2.ebuild diff --git a/dev-lang/ruby/files/ruby-1.8.6_p110-rexml.patch b/dev-lang/ruby/files/ruby-1.8.6_p110-rexml.patch new file mode 100644 index 0000000..51867ef --- /dev/null +++ b/dev-lang/ruby/files/ruby-1.8.6_p110-rexml.patch @@ -0,0 +1,312 @@ +Index: lib/rexml/parsers/baseparser.rb +=================================================================== +--- lib/rexml/parsers/baseparser.rb (revision 13599) ++++ lib/rexml/parsers/baseparser.rb (revision 13600) +@@ -1,5 +1,6 @@ + require 'rexml/parseexception' + require 'rexml/source' ++require 'set' + + module REXML + module Parsers +@@ -24,7 +25,8 @@ + # Nat Price gave me some good ideas for the API. + class BaseParser + NCNAME_STR= '[\w:][\-\w\d.]*' +- NAME_STR= "(?:#{NCNAME_STR}:)?#{NCNAME_STR}" ++ NAME_STR= "(?:(#{NCNAME_STR}):)?(#{NCNAME_STR})" ++ UNAME_STR= "(?:#{NCNAME_STR}:)?#{NCNAME_STR}" + + NAMECHAR = '[\-\w\d\.:]' + NAME = "([\\w:]#{NAMECHAR}*)" +@@ -35,7 +37,7 @@ + + DOCTYPE_START = /\A\s*)/um +- ATTRIBUTE_PATTERN = /\s*(#{NAME_STR})\s*=\s*(["'])(.*?)\2/um ++ ATTRIBUTE_PATTERN = /\s*(#{NAME_STR})\s*=\s*(["'])(.*?)\4/um + COMMENT_START = /\A/um + CDATA_START = /\A/um + INSTRUCTION_START = /\A<\?/u + INSTRUCTION_PATTERN = /<\?(.*?)(\s+.*?)?\?>/um +- TAG_MATCH = /^<((?>#{NAME_STR}))\s*((?>\s+#{NAME_STR}\s*=\s*(["']).*?\3)*)\s*(\/)?>/um ++ TAG_MATCH = /^<((?>#{NAME_STR}))\s*((?>\s+#{UNAME_STR}\s*=\s*(["']).*?\5)*)\s*(\/)?>/um + CLOSE_MATCH = /^\s*<\/(#{NAME_STR})\s*>/um + + VERSION = /\bversion\s*=\s*["'](.*?)['"]/um +@@ -133,6 +135,7 @@ + @tags = [] + @stack = [] + @entities = [] ++ @nsstack = [] + end + + def position +@@ -213,6 +216,7 @@ + return [ :processing_instruction, *@source.match(INSTRUCTION_PATTERN, true)[1,2] ] + when DOCTYPE_START + md = @source.match( DOCTYPE_PATTERN, true ) ++ @nsstack.unshift(curr_ns=Set.new) + identity = md[1] + close = md[2] + identity =~ IDENTITY +@@ -288,6 +292,9 @@ + val = attdef[3] + val = attdef[4] if val == "#FIXED " + pairs[attdef[0]] = val ++ if attdef[0] =~ /^xmlns:(.*)/ ++ @nsstack[0] << $1 ++ end + end + end + return [ :attlistdecl, element, pairs, contents ] +@@ -312,6 +319,7 @@ + begin + if @source.buffer[0] == ?< + if @source.buffer[1] == ?/ ++ @nsstack.shift + last_tag = @tags.pop + #md = @source.match_to_consume( '>', CLOSE_MATCH) + md = @source.match( CLOSE_MATCH, true ) +@@ -345,19 +353,47 @@ + raise REXML::ParseException.new("missing attribute quote", @source) if @source.match(MISSING_ATTRIBUTE_QUOTES ) + raise REXML::ParseException.new("malformed XML: missing tag start", @source) + end +- attrs = [] +- if md[2].size > 0 +- attrs = md[2].scan( ATTRIBUTE_PATTERN ) ++ attributes = {} ++ prefixes = Set.new ++ prefixes << md[2] if md[2] ++ @nsstack.unshift(curr_ns=Set.new) ++ if md[4].size > 0 ++ attrs = md[4].scan( ATTRIBUTE_PATTERN ) + raise REXML::ParseException.new( "error parsing attributes: [#{attrs.join ', '}], excess = \"#$'\"", @source) if $' and $'.strip.size > 0 ++ attrs.each { |a,b,c,d,e| ++ if b == "xmlns" ++ if c == "xml" ++ if d != "http://www.w3.org/XML/1998/namespace" ++ msg = "The 'xml' prefix must not be bound to any other namespace "+ ++ "(http://www.w3.org/TR/REC-xml-names/#ns-decl)" ++ raise REXML::ParseException.new( msg, @source, self ) ++ end ++ elsif c == "xmlns" ++ msg = "The 'xmlns' prefix must not be declared "+ ++ "(http://www.w3.org/TR/REC-xml-names/#ns-decl)" ++ raise REXML::ParseException.new( msg, @source, self) ++ end ++ curr_ns << c ++ elsif b ++ prefixes << b unless b == "xml" ++ end ++ attributes[a] = e ++ } + end + +- if md[4] ++ # Verify that all of the prefixes have been defined ++ for prefix in prefixes ++ unless @nsstack.find{|k| k.member?(prefix)} ++ raise UndefinedNamespaceException.new(prefix,@source,self) ++ end ++ end ++ ++ if md[6] + @closed = md[1] ++ @nsstack.shift + else + @tags.push( md[1] ) + end +- attributes = {} +- attrs.each { |a,b,c| attributes[a] = c } + return [ :start_element, md[1], attributes ] + end + else +@@ -371,6 +407,8 @@ + # return PullEvent.new( :text, md[1], unnormalized ) + return [ :text, md[1] ] + end ++ rescue REXML::UndefinedNamespaceException ++ raise + rescue REXML::ParseException + raise + rescue Exception, NameError => error +Index: lib/rexml/parsers/treeparser.rb +=================================================================== +--- lib/rexml/parsers/treeparser.rb (revision 13599) ++++ lib/rexml/parsers/treeparser.rb (revision 13600) +@@ -29,8 +29,7 @@ + return + when :start_element + tag_stack.push(event[1]) +- # find the observers for namespaces +- @build_context = @build_context.add_element( event[1], event[2] ) ++ el = @build_context = @build_context.add_element( event[1], event[2] ) + when :end_element + tag_stack.pop + @build_context = @build_context.parent +@@ -86,6 +85,8 @@ + end + rescue REXML::Validation::ValidationException + raise ++ rescue REXML::UndefinedNamespaceException ++ raise + rescue + raise ParseException.new( $!.message, @parser.source, @parser, $! ) + end +Index: lib/rexml/document.rb +=================================================================== +--- lib/rexml/document.rb (revision 13599) ++++ lib/rexml/document.rb (revision 13600) +@@ -66,6 +66,7 @@ + def add( child ) + if child.kind_of? XMLDecl + @children.unshift child ++ child.parent = self + elsif child.kind_of? DocType + # Find first Element or DocType node and insert the decl right + # before it. If there is no such node, just insert the child at the +@@ -183,7 +184,7 @@ + output = Output.new( output, xml_decl.encoding ) + end + formatter = if indent > -1 +- if transitive ++ if trans + REXML::Formatters::Transitive.new( indent, ie_hack ) + else + REXML::Formatters::Pretty.new( indent, ie_hack ) +Index: lib/rexml/element.rb +=================================================================== +--- lib/rexml/element.rb (revision 13599) ++++ lib/rexml/element.rb (revision 13600) +@@ -553,6 +553,7 @@ + def attribute( name, namespace=nil ) + prefix = nil + prefix = namespaces.index(namespace) if namespace ++ prefix = nil if prefix == 'xmlns' + attributes.get_attribute( "#{prefix ? prefix + ':' : ''}#{name}" ) + end + +@@ -854,15 +855,15 @@ + # Source (see Element.initialize). If not supplied or nil, a + # new, default Element will be constructed + # Returns:: the added Element +- # a = Element.new 'a' +- # a.elements.add Element.new 'b' #-> +- # a.elements.add 'c' #-> ++ # a = Element.new('a') ++ # a.elements.add(Element.new('b')) #-> ++ # a.elements.add('c') #-> + def add element=nil + rv = nil + if element.nil? +- Element.new "", self, @element.context ++ Element.new("", self, @element.context) + elsif not element.kind_of?(Element) +- Element.new element, self, @element.context ++ Element.new(element, self, @element.context) + else + @element << element + element.context = @element.context +Index: lib/rexml/undefinednamespaceexception.rb +=================================================================== +--- lib/rexml/undefinednamespaceexception.rb (revision 0) ++++ lib/rexml/undefinednamespaceexception.rb (revision 13600) +@@ -0,0 +1,8 @@ ++require 'rexml/parseexception' ++module REXML ++ class UndefinedNamespaceException < ParseException ++ def initialize( prefix, source, parser ) ++ super( "Undefined prefix #{prefix} found" ) ++ end ++ end ++end +Index: lib/rexml/source.rb +=================================================================== +--- lib/rexml/source.rb (revision 13599) ++++ lib/rexml/source.rb (revision 13600) +@@ -17,8 +17,8 @@ + elsif arg.kind_of? Source + arg + else +- raise "#{source.class} is not a valid input stream. It must walk \n"+ +- "like either a String, IO, or Source." ++ raise "#{arg.class} is not a valid input stream. It must walk \n"+ ++ "like either a String, an IO, or a Source." + end + end + end +Index: lib/rexml/attribute.rb +=================================================================== +--- lib/rexml/attribute.rb (revision 13599) ++++ lib/rexml/attribute.rb (revision 13600) +@@ -50,7 +50,7 @@ + @element = first.element + end + elsif first.kind_of? String +- @element = parent if parent.kind_of? Element ++ @element = parent + self.name = first + @normalized = second.to_s + else +Index: lib/rexml/rexml.rb +=================================================================== +--- lib/rexml/rexml.rb (revision 13599) ++++ lib/rexml/rexml.rb (revision 13600) +@@ -1,3 +1,4 @@ ++# -*- encoding: utf-8 -*- + # REXML is an XML toolkit for Ruby[http://www.ruby-lang.org], in Ruby. + # + # REXML is a _pure_ Ruby, XML 1.0 conforming, +@@ -10,8 +11,9 @@ + # + # Main page:: http://www.germane-software.com/software/rexml + # Author:: Sean Russell +-# Version:: 3.1.7.1 +-# Date:: 2007/209 ++# Version:: 3.1.7.2 ++# Date:: 2007/275 ++# Revision:: $Revision$ + # + # This API documentation can be downloaded from the REXML home page, or can + # be accessed online[http://www.germane-software.com/software/rexml_doc] +@@ -20,10 +22,10 @@ + # or can be accessed + # online[http://www.germane-software.com/software/rexml/docs/tutorial.html] + module REXML +- COPYRIGHT = "Copyright © 2001-2007 Sean Russell " +- DATE = "2007/209" +- VERSION = "3.1.7.1" +- REVISION = "$Revision: 1270$".gsub(/\$Revision:|\$/,'').strip ++ COPYRIGHT = "Copyright \xC2\xA9 2001-2006 Sean Russell " ++ VERSION = "3.1.7.2" ++ DATE = "2007/275" ++ REVISION = "$Revision$".gsub(/\$Revision:|\$/,'').strip + + Copyright = COPYRIGHT + Version = VERSION + +Property changes on: lib/rexml/dtd/dtd.rb +___________________________________________________________________ +Name: svk:merge + + 3a3bbbf4-582e-0410-a78b-8bf2211dae1f:/local/ruby-trunk/dtd/dtd.rb:1298 + + +Property changes on: lib/rexml +___________________________________________________________________ +Name: svk:merge + - 3a3bbbf4-582e-0410-a78b-8bf2211dae1f:/local/rexml-trunk/src/rexml:1287 +3a3bbbf4-582e-0410-a78b-8bf2211dae1f:/local/ruby-1.8.6:1339 +3a3bbbf4-582e-0410-a78b-8bf2211dae1f:/local/ruby-trunk:1335 +877f57f0-f5bd-0310-8c13-bb9e5bdefd87:/branches/3.1.7/src/rexml:1274 +b2dd03c8-39d4-4d8f-98ff-823fe69b080e:/trunk/lib/rexml:12517 + + 3a3bbbf4-582e-0410-a78b-8bf2211dae1f:/local/rexml-trunk/src/rexml:1287 +3a3bbbf4-582e-0410-a78b-8bf2211dae1f:/local/rexml/trunk/src/rexml:1404 +3a3bbbf4-582e-0410-a78b-8bf2211dae1f:/local/ruby-1.8.6:1425 +3a3bbbf4-582e-0410-a78b-8bf2211dae1f:/local/ruby-trunk:1380 +877f57f0-f5bd-0310-8c13-bb9e5bdefd87:/branches/3.1.7/src/rexml:1274 +b2dd03c8-39d4-4d8f-98ff-823fe69b080e:/trunk/lib/rexml:13097 + diff --git a/dev-lang/ruby/ruby-1.8.6_p110-r2.ebuild b/dev-lang/ruby/ruby-1.8.6_p110-r2.ebuild new file mode 100644 index 0000000..0a29ab0 --- /dev/null +++ b/dev-lang/ruby/ruby-1.8.6_p110-r2.ebuild @@ -0,0 +1,179 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-lang/ruby/ruby-1.8.6.ebuild,v 1.2 2007/04/07 16:23:57 pclouds Exp $ + +WANT_AUTOCONF="latest" +WANT_AUTOMAKE="latest" + +ONIGURUMA="onigd2_5_9" + +inherit autotools eutils flag-o-matic multilib versionator + +MY_P="${PN}-$(replace_version_separator 3 '-')" +S=${WORKDIR}/${MY_P} + +SLOT=$(get_version_component_range 1-2) +MY_SUFFIX=$(delete_version_separator 1 ${SLOT}) + +DESCRIPTION="An object-oriented scripting language" +HOMEPAGE="http://www.ruby-lang.org/" +SRC_URI="ftp://ftp.ruby-lang.org/pub/ruby/${SLOT}/${MY_P}.tar.gz + cjk? ( http://www.geocities.jp/kosako3/oniguruma/archive/${ONIGURUMA}.tar.gz )" + +LICENSE="Ruby" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~sparc-fbsd ~x86 ~x86-fbsd" +IUSE="cjk debug doc elibc_glibc examples ipv6 rubytests socks5 threads tk" + +RDEPEND=">=sys-libs/gdbm-1.8.0 + >=sys-libs/readline-4.1 + >=sys-libs/ncurses-5.2 + socks5? ( >=net-proxy/dante-1.1.13 ) + tk? ( dev-lang/tk ) + >=dev-ruby/ruby-config-0.3.1 + !=dev-lang/ruby-cvs-${SLOT}* + !dev-ruby/rdoc + !dev-ruby/rexml" +DEPEND="${RDEPEND}" +PROVIDE="virtual/ruby" + +src_unpack() { + unpack ${A} + + if use cjk ; then + einfo "Applying ${ONIGURUMA}" + pushd ${WORKDIR}/oniguruma + econf --with-rubydir="${S}" || die "oniguruma econf failed" + emake $MY_SUFFIX || die "oniguruma emake failed" + popd + fi + + cd "${S}/ext/dl" + epatch "${FILESDIR}/${PN}-1.8.6-memory-leak.diff" + cd "${S}" + + epatch "${FILESDIR}/${P}-net-http-p111.patch" + epatch "${FILESDIR}/${P}-rexml.patch" + + # Fix a hardcoded lib path in configure script + sed -i -e "s:\(RUBY_LIB_PREFIX=\"\${prefix}/\)lib:\1$(get_libdir):" \ + configure.in || die "sed failed" + + eautoreconf +} + +src_compile() { + # -fomit-frame-pointer makes ruby segfault, see bug #150413. + filter-flags -fomit-frame-pointer + # In many places aliasing rules are broken; play it safe + # as it's risky with newer compilers to leave it as it is. + append-flags -fno-strict-aliasing + + # Socks support via dante + if use socks5 ; then + # Socks support can't be disabled as long as SOCKS_SERVER is + # set and socks library is present, so need to unset + # SOCKS_SERVER in that case. + unset SOCKS_SERVER + fi + + # Increase GC_MALLOC_LIMIT if set (default is 8000000) + if [ -n "${RUBY_GC_MALLOC_LIMIT}" ] ; then + append-flags "-DGC_MALLOC_LIMIT=${RUBY_GC_MALLOC_LIMIT}" + fi + + # Bug #168939 + # We need to always enable ipv6, use --with-lookup-order-hack=INET + # when we don't want ipv6 with glibc + if use elibc_glibc; then + myconf="--enable-ipv6" + if ! use ipv6; then + myconf="${myconf} --with-lookup-order-hack=INET" + fi + else + myconf=$(use_enable ipv6) + fi + + econf --program-suffix=$MY_SUFFIX --enable-shared \ + $(use_enable socks5 socks) \ + $(use_enable doc install-doc) \ + $(use_enable threads pthread) \ + $(use_enable debug) \ + $(use_with tk) \ + ${myconf} \ + --with-sitedir=/usr/$(get_libdir)/ruby/site_ruby \ + || die "econf failed" + + emake EXTLDFLAGS="${LDFLAGS}" || die "emake failed" +} + +src_test() { + emake -j1 test || die "make test failed" + + elog "Ruby's make test has been run. Ruby also ships with a make check" + elog "that cannot be run until after ruby has been installed." + elog + if use rubytests; then + elog "You have enabled rubytests, so they will be installed to" + elog "/usr/share/${PN}-${SLOT}/test. To run them you must be a user other" + elog "than root, and you must place them into a writeable directory." + elog "Then call: " + elog + elog "ruby -C /location/of/tests runner.rb" + else + elog "Enable the rubytests USE flag to install the make check tests" + fi +} + +src_install() { + LD_LIBRARY_PATH="${D}/usr/$(get_libdir)" + RUBYLIB="${S}:${D}/usr/$(get_libdir)/ruby/${SLOT}" + for d in $(find "${S}/ext" -type d) ; do + RUBYLIB="${RUBYLIB}:$d" + done + export LD_LIBRARY_PATH RUBYLIB + + emake DESTDIR="${D}" install || die "make install failed" + + MINIRUBY=$(echo -e 'include Makefile\ngetminiruby:\n\t@echo $(MINIRUBY)'|make -f - getminiruby) + keepdir $(${MINIRUBY} -rrbconfig -e "print Config::CONFIG['sitelibdir']") + keepdir $(${MINIRUBY} -rrbconfig -e "print Config::CONFIG['sitearchdir']") + + if use doc; then + make DESTDIR="${D}" install-doc || die "make install-doc failed" + fi + + if use examples; then + dodir /usr/share/doc/${PF} + cp -pPR sample "${D}/usr/share/doc/${PF}" + fi + + dosym libruby$MY_SUFFIX$(get_libname ${PV%_*}) /usr/$(get_libdir)/libruby$(get_libname ${PV%.*}) + dosym libruby$MY_SUFFIX$(get_libname ${PV%_*}) /usr/$(get_libdir)/libruby$(get_libname ${PV%_*}) + + dodoc ChangeLog NEWS README* ToDo + + if use rubytests; then + dodir /usr/share/${PN}-${SLOT} + cp -pPR test "${D}/usr/share/${PN}-${SLOT}" + fi +} + +pkg_postinst() { + + ewarn "If you upgrade to >=sys-apps/coreutils-6.7-r1," + ewarn "you should re-emerge ruby again." + ewarn "See bug #159922 for details" + ewarn + if [[ ! -n $(readlink "${ROOT}"usr/bin/ruby) ]] ; then + "${ROOT}usr/sbin/ruby-config" ruby$MY_SUFFIX + fi + elog + elog "You can change the default ruby interpreter by ${ROOT}usr/sbin/ruby-config" + elog +} + +pkg_postrm() { + if [[ ! -n $(readlink "${ROOT}"usr/bin/ruby) ]] ; then + "${ROOT}usr/sbin/ruby-config" ruby$MY_SUFFIX + fi +} -- cgit v1.2.3-65-gdbad