[DRE-commits] [SCM] ruby-rubytorrent.git branch, master, updated. upstream/0.3-8-g514c958

Cédric Boutillier cedric.boutillier at gmail.com
Wed May 23 16:58:18 UTC 2012


The following commit has been merged in the master branch:
commit b66d6834d49e49c7b5cffb43d539a5dc2bd32110
Author: Cédric Boutillier <cedric.boutillier at gmail.com>
Date:   Wed May 23 18:38:15 2012 +0200

    add patches to remove rubygems and port to Ruby1.9

diff --git a/debian/patches/convert_break_into_return_outside_a_loop.patch b/debian/patches/convert_break_into_return_outside_a_loop.patch
new file mode 100644
index 0000000..923927e
--- /dev/null
+++ b/debian/patches/convert_break_into_return_outside_a_loop.patch
@@ -0,0 +1,19 @@
+Description: Convert break statement out of a loop into a return
+  Otherwise, this leads to an SyntaxError (Invalid break) with ruby1.9.1
+Author: Cédric Boutillier <cedric.boutillier at gmail.com>
+Forwarded: http://rubyforge.org/pipermail/rubytorrent-devel/2012-May/000051.html
+Origin: vendor
+Last-Update: 2011-05-23
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/lib/rubytorrent/controller.rb
++++ b/lib/rubytorrent/controller.rb
+@@ -582,7 +582,7 @@
+     calc_optunchokes
+ 
+     ## this is needed. sigh.
+-    break unless @running
++    return unless @running
+ 
+     ## send keepalives 
+     @peers_m.synchronize { @peers.each { |p| p.send_keepalive if p.running? && p.last_send_time && ((Time.now - p.last_send_time) > KEEPALIVE_INTERVAL) } }
diff --git a/debian/patches/fix_fetching_ascii_codes_from_chars.patch b/debian/patches/fix_fetching_ascii_codes_from_chars.patch
new file mode 100644
index 0000000..a6bcab3
--- /dev/null
+++ b/debian/patches/fix_fetching_ascii_codes_from_chars.patch
@@ -0,0 +1,96 @@
+Description: Extract ASCII code of characters in way understandable for Ruby1.9
+ Using chr and ord method to pass from integers to the corresponding characters and vice versa
+Author: Cédric Boutillier <cedric.boutillier at gmail.com>
+Forwarded: http://rubyforge.org/pipermail/rubytorrent-devel/2012-May/000051.html
+Origin: vendor
+Last-Update: 2012-05-23
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/lib/rubytorrent/tracker.rb
++++ b/lib/rubytorrent/tracker.rb
+@@ -90,8 +90,8 @@
+       x.map { |e| TrackerResponsePeer.new e }.extend(ArrayUniq2).uniq2
+     when String
+       x.unpack("a6" * (x.length / 6)).map do |y|
+-        TrackerResponsePeer.new({"ip" => (0..3).map { |i| y[i] }.join('.'),
+-                                 "port" => (y[4] << 8) + y[5] })
++        TrackerResponsePeer.new({"ip" => (0..3).map { |i| y[i].ord }.join('.'),
++                                 "port" => (y[4].ord << 8) + y[5].ord })
+       end.extend(ArrayUniq2).uniq2
+     else
+       raise "don't know how to make peers array from #{x.class}"
+--- a/lib/rubytorrent/server.rb
++++ b/lib/rubytorrent/server.rb
+@@ -133,7 +133,7 @@
+ 
+     len = sock.recv(1)[0]
+ #    rt_debug "length #{len.inspect}"
+-    raise ProtocolError, "invalid handshake length byte #{len.inspect}" unless len == 19
++    raise ProtocolError, "invalid handshake length byte #{len.inspect}" unless (not len.nil? and len.ord == 19)
+ 
+     name = sock.recv(19)
+ #    rt_debug "name #{name.inspect}"
+--- a/lib/rubytorrent/message.rb
++++ b/lib/rubytorrent/message.rb
+@@ -17,7 +17,7 @@
+ class String
+   def from_fbbe # four-byte big-endian integer
+     raise "fbbe must be four-byte string (got #{self.inspect})" unless length == 4
+-    (self[0] << 24) + (self[1] << 16) + (self[2] << 8) + self[3]
++    (self[0].ord << 24) + (self[1].ord << 16) + (self[2].ord << 8) + self[3].ord
+   end
+ end
+ 
+@@ -25,11 +25,16 @@
+   def to_fbbe # four-byte big-endian integer
+     raise "fbbe must be < 2^32" unless self <= 2**32
+     raise "fbbe must be >= 0" unless self >= 0
+-    s = "    "
+-    s[0] = (self >> 24) % 256
+-    s[1] = (self >> 16) % 256
+-    s[2] = (self >>  8) % 256
+-    s[3] = (self      ) % 256
++#    s = "    "
++#    s[0] = (self >> 24) % 256
++#    s[1] = (self >> 16) % 256
++#    s[2] = (self >>  8) % 256
++#    s[3] = (self      ) % 256
++    s = ""
++    s << (self >> 24) % 256
++    s << (self >> 16) % 256
++    s << (self >>  8) % 256
++    s << (self      ) % 256
+     s
+   end
+ end
+--- a/lib/rubytorrent/peer.rb
++++ b/lib/rubytorrent/peer.rb
+@@ -26,7 +26,7 @@
+         ret += "\0"
+         bit = 7
+       end
+-      ret[ret.length - 1] |= (1 << bit) if b
++      ret[-1] = (ret[-1].ord || (1 << bit)).chr if b
+       bit -= 1
+     end
+     ret
+@@ -367,7 +367,7 @@
+ #      rt_debug "* hey, a keepalive!"
+     end
+ 
+-    id = recv_bytes(1)[0]
++    id = recv_bytes(1)[0].ord
+ 
+     if Message::WIRE_IDS[id] == :piece # add a block
+       len -= 9
+--- a/rtpeer-ncurses.rb
++++ b/rtpeer-ncurses.rb
+@@ -237,7 +237,7 @@
+ 
+ def handle_any_input(display)
+   case(Ncurses.getch())
+-  when ?q, ?Q
++  when "q".ord, "Q".ord
+     Ncurses.curs_set(1)
+     Ncurses.endwin()
+     exit
diff --git a/debian/patches/remove_rubygems_from_examples.patch b/debian/patches/remove_rubygems_from_examples.patch
new file mode 100644
index 0000000..8fbae00
--- /dev/null
+++ b/debian/patches/remove_rubygems_from_examples.patch
@@ -0,0 +1,21 @@
+Description: Remove rubygems stuff from examples
+Author: Cédric Boutillier <cedric.boutillier at gmail.com>
+Origin: vendor
+Forwarded: not-needed
+Last-Update: 2012-05-23
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/rtpeer-ncurses.rb
++++ b/rtpeer-ncurses.rb
+@@ -11,11 +11,10 @@
+ ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ ## General Public License (in the file COPYING) for more details.
+ 
+-require "rubygems"
+ require "rubytorrent"
+ require "ncurses"
+ require "optparse"
+ 
+ def die(x); $stderr << "#{x}\n" && exit(-1); end
+ 
+ dlratelim = nil
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..5333c73
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,3 @@
+convert_break_into_return_outside_a_loop.patch
+fix_fetching_ascii_codes_from_chars.patch
+remove_rubygems_from_examples.patch

-- 
ruby-rubytorrent.git



More information about the Pkg-ruby-extras-commits mailing list