[DRE-maint] Bug#593082: about digest.rb
Hideki Yamane
henrich at debian.or.jp
Fri Dec 24 14:09:58 UTC 2010
Hi,
On Fri, 24 Dec 2010 00:35:12 +0100
Julien Cristau <jcristau at debian.org> wrote:
> Care to prepare a NMU diff?
Yes, here is.
diff -Nru libxml-parser-ruby-0.7.1/debian/changelog libxml-parser-ruby-0.7.1/debian/changelog
--- libxml-parser-ruby-0.7.1/debian/changelog 2010-06-12 14:09:23.000000000 +0900
+++ libxml-parser-ruby-0.7.1/debian/changelog 2010-12-24 23:00:01.000000000 +0900
@@ -1,3 +1,11 @@
+libxml-parser-ruby (0.7.1-1.1) unstable; urgency=low
+
+ * Non-maintainer upload.
+ * debian/patches
+ - add "add-digest.rb" to work it with ruby1.9.1 (Closes: #593082)
+
+ -- Hideki Yamane <henrich at debian.org> Fri, 24 Dec 2010 22:59:07 +0900
+
libxml-parser-ruby (0.7.1-1) unstable; urgency=low
* New upstream release
diff -Nru libxml-parser-ruby-0.7.1/debian/patches/add-digest.rb.patch libxml-parser-ruby-0.7.1/debian/patches/add-digest.rb.patch
--- libxml-parser-ruby-0.7.1/debian/patches/add-digest.rb.patch 1970-01-01 09:00:00.000000000 +0900
+++ libxml-parser-ruby-0.7.1/debian/patches/add-digest.rb.patch 2010-12-24 22:59:02.000000000 +0900
@@ -0,0 +1,111 @@
+Index: libxml-parser-ruby-0.7.1/lib/xml/dom/digest.rb
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ libxml-parser-ruby-0.7.1/lib/xml/dom/digest.rb 2010-12-24 22:58:57.056000354 +0900
+@@ -0,0 +1,106 @@
++## -*- Ruby -*-
++## DOMHASH test implementation
++## 1999 by yoshidam
++##
++## Apr 20, 1999 Change for draft-hiroshi-dom-hash-01.txt
++##
++
++require 'xml/dom/core'
++require 'digest/md5'
++
++module XML
++ module DOM
++ def self.tou16(str)
++ if defined?(::Encoding)
++ str.encode(::Encoding::UTF_16BE).force_encoding(::Encoding::ASCII_8BIT)
++ else
++ str.unpack("U*").map {|v|
++ if v >= 0x10000 && v <= 0x10ffff
++ ## surrogate pair
++ hi = ((v - 0x10000) >> 10) | 0xd800
++ low = (v & 1023) | 0xdc00
++ [hi, low].pack("n*")
++ else
++ [v].pack("n*")
++ end
++ }.join
++ end
++ end
++
++ class Node
++ def getDigest(algorithm = Digest::MD5, force = false)
++ nil
++ end
++ end
++
++ class Text
++ def getDigest(algorithm = Digest::MD5, force = false)
++ (!force && @digest) ||
++ @digest = algorithm.digest([TEXT_NODE].pack("N") + DOM.tou16(nodeValue))
++ @digest
++ end
++ end
++
++## class Comment
++## def getDigest(algorithm = Digest::MD5, force = false)
++## (!force && @digest) ||
++## @digest = algorithm.digest([COMMENT_NODE].pack("N") + DOM.tou16(data)).digest
++## end
++## end
++
++ class ProcessingInstruction
++ def getDigest(algorithm = Digest::MD5, force = false)
++ (!force && @digest) ||
++ @digest = algorithm.digest([PROCESSING_INSTRUCTION_NODE].pack("N") +
++ DOM.tou16(target) + "\0\0" + DOM.tou16(data))
++ end
++ end
++
++ class Attr
++ def getDigest(algorithm = Digest::MD5, force = false)
++ (!force && @digest) ||
++ @digest = algorithm.digest([ATTRIBUTE_NODE].pack("N") +
++ DOM.tou16(nodeName) + "\0\0" + DOM.tou16(nodeValue))
++ end
++ end
++
++ class NamedNodeMap
++ include Enumerable
++ end
++
++ class NodeList
++ include Enumerable
++ end
++
++ class Element
++ def getDigest(algorithm = Digest::MD5, force = false)
++ return @digest if (!force && @digest)
++ attr = attributes
++ children = childNodes
++ attr_digests = ""
++ children_digests = ""
++ if attr
++ attr_array = attr.sort {|a, b|
++ DOM.tou16(a.nodeName) <=> DOM.tou16(b.nodeName)}
++ attr_array.each {|a|
++ attr_digests << a.getDigest(algorithm, force)
++ }
++ end
++ children_num = 0
++ children.each {|c|
++ next if c.nodeType == COMMENT_NODE
++ children_num += 1
++ children_digests << c.getDigest(algorithm, force)
++ }
++ @digest = algorithm.digest([ELEMENT_NODE].pack("N") +
++ DOM.tou16(nodeName) +
++ "\0\0" +
++ [attr.length].pack("N") +
++ attr_digests +
++ [children_num].pack("N") +
++ children_digests)
++ end
++ end
++
++ end
++end
diff -Nru libxml-parser-ruby-0.7.1/debian/patches/series libxml-parser-ruby-0.7.1/debian/patches/series
--- libxml-parser-ruby-0.7.1/debian/patches/series 2010-05-12 19:10:32.000000000 +0900
+++ libxml-parser-ruby-0.7.1/debian/patches/series 2010-12-24 22:55:36.000000000 +0900
@@ -1 +1,2 @@
replaces_gt_symbol_by_enconded_version.patch
+add-digest.rb.patch
More information about the Pkg-ruby-extras-maintainers
mailing list