debian/0000755000000000000000000000000012224523431007164 5ustar debian/ruby-raindrops.examples0000644000000000000000000000001312224523431013676 0ustar examples/* debian/gbp.conf0000644000000000000000000000003612224523431010602 0ustar [DEFAULT] pristine-tar = True debian/rules0000755000000000000000000000070112224523431010242 0ustar #!/usr/bin/make -f #export DH_VERBOSE=1 # # Uncomment to ignore all test failures (but the tests will run anyway) #export DH_RUBY_IGNORE_TESTS=all # # Uncomment to ignore some test failures (but the tests will run anyway). # Valid values: #export DH_RUBY_IGNORE_TESTS=ruby1.8 ruby1.9.1 require-rubygems # # If you need to specify the .gemspec (eg there is more than one) #export DH_RUBY_GEMSPEC=gem.gemspec %: dh $@ --buildsystem=ruby --with ruby debian/control0000644000000000000000000000216612224523431010574 0ustar Source: ruby-raindrops Section: ruby Priority: optional Maintainer: Debian Ruby Extras Maintainers Uploaders: Hleb Valoshka <375gnu@gmail.com> Build-Depends: debhelper (>= 7.0.50~), gem2deb (>= 0.5.0~), ruby-aggregate, ruby-rack | unicorn Standards-Version: 3.9.4 Vcs-Git: git://anonscm.debian.org/pkg-ruby-extras/ruby-raindrops.git Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-ruby-extras/ruby-raindrops.git;a=summary Homepage: http://raindrops.bogomips.org/ XS-Ruby-Versions: all Package: ruby-raindrops Architecture: linux-any kfreebsd-any XB-Ruby-Versions: ${ruby:Versions} Depends: ${shlibs:Depends}, ${misc:Depends}, ruby | ruby-interpreter Description: Real-time stats for preforking Rack servers Raindrops is a real-time stats toolkit to show statistics for Rack HTTP servers. It is designed for preforking servers such as Rainbows! and Unicorn, but should support any Rack HTTP server under Ruby 1.9, 1.8 and Rubinius on platforms supporting POSIX shared memory. It may also be used as a generic scoreboard for sharing atomic counters across multiple processes. debian/ruby-test-files.yaml0000644000000000000000000000076712224523431013120 0ustar --- - test/test_aggregate_pmq.rb #- test/test_inet_diag_socket.rb - test/test_last_data_recv_unicorn.rb - test/test_linux.rb #- test/test_linux_all_tcp_listen_stats.rb - test/test_linux_all_tcp_listen_stats_leak.rb #- test/test_linux_ipv6.rb - test/test_linux_middleware.rb - test/test_linux_tcp_info.rb - test/test_middleware.rb - test/test_middleware_unicorn.rb - test/test_middleware_unicorn_ipv6.rb - test/test_raindrops.rb - test/test_raindrops_gc.rb - test/test_struct.rb #- test/test_watcher.rb debian/compat0000644000000000000000000000000212224523431010362 0ustar 7 debian/copyright0000644000000000000000000000413412224523431011121 0ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: raindrops Source: http://raindrops.bogomips.org/ Files: * Copyright: 2010-2013 Eric Wong and contributors License: LGPL-2.1 or LGPL-3 License: LGPL-2.1 This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. . This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. . You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . On Debian systems, the full text of the GNU Lesser General Public License version 2.1 can be found in the file `/usr/share/common-licenses/LGPL-2.1'. License: LGPL-3 This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. . This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. . You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . On Debian systems, the full text of the GNU Lesser General Public License version 3 can be found in the file `/usr/share/common-licenses/LGPL-3'. Files: debian/* Copyright: These files ain't copyrighted License: public-domain These files are in Public Domain. debian/changelog0000644000000000000000000000466512224523431011051 0ustar ruby-raindrops (0.12.0-2) unstable; urgency=low [ Hleb Valoshka ] * Disable more tests which require inet_diag or tcp_diag kernel modules as buildd servers don't autoload them (to fix FTBFS). (Closes: #725628) -- Jérémy Bobbio Mon, 07 Oct 2013 14:20:29 +0200 ruby-raindrops (0.12.0-1) unstable; urgency=low * New upstream release. * Add missed unit tests. * Fix copyright to mention contributors. * Add patch to remove Scope IDs from IPv6 addresses. * Build against gem2deb >= 0.5.0~ to add ruby2.0 and drop ruby1.8 support. -- Hleb Valoshka <375gnu@gmail.com> Thu, 12 Sep 2013 20:53:38 +0300 ruby-raindrops (0.11.0-1) unstable; urgency=low * New upstream release. * Bump Standards-Version to 3.9.4 (no changes needed). * Remove obsoleted DM-Upload-Allowed. * Update Vcs-* fields to use anonscm.debian.org -- Hleb Valoshka <375gnu@gmail.com> Sat, 17 Aug 2013 11:58:38 +0300 ruby-raindrops (0.10.0-1) unstable; urgency=low * New upstream release * Fix Build-Depends (set proper package name for unicorn) -- Hleb Valoshka <375gnu@gmail.com> Tue, 26 Jun 2012 22:45:35 +0300 ruby-raindrops (0.9.0-1) unstable; urgency=low * New upstream release -- Hleb Valoshka <375gnu@gmail.com> Sun, 17 Jun 2012 16:24:53 +0300 ruby-raindrops (0.8.1-1) unstable; urgency=low * New upstream release * Drop patch with backported upstream commit 499e63e2 and useless patch from release 0.8.0-4 -- Hleb Valoshka <375gnu@gmail.com> Wed, 16 May 2012 15:04:47 +0300 ruby-raindrops (0.8.0-4) unstable; urgency=low * Trying to fix FTBFS on kfreebsd * Disable build on hurd, it dosn't support POSIX shared memory -- Hleb Valoshka <375gnu@gmail.com> Tue, 17 Apr 2012 21:08:46 +0300 ruby-raindrops (0.8.0-3) unstable; urgency=low * Disable tests which rely on linux modules tcp_diag and inet_diag (Closes: #661401) -- Hleb Valoshka <375gnu@gmail.com> Fri, 16 Mar 2012 22:01:32 +0300 ruby-raindrops (0.8.0-2) unstable; urgency=low [ Hleb Valoshka ] * Backport upstream commit 499e63e2 to fix tests under non-Linux * Update Standards-Version to 3.9.3 [ Dmitry Borodaenko ] * Invoke unix_listener_stats conditionally, skip the unix socket tests (Closes: #661401) -- Hleb Valoshka <375gnu@gmail.com> Thu, 15 Mar 2012 22:29:22 +0300 ruby-raindrops (0.8.0-1) unstable; urgency=low * Initial release (Closes: #660342) -- Hleb Valoshka <375gnu@gmail.com> Sat, 18 Feb 2012 17:07:08 +0300 debian/source/0000755000000000000000000000000012224523431010464 5ustar debian/source/format0000644000000000000000000000001412224523431011672 0ustar 3.0 (quilt) debian/watch0000644000000000000000000000014712224523431010217 0ustar version=3 http://pkg-ruby-extras.alioth.debian.org/cgi-bin/gemwatch/raindrops .*/raindrops-(.*).tar.gz debian/patches/0000755000000000000000000000000012224523431010613 5ustar debian/patches/0003-Remove-Scope-IDs-from-IPv6-addresses.patch0000644000000000000000000000435212224523431020677 0ustar From: Hleb Valoshka <375gnu@gmail.com> Date: Thu, 12 Sep 2013 16:31:13 +0300 Subject: Remove Scope IDs from IPv6 addresses. Scoped ipv6 addresses are defined in rfc4007. Ruby doesn't support them yet and it's unknown whether it will (see http://bugs.ruby-lang.org/issues/8464). So we just remove scope ids. Tested with MRI and Rubinius. --- ext/raindrops/linux_inet_diag.c | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/ext/raindrops/linux_inet_diag.c b/ext/raindrops/linux_inet_diag.c index cd4a876..7b5bae1 100644 --- a/ext/raindrops/linux_inet_diag.c +++ b/ext/raindrops/linux_inet_diag.c @@ -134,12 +134,49 @@ static int st_free_data(st_data_t key, st_data_t value, st_data_t ignored) return ST_DELETE; } +/* + * call-seq: + * remove_scope_id(ip_address) + * + * Returns copy of IP address with Scope ID removed, + * if address has it (only IPv6 actually may have it). + */ +static VALUE remove_scope_id(const char *addr) +{ + VALUE rv = rb_str_new2(addr); + long len = RSTRING_LEN(rv); + char *ptr = RSTRING_PTR(rv); + char *pct = memchr(ptr, '%', len); + + /* + * remove scoped portion + * Ruby equivalent: rv.sub!(/%([^\]]*)\]/, "]") + */ + if (pct) { + size_t newlen = pct - ptr; + char *rbracket = memchr(pct, ']', len - newlen); + + if (rbracket) { + size_t move = len - (rbracket - ptr); + + memmove(pct, rbracket, move); + newlen += move; + + rb_str_set_len(rv, newlen); + } else { + rb_raise(rb_eArgError, + "']' not found in IPv6 addr=%s", ptr); + } + } + return rv; +} + static int st_to_hash(st_data_t key, st_data_t value, VALUE hash) { struct listen_stats *stats = (struct listen_stats *)value; if (stats->listener_p) { - VALUE k = rb_str_new2((const char *)key); + VALUE k = remove_scope_id((const char *)key); VALUE v = rb_listen_stats(stats); OBJ_FREEZE(k); @@ -153,7 +190,7 @@ static int st_AND_hash(st_data_t key, st_data_t value, VALUE hash) struct listen_stats *stats = (struct listen_stats *)value; if (stats->listener_p) { - VALUE k = rb_str_new2((const char *)key); + VALUE k = remove_scope_id((const char *)key); if (rb_hash_lookup(hash, k) == Qtrue) { VALUE v = rb_listen_stats(stats); debian/patches/0001-Test-suite-fix-for-IPv6.patch0000644000000000000000000000120612224523431016411 0ustar From: Hleb Valoshka <375gnu@gmail.com> Date: Thu, 15 Mar 2012 21:36:21 +0300 Subject: Test suite fix for IPv6 --- test/test_linux_ipv6.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/test_linux_ipv6.rb b/test/test_linux_ipv6.rb index ec08f28..9e8730a 100644 --- a/test/test_linux_ipv6.rb +++ b/test/test_linux_ipv6.rb @@ -12,6 +12,14 @@ class TestLinuxIPv6 < Test::Unit::TestCase TEST_ADDR = ENV["TEST_HOST6"] || "::1" + def setup + @to_close = [] + end + + def teardown + @to_close.each { |io| io.close unless io.closed? } + end + def test_tcp s = TCPServer.new(TEST_ADDR, 0) port = s.addr[1] debian/patches/0002-Invoke-unix_listener_stats-conditionally.patch0000644000000000000000000000165212224523431022424 0ustar From: Dmitry Borodaenko Date: Thu, 15 Mar 2012 21:40:35 +0300 Subject: Invoke unix_listener_stats conditionally unix_listener_stats reads /proc/net/unix on every invokation, that is not only expensive, but also breaks the test suite when build process isn't allowed to access /proc. --- lib/raindrops/watcher.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/raindrops/watcher.rb b/lib/raindrops/watcher.rb index fb2df5b..0c7c425 100644 --- a/lib/raindrops/watcher.rb +++ b/lib/raindrops/watcher.rb @@ -171,7 +171,7 @@ class Raindrops::Watcher thr = Thread.new do begin combined = tcp_listener_stats(@tcp_listeners, sock) - combined.merge!(unix_listener_stats(@unix_listeners)) + combined.merge!(unix_listener_stats(@unix_listeners)) if @unix_listeners @lock.synchronize do now = Time.now.utc combined.each do |addr,stats| debian/patches/series0000644000000000000000000000030712224523431012030 0ustar 0001-Test-suite-fix-for-IPv6.patch 0002-Invoke-unix_listener_stats-conditionally.patch 0003-Remove-Scope-IDs-from-IPv6-addresses.patch 0004-Disable-tests-which-require-inet_diag-or-tcp_diag-ke.patch debian/patches/0004-Disable-tests-which-require-inet_diag-or-tcp_diag-ke.patch0000644000000000000000000000227512224523431024204 0ustar From: Hleb Valoshka <375GNU@Gmail.COM> Date: Tue, 24 Sep 2013 21:55:59 +0300 Subject: Disable tests which require inet_diag or tcp_diag kernel modules These test will fail on buildd servers because they don't autoload kernel modules (at least inet_diag and tcp_diag required for these tests) --- diff --git a/test/test_linux.rb b/test/test_linux.rb index 0e79a86..ec71681 100644 --- a/test/test_linux.rb +++ b/test/test_linux.rb @@ -106,7 +106,7 @@ class TestLinux < Test::Unit::TestCase assert_equal 1, stats[tmp.path].queued end - def test_tcp + def disable_test_tcp s = TCPServer.new(TEST_ADDR, 0) port = s.addr[1] addr = "#{TEST_ADDR}:#{port}" @@ -129,7 +129,7 @@ class TestLinux < Test::Unit::TestCase assert_equal 1, stats[addr].active end - def test_tcp_reuse_sock + def disable_test_tcp_reuse_sock nlsock = Raindrops::InetDiagSocket.new s = TCPServer.new(TEST_ADDR, 0) port = s.addr[1] @@ -155,7 +155,7 @@ class TestLinux < Test::Unit::TestCase nlsock.close end - def test_tcp_multi + def disable_test_tcp_multi s1 = TCPServer.new(TEST_ADDR, 0) s2 = TCPServer.new(TEST_ADDR, 0) port1, port2 = s1.addr[1], s2.addr[1] debian/ruby-raindrops.docs0000644000000000000000000000003012224523431013007 0ustar LATEST NEWS README TODO