[DRE-commits] [ruby-raindrops] 01/05: Imported Upstream version 0.16.0

Hleb Valoshka tsfgnu-guest at moszumanska.debian.org
Mon Feb 29 13:44:06 UTC 2016


This is an automated email from the git hooks/post-receive script.

tsfgnu-guest pushed a commit to branch master
in repository ruby-raindrops.

commit 6221eda6ae8e4c45a9353049dd3ff04239e2a100
Author: Hleb Valoshka <375gnu at gmail.com>
Date:   Mon Feb 29 16:23:04 2016 +0300

    Imported Upstream version 0.16.0
---
 .gitattributes                            |  4 ++++
 .manifest                                 |  1 +
 .olddoc.yml                               |  2 ++
 GIT-VERSION-FILE                          |  2 +-
 GIT-VERSION-GEN                           |  2 +-
 LATEST                                    | 29 +++++++++++++++++++++++++----
 NEWS                                      | 28 ++++++++++++++++++++++++++++
 README                                    | 22 +++++++++++++---------
 ext/raindrops/extconf.rb                  |  2 +-
 ext/raindrops/linux_inet_diag.c           | 15 ++++++++++++---
 lib/raindrops/aggregate/last_data_recv.rb |  6 +-----
 lib/raindrops/linux.rb                    |  4 ++--
 lib/raindrops/middleware.rb               |  6 ++----
 metadata.yml                              | 21 ++++-----------------
 pkg.mk                                    |  2 +-
 raindrops.gemspec                         |  1 -
 test/test_linux.rb                        |  7 +++++++
 17 files changed, 105 insertions(+), 49 deletions(-)

diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..8b88b26
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,4 @@
+*.gemspec diff=ruby
+*.rb diff=ruby
+*.ru diff=ruby
+Rakefile diff=ruby
diff --git a/.manifest b/.manifest
index 7217d25..53d5437 100644
--- a/.manifest
+++ b/.manifest
@@ -1,4 +1,5 @@
 .document
+.gitattributes
 .gitignore
 .manifest
 .olddoc.yml
diff --git a/.olddoc.yml b/.olddoc.yml
index 567cef1..7fe7995 100644
--- a/.olddoc.yml
+++ b/.olddoc.yml
@@ -5,3 +5,5 @@ rdoc_url: http://raindrops.bogomips.org/
 public_email: raindrops-public at bogomips.org
 private_email: raindrops at bogomips.org
 ml_url: http://bogomips.org/raindrops-public/
+nntp_url:
+  - nntp://news.public-inbox.org/inbox.comp.lang.ruby.raindrops
diff --git a/GIT-VERSION-FILE b/GIT-VERSION-FILE
index ceab376..8aa1395 100644
--- a/GIT-VERSION-FILE
+++ b/GIT-VERSION-FILE
@@ -1 +1 @@
-GIT_VERSION = 0.15.0
+GIT_VERSION = 0.16.0
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index 1086f83..f2c187b 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 GVF=GIT-VERSION-FILE
-DEF_VER=v0.15.0
+DEF_VER=v0.16.0
 
 LF='
 '
diff --git a/LATEST b/LATEST
index ce7143c..8cb375d 100644
--- a/LATEST
+++ b/LATEST
@@ -1,7 +1,28 @@
-=== raindrops 0.15.0 - non-glibc compat fix on Linux / 2015-07-22 00:30 UTC
+=== raindrops 0.16.0 - minor fixes and workarounds / 2016-02-29 12:36 UTC
 
-  Thanks to Doug Forster for sending us the report.
-  No other fixes
+  There's mainly a fix/workaround for Ruby 2.3 now returning
+  locale-aware strings for File.readlink and our test suite
+  using strange paths allowed by *nix.
 
-  * check for the existence of linux/tcp.h
+      https://bugs.ruby-lang.org/issues/12034
+
+  tcp_listener_stats won't return "true" object placeholders
+  if stats are configured for a non-existent listener.
+
+  There are also minor optimizations for Ruby 2.2+ (at the expense
+  of 2.1 and earlier).
+
+  And the usual round of minor tweaks and doc updates.
+
+  10 changes since v0.15.0:
+        gemspec: avoid circular dependency on unicorn
+        remove optimizations which made sense for older rubies
+        linux: workaround Ruby 2.3 change
+        linux: remove Pathname stdlib dependency
+        add .gitattributes for Ruby method detection
+        middleware: minor bytecode size reduction
+        doc: update URLs and references
+        README: remove indentation from URLs in RDoc
+        linux: tcp_listener_stats drops "true" placeholders
+        build: use '--local' domain for dev gem install
 
diff --git a/NEWS b/NEWS
index c1e9b20..5a2d8f0 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,31 @@
+=== raindrops 0.16.0 - minor fixes and workarounds / 2016-02-29 12:36 UTC
+
+  There's mainly a fix/workaround for Ruby 2.3 now returning
+  locale-aware strings for File.readlink and our test suite
+  using strange paths allowed by *nix.
+
+      https://bugs.ruby-lang.org/issues/12034
+
+  tcp_listener_stats won't return "true" object placeholders
+  if stats are configured for a non-existent listener.
+
+  There are also minor optimizations for Ruby 2.2+ (at the expense
+  of 2.1 and earlier).
+
+  And the usual round of minor tweaks and doc updates.
+
+  10 changes since v0.15.0:
+        gemspec: avoid circular dependency on unicorn
+        remove optimizations which made sense for older rubies
+        linux: workaround Ruby 2.3 change
+        linux: remove Pathname stdlib dependency
+        add .gitattributes for Ruby method detection
+        middleware: minor bytecode size reduction
+        doc: update URLs and references
+        README: remove indentation from URLs in RDoc
+        linux: tcp_listener_stats drops "true" placeholders
+        build: use '--local' domain for dev gem install
+
 === raindrops 0.15.0 - non-glibc compat fix on Linux / 2015-07-22 00:30 UTC
 
   Thanks to Doug Forster for sending us the report.
diff --git a/README b/README
index 905c44c..ab2a253 100644
--- a/README
+++ b/README
@@ -37,12 +37,15 @@ and "tcp_diag" kernel modules are loaded as they do not autoload correctly
 
 == Install
 
-We recommend GCC 4+ (or compatible) to support the
-{atomic builtins}[http://gcc.gnu.org/onlinedocs/gcc/Atomic-Builtins.html]
-(__sync_{add,sub}_and_fetch()).  For non-GCC 4+ users, we also support
-compilation with the
-{libatomic_ops}[http://www.hpl.hp.com/research/linux/atomic_ops/]
-package starting with Raindrops 0.4.0.
+We recommend GCC 4+ (or compatible) to support the __sync builtins
+(__sync_{add,sub}_and_fetch()):
+
+http://gcc.gnu.org/onlinedocs/gcc/_005f_005fsync-Builtins.html
+
+For non-GCC 4+ users, we also support compilation with the libatomic_ops
+package starting with Raindrops 0.4.0:
+
+https://github.com/ivmai/libatomic_ops
 
 If you're using a packaged Ruby distribution, make sure you have a C
 compiler and the matching Ruby development libraries and headers.
@@ -74,7 +77,7 @@ You can get the latest source via git from the following locations:
 You may browse the code from the web and download the latest snapshot
 tarballs here:
 
-* http://bogomips.org/raindrops.git (cgit)
+* http://bogomips.org/raindrops.git
 * http://repo.or.cz/w/raindrops.git (gitweb)
 
 Inline patches (from "git format-patch") to the mailing list are
@@ -86,13 +89,14 @@ git itself.  See the Documentation/SubmittingPatches document
 distributed with git on on patch submission guidelines to follow.  Just
 don't email the git mailing list or maintainer with raindrops patches.
 
-raindrops is licensed under the LGPL+2.1 or later:
+raindrops is licensed under the LGPL-2.1+
 
 == Contact
 
 All feedback (bug reports, user/development discussion, patches, pull
 requests) go to the mailing list: mailto:raindrops-public at bogomips.org
 
-Mailing list archives are available here:
+Mailing list archives are available over HTTP and NNTP:
 
 http://bogomips.org/raindrops-public/
+nntp://news.public-inbox.org/inbox.comp.lang.ruby.raindrops
diff --git a/ext/raindrops/extconf.rb b/ext/raindrops/extconf.rb
index 74ed8f9..79d212c 100644
--- a/ext/raindrops/extconf.rb
+++ b/ext/raindrops/extconf.rb
@@ -47,7 +47,7 @@ SRC
 end or have_header('atomic_ops.h') or abort <<-SRC
 
 libatomic_ops is required if GCC 4+ is not used.
-See http://www.hpl.hp.com/research/linux/atomic_ops/
+See https://github.com/ivmai/libatomic_ops
 
 Users of Debian-based distros may run:
 
diff --git a/ext/raindrops/linux_inet_diag.c b/ext/raindrops/linux_inet_diag.c
index 35bb127..58415c6 100644
--- a/ext/raindrops/linux_inet_diag.c
+++ b/ext/raindrops/linux_inet_diag.c
@@ -618,6 +618,13 @@ static VALUE tcp_stats(struct nogvl_args *args, VALUE addr)
 	return rb_listen_stats(&args->stats);
 }
 
+static int drop_placeholders(st_data_t k, st_data_t v, st_data_t ign)
+{
+	if ((VALUE)v == Qtrue)
+		return ST_DELETE;
+	return ST_CONTINUE;
+}
+
 /*
  * call-seq:
  *      Raindrops::Linux.tcp_listener_stats([addrs[, sock]]) => hash
@@ -658,10 +665,9 @@ static VALUE tcp_listener_stats(int argc, VALUE *argv, VALUE self)
 	case T_ARRAY: {
 		long i;
 		long len = RARRAY_LEN(addrs);
-		VALUE cur;
 
 		if (len == 1) {
-			cur = rb_ary_entry(addrs, 0);
+			VALUE cur = rb_ary_entry(addrs, 0);
 
 			rb_hash_aset(rv, cur, tcp_stats(&args, cur));
 			return rv;
@@ -671,7 +677,7 @@ static VALUE tcp_listener_stats(int argc, VALUE *argv, VALUE self)
 			VALUE cur = rb_ary_entry(addrs, i);
 
 			parse_addr(&check, cur);
-			rb_hash_aset(rv, cur, Qtrue);
+			rb_hash_aset(rv, cur, Qtrue /* placeholder */);
 		}
 		/* fall through */
 	}
@@ -689,6 +695,9 @@ static VALUE tcp_listener_stats(int argc, VALUE *argv, VALUE self)
 	st_foreach(args.table, NIL_P(addrs) ? st_to_hash : st_AND_hash, rv);
 	st_free_table(args.table);
 
+	if (RHASH_SIZE(rv) > 1)
+		rb_hash_foreach(rv, drop_placeholders, Qfalse);
+
 	/* let GC deal with corner cases */
 	if (argc < 2) rb_io_close(sock);
 	return rv;
diff --git a/lib/raindrops/aggregate/last_data_recv.rb b/lib/raindrops/aggregate/last_data_recv.rb
index eca89a2..6919fbc 100644
--- a/lib/raindrops/aggregate/last_data_recv.rb
+++ b/lib/raindrops/aggregate/last_data_recv.rb
@@ -13,10 +13,6 @@ require "socket"
 # - Kgio::TCPServer#kgio_accept
 # - Kgio::TCPServer#kgio_tryaccept
 module Raindrops::Aggregate::LastDataRecv
-  # :stopdoc:
-  TCP_Info = Raindrops::TCP_Info
-  # :startdoc:
-
   # The integer value of +last_data_recv+ is sent to this object.
   # This is usually a duck type compatible with the \Aggregate class,
   # but can be *anything* that accepts the *<<* method.
@@ -78,7 +74,7 @@ module Raindrops::Aggregate::LastDataRecv
   # +last_data_recv+ to be accurate
   def count!(io)
     if io
-      x = TCP_Info.new(io)
+      x = Raindrops::TCP_Info.new(io)
       @raindrops_aggregate << x.last_data_recv
     end
     io
diff --git a/lib/raindrops/linux.rb b/lib/raindrops/linux.rb
index 7cfb653..4166ec7 100644
--- a/lib/raindrops/linux.rb
+++ b/lib/raindrops/linux.rb
@@ -8,7 +8,6 @@
 # Instead of snapshotting, Raindrops::Aggregate::LastDataRecv may be used
 # to aggregate statistics from +all+ accepted sockets as they arrive
 # based on the +last_data_recv+ field in Raindrops::TCP_Info
-require 'pathname'
 
 module Raindrops::Linux
 
@@ -46,7 +45,8 @@ module Raindrops::Linux
         path.force_encoding(Encoding::BINARY) if defined?(Encoding)
         if File.symlink?(path)
           link = path
-          path = Pathname.new(link).realpath.to_s
+          path = File.readlink(link)
+          path.force_encoding(Encoding::BINARY) if defined?(Encoding)
           rv[link] = rv[path] # vivify ListenerStats
         else
           rv[path] # vivify ListenerStats
diff --git a/lib/raindrops/middleware.rb b/lib/raindrops/middleware.rb
index 7c647ec..da2fb9d 100644
--- a/lib/raindrops/middleware.rb
+++ b/lib/raindrops/middleware.rb
@@ -77,11 +77,9 @@ class Raindrops::Middleware
   # and both counters are updated atomically.
   #
   # This is supported on all operating systems supported by Raindrops
-  class Stats < Raindrops::Struct.new(:calling, :writing)
-  end
+  Stats = Raindrops::Struct.new(:calling, :writing)
 
   # :stopdoc:
-  PATH_INFO = "PATH_INFO"
   require "raindrops/middleware/proxy"
   # :startdoc:
 
@@ -111,7 +109,7 @@ class Raindrops::Middleware
 
   # standard Rack endpoint
   def call(env) # :nodoc:
-    env[PATH_INFO] == @path and return stats_response
+    env['PATH_INFO'] == @path and return stats_response
     begin
       @stats.incr_calling
 
diff --git a/metadata.yml b/metadata.yml
index 7ddcb59..d2fa9a3 100644
--- a/metadata.yml
+++ b/metadata.yml
@@ -1,14 +1,14 @@
 --- !ruby/object:Gem::Specification
 name: raindrops
 version: !ruby/object:Gem::Version
-  version: 0.15.0
+  version: 0.16.0
 platform: ruby
 authors:
 - raindrops hackers
 autorequire: 
 bindir: bin
 cert_chain: []
-date: 2015-07-22 00:00:00.000000000 Z
+date: 2016-02-29 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: aggregate
@@ -87,20 +87,6 @@ dependencies:
       - !ruby/object:Gem::Version
         version: '1.2'
 - !ruby/object:Gem::Dependency
-  name: unicorn
-  requirement: !ruby/object:Gem::Requirement
-    requirements:
-    - - ">="
-      - !ruby/object:Gem::Version
-        version: '0.98'
-  type: :development
-  prerelease: false
-  version_requirements: !ruby/object:Gem::Requirement
-    requirements:
-    - - ">="
-      - !ruby/object:Gem::Version
-        version: '0.98'
-- !ruby/object:Gem::Dependency
   name: olddoc
   requirement: !ruby/object:Gem::Requirement
     requirements:
@@ -143,6 +129,7 @@ extra_rdoc_files:
 - ext/raindrops/linux_tcp_info.c
 files:
 - ".document"
+- ".gitattributes"
 - ".gitignore"
 - ".manifest"
 - ".olddoc.yml"
@@ -219,7 +206,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
       version: '0'
 requirements: []
 rubyforge_project: 
-rubygems_version: 2.5.0
+rubygems_version: 2.5.2
 signing_key: 
 specification_version: 4
 summary: real-time stats for preforking Rack servers
diff --git a/pkg.mk b/pkg.mk
index 1e40915..186db53 100644
--- a/pkg.mk
+++ b/pkg.mk
@@ -86,7 +86,7 @@ fix-perms:
 gem: $(pkggem)
 
 install-gem: $(pkggem)
-	gem install $(CURDIR)/$<
+	gem install --local $(CURDIR)/$<
 
 $(pkggem): manifest fix-perms
 	gem build $(rfpackage).gemspec
diff --git a/raindrops.gemspec b/raindrops.gemspec
index 7864ac3..c2e4ed9 100644
--- a/raindrops.gemspec
+++ b/raindrops.gemspec
@@ -24,7 +24,6 @@ Gem::Specification.new do |s|
   s.add_development_dependency('io-extra', [ '~> 1.2', '>= 1.2.3'])
   s.add_development_dependency('posix_mq', '~> 2.0')
   s.add_development_dependency('rack', '~> 1.2')
-  s.add_development_dependency('unicorn', '>= 0.98')
   s.add_development_dependency('olddoc', '~> 1.0')
 
   s.licenses = %w(LGPL-2.1+)
diff --git a/test/test_linux.rb b/test/test_linux.rb
index 0e79a86..bfefcc4 100644
--- a/test/test_linux.rb
+++ b/test/test_linux.rb
@@ -214,6 +214,13 @@ class TestLinux < Test::Unit::TestCase
     assert_equal 0, stats[addr1].active
     assert_equal 1, stats[addr2].queued
     assert_equal 1, stats[addr2].active
+
+    # make sure we don't leave "true" placeholders in results if a
+    # listener becomes invalid (even momentarily).
+    s2.close
+    stats = tcp_listener_stats(addrs)
+    assert stats.values.all? { |x| x.instance_of?(Raindrops::ListenStats) },
+      "placeholders left: #{stats.inspect}"
   end
 
   # tries to overflow buffers

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-raindrops.git



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