[DRE-commits] [ruby-http-parser.rb] 02/02: gem2deb is 0.7.4

Praveen Arimbrathodiyil praveen at moszumanska.debian.org
Thu Apr 3 09:33:22 UTC 2014


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

praveen pushed a commit to branch master
in repository ruby-http-parser.rb.

commit 263291dc32f3a3d40fee8f6b5d930e9f7dfb22c1
Author: Praveen Arimbrathodiyil <praveen at debian.org>
Date:   Thu Apr 3 14:50:21 2014 +0530

    gem2deb is 0.7.4
---
 debian/changelog                        |  2 +-
 debian/control                          |  2 +-
 ext/ruby_http_parser/extconf.rb         | 37 +++++++++++++++++----------------
 ext/ruby_http_parser/ruby_http_parser.c | 28 ++++++++++++-------------
 http_parser.rb.gemspec                  |  2 +-
 lib/http_parser.rb                      |  1 -
 spec/parser_spec.rb                     |  4 ++++
 7 files changed, 40 insertions(+), 36 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index c86879b..df39180 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,7 +1,7 @@
 ruby-http-parser.rb (0.6.0-2) unstable; urgency=low
 
   * Team upload.
-  * Bump gem2deb buil-dep to 7.4~
+  * Bump gem2deb buil-dep to 0.7.4~
 
  -- Pirate Praveen <praveen at debian.org>  Thu, 03 Apr 2014 14:48:31 +0530
 
diff --git a/debian/control b/debian/control
index 5dd0292..8389c5c 100644
--- a/debian/control
+++ b/debian/control
@@ -7,7 +7,7 @@ Uploaders:
  Per Andersson <avtobiff at gmail.com>
 Build-Depends:
  debhelper (>= 7.0.50~),
- gem2deb (>= 7.4~),
+ gem2deb (>= 0.7.4~),
  libhttp-parser-dev,
  rake,
  ruby-json,
diff --git a/ext/ruby_http_parser/extconf.rb b/ext/ruby_http_parser/extconf.rb
index d2f6e51..1d5ad3d 100644
--- a/ext/ruby_http_parser/extconf.rb
+++ b/ext/ruby_http_parser/extconf.rb
@@ -1,24 +1,25 @@
 require 'mkmf'
 
-# check out code if it hasn't been already
-if Dir[File.expand_path('../vendor/http-parser/*', __FILE__)].empty?
-  Dir.chdir(File.expand_path('../../../', __FILE__)) do
-    xsystem 'git submodule init'
-    xsystem 'git submodule update'
-  end
-end
+## check out code if it hasn't been already
+#if Dir[File.expand_path('../vendor/http-parser/*', __FILE__)].empty?
+#  Dir.chdir(File.expand_path('../../../', __FILE__)) do
+#    xsystem 'git submodule init'
+#    xsystem 'git submodule update'
+#  end
+#end
 
-# mongrel and http-parser both define http_parser_(init|execute), so we
-# rename functions in http-parser before using them.
-vendor_dir = File.expand_path('../vendor/http-parser/', __FILE__)
-src_dir = File.expand_path('../', __FILE__)
-%w[ http_parser.c http_parser.h ].each do |file|
-  File.open(File.join(src_dir, "ryah_#{file}"), 'w'){ |f|
-    f.write File.read(File.join(vendor_dir, file)).gsub('http_parser', 'ryah_http_parser')
-  }
-end
+## mongrel and http-parser both define http_parser_(init|execute), so we
+## rename functions in http-parser before using them.
+#vendor_dir = File.expand_path('../vendor/http-parser/', __FILE__)
+#src_dir = File.expand_path('../', __FILE__)
+#%w[ http_parser.c http_parser.h ].each do |file|
+#  File.open(File.join(src_dir, "ryah_#{file}"), 'w'){ |f|
+#    f.write File.read(File.join(vendor_dir, file)).gsub('http_parser', 'ryah_http_parser')
+#  }
+#end
 
-$CFLAGS << " -I#{src_dir}"
+#$CFLAGS << " -I#{src_dir}"
+$LDFLAGS << " -lhttp_parser"
 
-dir_config("ruby_http_parser")
+dir_config("ruby_http_parser", '/usr/include', '/usr/lib/http-parser')
 create_makefile("ruby_http_parser")
diff --git a/ext/ruby_http_parser/ruby_http_parser.c b/ext/ruby_http_parser/ruby_http_parser.c
index 5650652..3a447f5 100644
--- a/ext/ruby_http_parser/ruby_http_parser.c
+++ b/ext/ruby_http_parser/ruby_http_parser.c
@@ -1,6 +1,6 @@
 #include "ruby.h"
 #include "ext_help.h"
-#include "ryah_http_parser.h"
+#include "http_parser.h"
 
 #define GET_WRAPPER(N, from)  ParserWrapper *N = (ParserWrapper *)(from)->data;
 #define HASH_CAT(h, k, ptr, len)                \
@@ -14,7 +14,7 @@
   } while(0)
 
 typedef struct ParserWrapper {
-  ryah_http_parser parser;
+  http_parser parser;
 
   VALUE request_url;
 
@@ -36,11 +36,11 @@ typedef struct ParserWrapper {
   VALUE last_field_name;
   VALUE curr_field_name;
 
-  enum ryah_http_parser_type type;
+  enum http_parser_type type;
 } ParserWrapper;
 
 void ParserWrapper_init(ParserWrapper *wrapper) {
-  ryah_http_parser_init(&wrapper->parser, wrapper->type);
+  http_parser_init(&wrapper->parser, wrapper->type);
   wrapper->parser.status_code = 0;
   wrapper->parser.http_major = 0;
   wrapper->parser.http_minor = 0;
@@ -98,7 +98,7 @@ static VALUE Smixed;
 
 /** Callbacks **/
 
-int on_message_begin(ryah_http_parser *parser) {
+int on_message_begin(http_parser *parser) {
   GET_WRAPPER(wrapper, parser);
 
   wrapper->request_url = rb_str_new2("");
@@ -121,13 +121,13 @@ int on_message_begin(ryah_http_parser *parser) {
   }
 }
 
-int on_url(ryah_http_parser *parser, const char *at, size_t length) {
+int on_url(http_parser *parser, const char *at, size_t length) {
   GET_WRAPPER(wrapper, parser);
   rb_str_cat(wrapper->request_url, at, length);
   return 0;
 }
 
-int on_header_field(ryah_http_parser *parser, const char *at, size_t length) {
+int on_header_field(http_parser *parser, const char *at, size_t length) {
   GET_WRAPPER(wrapper, parser);
 
   if (wrapper->curr_field_name == Qnil) {
@@ -140,7 +140,7 @@ int on_header_field(ryah_http_parser *parser, const char *at, size_t length) {
   return 0;
 }
 
-int on_header_value(ryah_http_parser *parser, const char *at, size_t length) {
+int on_header_value(http_parser *parser, const char *at, size_t length) {
   GET_WRAPPER(wrapper, parser);
 
   int new_field = 0;
@@ -186,7 +186,7 @@ int on_header_value(ryah_http_parser *parser, const char *at, size_t length) {
   return 0;
 }
 
-int on_headers_complete(ryah_http_parser *parser) {
+int on_headers_complete(http_parser *parser) {
   GET_WRAPPER(wrapper, parser);
 
   VALUE ret = Qnil;
@@ -207,7 +207,7 @@ int on_headers_complete(ryah_http_parser *parser) {
   }
 }
 
-int on_body(ryah_http_parser *parser, const char *at, size_t length) {
+int on_body(http_parser *parser, const char *at, size_t length) {
   GET_WRAPPER(wrapper, parser);
 
   VALUE ret = Qnil;
@@ -226,7 +226,7 @@ int on_body(ryah_http_parser *parser, const char *at, size_t length) {
   }
 }
 
-int on_message_complete(ryah_http_parser *parser) {
+int on_message_complete(http_parser *parser) {
   GET_WRAPPER(wrapper, parser);
 
   VALUE ret = Qnil;
@@ -246,7 +246,7 @@ int on_message_complete(ryah_http_parser *parser) {
   }
 }
 
-static ryah_http_parser_settings settings = {
+static http_parser_settings settings = {
   .on_message_begin = on_message_begin,
   .on_url = on_url,
   .on_header_field = on_header_field,
@@ -256,7 +256,7 @@ static ryah_http_parser_settings settings = {
   .on_message_complete = on_message_complete
 };
 
-VALUE Parser_alloc_by_type(VALUE klass, enum ryah_http_parser_type type) {
+VALUE Parser_alloc_by_type(VALUE klass, enum http_parser_type type) {
   ParserWrapper *wrapper = ALLOC_N(ParserWrapper, 1);
   wrapper->type = type;
   wrapper->parser.data = wrapper;
@@ -317,7 +317,7 @@ VALUE Parser_execute(VALUE self, VALUE data) {
   DATA_GET(self, ParserWrapper, wrapper);
 
   wrapper->stopped = Qfalse;
-  size_t nparsed = ryah_http_parser_execute(&wrapper->parser, &settings, ptr, len);
+  size_t nparsed = http_parser_execute(&wrapper->parser, &settings, ptr, len);
 
   if (wrapper->parser.upgrade) {
     if (RTEST(wrapper->stopped))
diff --git a/http_parser.rb.gemspec b/http_parser.rb.gemspec
index 9a406f8..c01c72e 100644
--- a/http_parser.rb.gemspec
+++ b/http_parser.rb.gemspec
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
   s.license = 'MIT'
 
   s.homepage = "http://github.com/tmm1/http_parser.rb"
-  s.files = `git ls-files`.split("\n") + Dir['ext/ruby_http_parser/vendor/**/*']
+#  s.files = `git ls-files`.split("\n") + Dir['ext/ruby_http_parser/vendor/**/*']
 
   s.require_paths = ["lib"]
   s.extensions    = ["ext/ruby_http_parser/extconf.rb"]
diff --git a/lib/http_parser.rb b/lib/http_parser.rb
index c69f7a0..c1300cd 100644
--- a/lib/http_parser.rb
+++ b/lib/http_parser.rb
@@ -1,4 +1,3 @@
-$:.unshift File.expand_path('../', __FILE__)
 require 'ruby_http_parser'
 
 Http = HTTP
diff --git a/spec/parser_spec.rb b/spec/parser_spec.rb
index 7134476..f904185 100644
--- a/spec/parser_spec.rb
+++ b/spec/parser_spec.rb
@@ -1,3 +1,7 @@
+if defined? Encoding
+  Encoding.default_external = "UTF-8"
+end
+
 require "spec_helper"
 require "json"
 

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



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