diff options
author | Vlastimil Babka <caster@gentoo.org> | 2007-01-01 01:47:54 +0000 |
---|---|---|
committer | Vlastimil Babka <caster@gentoo.org> | 2007-01-01 01:47:54 +0000 |
commit | 8ff6ab16616d4fc3e9eb24707dfbc945d80502ef (patch) | |
tree | 9e0cf98c6ef2fc821e8e4876bee9db7833dd6c50 /dev-java | |
parent | Fix the use-sax patch wrt bug #159600 by Wilbur Pan <wilburpan@hotmail.com>. ... (diff) | |
download | gentoo-2-8ff6ab16616d4fc3e9eb24707dfbc945d80502ef.tar.gz gentoo-2-8ff6ab16616d4fc3e9eb24707dfbc945d80502ef.tar.bz2 gentoo-2-8ff6ab16616d4fc3e9eb24707dfbc945d80502ef.zip |
Fix the use-sax patch wrt bug #159600 by Wilbur Pan <wilburpan@hotmail.com>. Thanks to Flameeyes for teaching me the cvs magic needed.
(Portage version: 2.1.2_rc4-r3)
(Unsigned Manifest commit)
Diffstat (limited to 'dev-java')
-rw-r--r-- | dev-java/javatoolkit/Manifest | 20 | ||||
-rw-r--r-- | dev-java/javatoolkit/files/0.2.0-use-sax.patch | 187 |
2 files changed, 8 insertions, 199 deletions
diff --git a/dev-java/javatoolkit/Manifest b/dev-java/javatoolkit/Manifest index 955eca2f0fb1..403b4a3b78ee 100644 --- a/dev-java/javatoolkit/Manifest +++ b/dev-java/javatoolkit/Manifest @@ -2,10 +2,6 @@ AUX 0.2.0-use-sax-fixed.patch 6145 RMD160 99f755f3f569476c5f6f8032260a3fd06f4917 MD5 0c9215836354ab100e1ec9ea8325fdb2 files/0.2.0-use-sax-fixed.patch 6145 RMD160 99f755f3f569476c5f6f8032260a3fd06f4917ef files/0.2.0-use-sax-fixed.patch 6145 SHA256 c836366cce538048fefd8aa8153d9ef9a207006ba41a059df0e2b802094c83a4 files/0.2.0-use-sax-fixed.patch 6145 -AUX 0.2.0-use-sax.patch 6162 RMD160 b9e3923267ae550ed94f86a21a7d861a0d32aece SHA1 5d5f2d97d12b56df4319c31027bccc88496e86ec SHA256 d65e3d284c018352e1f38de0c6147f218fe55229e2b7ba1aa22d4294639c3d41 -MD5 c5c9abad6a545d89fcf4eeec0aa69df2 files/0.2.0-use-sax.patch 6162 -RMD160 b9e3923267ae550ed94f86a21a7d861a0d32aece files/0.2.0-use-sax.patch 6162 -SHA256 d65e3d284c018352e1f38de0c6147f218fe55229e2b7ba1aa22d4294639c3d41 files/0.2.0-use-sax.patch 6162 AUX javatoolkit-0.1.9-make.patch 1168 RMD160 9a7fe61e8820d71a60d7a0b7fa472e26ee9154fa SHA1 c49b14cc15753da2fac6d37ffb365808da03caa9 SHA256 d488bec2b639a668eb58ba8ad64f9de81fb68a68db85eb75523b24ae7f53991e MD5 16d95a92cdc3ba0a23b07965aff309ef files/javatoolkit-0.1.9-make.patch 1168 RMD160 9a7fe61e8820d71a60d7a0b7fa472e26ee9154fa files/javatoolkit-0.1.9-make.patch 1168 @@ -20,18 +16,18 @@ EBUILD javatoolkit-0.1.9.ebuild 796 RMD160 be7e2cef62c3f290e241cc140fe1e6c39b7cb MD5 05ed17aef49851581abeddb89594708d javatoolkit-0.1.9.ebuild 796 RMD160 be7e2cef62c3f290e241cc140fe1e6c39b7cb5e6 javatoolkit-0.1.9.ebuild 796 SHA256 821acd76218b3148395e6a395ed49daa0e5d42700fe0a5a50588f68fe4aae7e1 javatoolkit-0.1.9.ebuild 796 -EBUILD javatoolkit-0.2.0-r1.ebuild 864 RMD160 6116d8ee529dc2621663de8ab502c0f6b73f933b SHA1 9227504e076913659c031b5a7d5eea86e8b73ece SHA256 1dbda91cbbfc81f68dce06a19cd23f12bb181ae00f0e3ff69f9ac632457abf74 -MD5 291d882f465d9b5f144f99b964b3edbd javatoolkit-0.2.0-r1.ebuild 864 -RMD160 6116d8ee529dc2621663de8ab502c0f6b73f933b javatoolkit-0.2.0-r1.ebuild 864 -SHA256 1dbda91cbbfc81f68dce06a19cd23f12bb181ae00f0e3ff69f9ac632457abf74 javatoolkit-0.2.0-r1.ebuild 864 +EBUILD javatoolkit-0.2.0-r1.ebuild 866 RMD160 94f975a29801651b44a80b3dfef4ba29b09e00e5 SHA1 7305b795aaa4f1231ffeee87866c5014b5c19ac4 SHA256 b0ad44e83b7e8efdf9c3ad3789bd43bfc8ef8df75450845dd192fd85d140cea2 +MD5 3e94b6e593a941e4954766c055e1d77c javatoolkit-0.2.0-r1.ebuild 866 +RMD160 94f975a29801651b44a80b3dfef4ba29b09e00e5 javatoolkit-0.2.0-r1.ebuild 866 +SHA256 b0ad44e83b7e8efdf9c3ad3789bd43bfc8ef8df75450845dd192fd85d140cea2 javatoolkit-0.2.0-r1.ebuild 866 EBUILD javatoolkit-0.2.0.ebuild 716 RMD160 4f78df128c559ced1b4ef35d96b6d05bb174c480 SHA1 062e28ca4500f3ecfcdc83edd8d9e19690791c7c SHA256 fed84ca9a94cd15c8e85fd0e3a4315f3122801878ecdfa87a6d85cadf5d6be6f MD5 799088af5af9ad607c7acd2921339037 javatoolkit-0.2.0.ebuild 716 RMD160 4f78df128c559ced1b4ef35d96b6d05bb174c480 javatoolkit-0.2.0.ebuild 716 SHA256 fed84ca9a94cd15c8e85fd0e3a4315f3122801878ecdfa87a6d85cadf5d6be6f javatoolkit-0.2.0.ebuild 716 -MISC ChangeLog 3430 RMD160 58776bb4df7b66fde42a9d4f9dce7435c4203ac2 SHA1 ce27fbf47036c6150896f3141ae030a6881b0a72 SHA256 59de149d213a2f58c74fac9ff795e7344508e66097234318506b5baf30787655 -MD5 0754bf0238d0d30dfd34eeee784f15b9 ChangeLog 3430 -RMD160 58776bb4df7b66fde42a9d4f9dce7435c4203ac2 ChangeLog 3430 -SHA256 59de149d213a2f58c74fac9ff795e7344508e66097234318506b5baf30787655 ChangeLog 3430 +MISC ChangeLog 3712 RMD160 9a1579b34b87f295cec3e8dd58713ee7c5716ded SHA1 ca12740f1b831675658c2404274d3cfbc35909f7 SHA256 bbe18c23068189fb674d82bd94237123e82a909b9e0fdc7bb2ee39386016b186 +MD5 97e1f508a5b7f9bf9f334d38ea82a918 ChangeLog 3712 +RMD160 9a1579b34b87f295cec3e8dd58713ee7c5716ded ChangeLog 3712 +SHA256 bbe18c23068189fb674d82bd94237123e82a909b9e0fdc7bb2ee39386016b186 ChangeLog 3712 MISC metadata.xml 159 RMD160 8da0afd0f687b8985b7f0432fec737950271e354 SHA1 1d089c3afbfafd09e371d7806cc0c72a5c76e5a1 SHA256 da2aaa3223c5418688dfbba6f899648c5bcb2e4610126519a1a862913c4f8fa6 MD5 1a27d03fe84c50463e67139ac818e84c metadata.xml 159 RMD160 8da0afd0f687b8985b7f0432fec737950271e354 metadata.xml 159 diff --git a/dev-java/javatoolkit/files/0.2.0-use-sax.patch b/dev-java/javatoolkit/files/0.2.0-use-sax.patch deleted file mode 100644 index 337b2903921c..000000000000 --- a/dev-java/javatoolkit/files/0.2.0-use-sax.patch +++ /dev/null @@ -1,187 +0,0 @@ -Index: src/bsfix/xml-rewrite-2.py -=================================================================== ---- src/bsfix/xml-rewrite-2.py (revision 3421) -+++ src/bsfix/xml-rewrite-2.py (revision 3432) -@@ -3,15 +3,17 @@ - - # Copyright 2004-2006 Gentoo Foundation - # Distributed under the terms of the GNU General Public Licence v2 --# $Header: /var/cvsroot/gentoo-x86/dev-java/javatoolkit/files/0.2.0-use-sax.patch,v 1.1 2006/12/31 19:21:27 betelgeuse Exp $ - --# Author: Saleem Abdulrasool <compnerd@compnerd.org> -+# Authors: -+# Saleem Abdulrasool <compnerd@compnerd.org> -+# Petteri Räty <betelgeuse@gentoo.org> - # Maintainer: Gentoo Java Herd <java@gentoo.org> - # Python based XML modifier - - # ChangeLog - # Petteri Räty <betelgeuse@gentoo.org - # December 06, 2006 - Changed to use xml.parsers.expat and basically rewrote the whole file -+# December 29, 2006 - Added a SAX based implementation to handle entities etc ( test on dev-java/skinlf ) - # Saleem A. <compnerd@compnerd.org> - # December 23, 2004 - Initial Write - # December 24, 2004 - Added usage information -@@ -26,6 +28,11 @@ - __version__ = "$Revision: 1.1 $"[11:-2] - - class DomRewriter: -+ """ -+ The old DOM rewriter is still around for index based stuff. It can -+ be used for all the complex stuff but portage needed features should -+ be in StreamRewriterBase subclasses as they are much faster. -+ """ - from xml.dom import NotFoundErr - - def __init__(self, modifyElems, attributes, values=None, index=None): -@@ -61,40 +68,32 @@ - def write(self,stream): - stream.write(self.document.toxml()) - --class ExpatRewriter: -+class StreamRewriterBase: - - def __init__(self, elems, attributes, values, index): - self.buffer = StringIO.StringIO() -- self.p = self.buffer.write -+ self.__write = self.buffer.write - self.elems = elems - self.attributes = attributes - self.values = values - -- def process(self, in_stream): -- from xml.parsers.expat import ParserCreate -- parser = ParserCreate() -+ def p(self,str): -+ self.__write(str.encode('utf8')) - -- parser.StartElementHandler = self.start_element -- parser.EndElementHandler = self.end_element -- parser.CharacterDataHandler = self.char_data -- parser.ParseFile(in_stream) -- self.p('\n') -- - def write(self, out_stream): -- out_stream.write(self.buffer.getvalue()) -- self.buffer.close() -- self.buffer = StringIO.StringIO() -- self.p = self.buffer.write -+ value = self.buffer.getvalue() -+ out_stream.write(value) -+ self.buffer.truncate(0) - - def write_attr(self,a,v): -- self.buffer.write('%s=%s ' % (a,quoteattr(v))) -+ self.p(u'%s=%s ' % (a,quoteattr(v, {u'©':'©'}))) - - def start_element(self, name, attrs): -- self.p('<%s ' % name) -+ self.p(u'<%s ' % name) - - match = ( name in self.elems ) - -- for a,v in attrs.iteritems(): -+ for a,v in attrs: - if not ( match and a in self.attributes ): - self.write_attr(a,v) - -@@ -102,14 +101,50 @@ - for i, attr in enumerate(self.attributes): - self.write_attr(attr, self.values[i]) - -- self.p('>') -+ self.p(u'>') - -+class ExpatRewriter(StreamRewriterBase): -+ """ -+ The only problem with this Expat based implementation is that it does not -+ handle entities doctypes etc properly so for example dev-java/skinlf fails. -+ """ -+ def process(self, in_stream): -+ from xml.parsers.expat import ParserCreate -+ parser = ParserCreate() -+ -+ parser.StartElementHandler = self.start_element -+ parser.EndElementHandler = self.end_element -+ parser.CharacterDataHandler = self.char_data -+ parser.ParseFile(in_stream) -+ self.p(u'\n') -+ -+ def start_element(self, name, attrs): -+ StreamRewriterBase(self, name, attrs.iteritems()) -+ - def end_element(self,name): -- self.p('</%s>' % name) -+ self.p(u'</%s>' % name) - - def char_data(self,data): - self.p(escape(data)) - -+from xml.sax.saxutils import XMLGenerator -+class SaxRewriter(XMLGenerator, StreamRewriterBase): -+ """ -+ Using Sax gives us the support for writing back doctypes and all easily -+ and is only marginally slower than expat as it is just a tight layer over it -+ """ -+ def __init__(self, elems, attributes, values, index): -+ StreamRewriterBase.__init__(self, elems, attributes, values, index) -+ XMLGenerator.__init__(self, self.buffer, 'UTF-8') -+ -+ def process(self, in_stream): -+ from xml.sax import parse -+ parse(in_stream, self) -+ self.p(u'\n') -+ -+ def startElement(self, name, attrs): -+ self.start_element(name, attrs.items()) -+ - if __name__ == '__main__': - usage = "XML Rewrite Python Module Version " + __version__ + "\n" - usage += "Copyright 2004 Gentoo Foundation\n" -@@ -166,8 +201,6 @@ - error("You must give value for every attribute you are changing.") - # End Invalid Arguments Check - -- import codecs -- - def get_rewriter(options): - if options.index or options.doDelete: - # java-ant-2.eclass does not use these options so we can optimize the ExpatWriter -@@ -175,23 +208,32 @@ - rewriter = DomRewriter(options.elements, options.attributes, options.values, options.index) - print "Using DOM to rewrite the build.xml files" - else: -- rewriter = ExpatRewriter(options.elements, options.attributes, options.values, options.index) -- print "Using Expat to rewrite the build.xml files" -+ rewriter = SaxRewriter(options.elements, options.attributes, options.values, options.index) -+ print "Using Sax to rewrite the build.xml files" - - return rewriter - - rewriter = get_rewriter(options) - - if options.files: -+ import os - for file in options.files: - print "Rewriting %s" % file -- f = open(file,"r") -+ # First parse the file into memory -+ # Tricks with cwd are needed for relative includes of other xml files to build.xml files -+ cwd = os.getcwd() -+ dirname = os.path.dirname(file) -+ if dirname != '': # for file = build.xml comes out as '' -+ os.chdir(os.path.dirname(file)) -+ f = open(os.path.basename(file),"r") - rewriter.process(f) -+ os.chdir(cwd) - f.close() -+ # Then write it back to the file - f = open(file, "w") -- rewriter.write(codecs.getwriter('utf-8')(f)) -+ rewriter.write(f) - f.close() - else: - rewriter.process(sys.stdin) -- rewriter.write(codecs.getwriter('utf-8')(sys.stdout)) -+ rewriter.write(sys.stdout) - |