posix_mq 0.6.0 → 0.6.0.7.g3a8a

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -13,3 +13,4 @@ Makefile
13
13
  /pkg
14
14
  /doc
15
15
  /LATEST
16
+ /tmp
data/.manifest CHANGED
@@ -20,6 +20,7 @@ ext/posix_mq/extconf.rb
20
20
  ext/posix_mq/posix_mq.c
21
21
  lib/posix_mq.rb
22
22
  man/man1/posix-mq-rb.1
23
+ pkg.mk
23
24
  posix_mq.gemspec
24
25
  setup.rb
25
26
  test/test_posix_mq.rb
data/ChangeLog CHANGED
@@ -1,5 +1,72 @@
1
1
  ChangeLog from http://git.bogomips.org/cgit/ruby_posix_mq.git
2
2
 
3
+ commit 3a8a20d685dbfb500187099d76e56e848ad347ed
4
+ Author: Eric Wong <normalperson@yhbt.net>
5
+ Date: Tue Feb 22 16:46:26 2011 -0800
6
+
7
+ attempt to support systems w/o mq_timedsend/mq_timedreceive
8
+
9
+ Some ancient systems don't support mq_timedsend and
10
+ mq_timedreceive but somehow manage to support other POSIX
11
+ mq_* functions.
12
+
13
+ commit c4c4554c3ceef9208fe7f8473b970e9f522ab9b9
14
+ Author: Eric Wong <normalperson@yhbt.net>
15
+ Date: Tue Feb 22 15:41:22 2011 -0800
16
+
17
+ extconf: remove unnecessary dir_config statement
18
+
19
+ It's all standard C library stuff.
20
+
21
+ commit 5f1578c0d17b05f5158e467bd3abf18565fe1b4b
22
+ Author: Eric Wong <normalperson@yhbt.net>
23
+ Date: Tue Feb 22 15:32:40 2011 -0800
24
+
25
+ use StringValueCStr for paths
26
+
27
+ RSTRING_PTR may contain '\0' bytes which makes it unsuitable
28
+ for mq_unlink() and mq_open()
29
+
30
+ commit a5491670078b045ced2641649a6cfceee2cade10
31
+ Author: Eric Wong <normalperson@yhbt.net>
32
+ Date: Tue Feb 22 15:02:31 2011 -0800
33
+
34
+ fix broken rb_str_set_len() #define for Ruby 1.8.6
35
+
36
+ This was too aggressively deleted during cleanups for Rubinius
37
+ support in commit 5339d9d693c794c0f20270d5726cb360e31dff30
38
+
39
+ Noticed-by: Tadeusz Bochan <tad.bochan@bnpparibas.com>
40
+ ref: 2a92695fc1958e0370782284c6196625@ruby-forum.com
41
+
42
+ commit 7144a4e325f77e3fa41ade00f5cef5612908a7e9
43
+ Author: Eric Wong <normalperson@yhbt.net>
44
+ Date: Tue Feb 22 14:50:59 2011 -0800
45
+
46
+ fix for systems that can't convert mqd_t to FD
47
+
48
+ Apparently there are OSes that don't have methods to convert
49
+ mqd_t to FD.
50
+
51
+ Noticed-by: Tadeusz Bochan <tad.bochan@bnpparibas.com>
52
+ ref: <2a92695fc1958e0370782284c6196625@ruby-forum.com>
53
+
54
+ commit de45521943e838122a82492ec03c58b78b6adf1e
55
+ Author: Eric Wong <normalperson@yhbt.net>
56
+ Date: Tue Feb 22 14:39:31 2011 -0800
57
+
58
+ switch to pkg.mk for packaging needs
59
+
60
+ I can't stand Rake :x
61
+
62
+ commit 9edc6946bbd4cc4be55ca4293135189c3db356c6
63
+ Author: Eric Wong <normalperson@yhbt.net>
64
+ Date: Sun Dec 26 01:25:27 2010 +0000
65
+
66
+ publish_news target is less braindead
67
+
68
+ Run it by default on releases.
69
+
3
70
  commit 88e85b58f3cb0796a680c86d83c16c305c33b098
4
71
  Author: Eric Wong <normalperson@yhbt.net>
5
72
  Date: Sat Dec 25 00:23:03 2010 -0800
data/GIT-VERSION-FILE CHANGED
@@ -1 +1 @@
1
- GIT_VERSION = 0.6.0
1
+ GIT_VERSION = 0.6.0.7.g3a8a
data/GNUmakefile CHANGED
@@ -1,18 +1,15 @@
1
- # use GNU Make to run tests in parallel, and without depending on RubyGems
2
1
  all::
3
- RUBY = ruby
4
- RAKE = rake
5
- RSYNC = rsync
6
-
7
- GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
8
- @./GIT-VERSION-GEN
9
- -include GIT-VERSION-FILE
10
- -include local.mk
11
- ifeq ($(DLEXT),) # "so" for Linux
12
- DLEXT := $(shell $(RUBY) -rrbconfig -e 'puts Config::CONFIG["DLEXT"]')
13
- endif
14
- ifeq ($(RUBY_VERSION),)
15
- RUBY_VERSION := $(shell $(RUBY) -e 'puts RUBY_VERSION')
2
+ RSYNC_DEST := bogomips.org:/srv/bogomips/ruby_posix_mq
3
+ rfproject := qrp
4
+ rfpackage := posix_mq
5
+ man-rdoc: man html
6
+ for i in $(man1_rdoc); do echo > $$i; done
7
+ doc:: man-rdoc
8
+ include pkg.mk
9
+ ifneq ($(VERSION),)
10
+ release::
11
+ $(RAKE) raa_update VERSION=$(VERSION)
12
+ $(RAKE) publish_news VERSION=$(VERSION)
16
13
  endif
17
14
 
18
15
  base_bins := posix-mq-rb
@@ -21,146 +18,14 @@ man1_rdoc := $(addsuffix _1, $(base_bins))
21
18
  man1_bins := $(addsuffix .1, $(base_bins))
22
19
  man1_paths := $(addprefix man/man1/, $(man1_bins))
23
20
 
24
- install: $(bins)
25
- $(prep_setup_rb)
26
- $(RM) -r .install-tmp
27
- mkdir .install-tmp
28
- cp -p bin/* .install-tmp
29
- $(RUBY) setup.rb all
30
- $(RM) $^
31
- mv .install-tmp/* bin/
32
- $(RM) -r .install-tmp
33
- $(prep_setup_rb)
34
-
35
- setup_rb_files := .config InstalledFiles
36
- prep_setup_rb := @-$(RM) $(setup_rb_files);$(MAKE) -C $(ext) clean
37
-
38
21
  clean:
39
- -$(MAKE) -C ext/posix_mq clean
40
- $(RM) $(setup_rb_files) ext/posix_mq/Makefile
22
+ -$(MAKE) -C Documentation clean
41
23
 
42
24
  man html:
43
25
  $(MAKE) -C Documentation install-$@
44
26
 
45
- pkg_extra := GIT-VERSION-FILE NEWS ChangeLog LATEST
46
- manifest: $(pkg_extra) man
47
- $(RM) .manifest
48
- $(MAKE) .manifest
49
-
50
- .manifest:
51
- (git ls-files && \
52
- for i in $@ $(pkg_extra) $(man1_paths); \
53
- do echo $$i; done) | LC_ALL=C sort > $@+
54
- cmp $@+ $@ || mv $@+ $@
55
- $(RM) $@+
27
+ pkg_extra += $(man1_paths)
56
28
 
57
- ChangeLog: GIT-VERSION-FILE
58
- wrongdoc prepare
59
-
60
- doc: .document NEWS ChangeLog man html
61
- for i in $(man1_rdoc); do > $$i; done
62
- $(RM) -r doc
63
- wrongdoc all
64
- install -m644 COPYING doc/COPYING
65
- install -m644 $(shell grep '^[A-Z]' .document) doc/
66
- install -m644 $(man1_paths) doc/
29
+ doc::
67
30
  $(RM) $(man1_rdoc)
68
-
69
- ifneq ($(VERSION),)
70
- rfproject := qrp
71
- rfpackage := posix_mq
72
- pkggem := pkg/$(rfpackage)-$(VERSION).gem
73
- pkgtgz := pkg/$(rfpackage)-$(VERSION).tgz
74
- release_notes := release_notes-$(VERSION)
75
- release_changes := release_changes-$(VERSION)
76
-
77
- release-notes: $(release_notes)
78
- release-changes: $(release_changes)
79
- $(release_changes):
80
- wrongdoc release_changes > $@+
81
- $(VISUAL) $@+ && test -s $@+ && mv $@+ $@
82
- $(release_notes):
83
- wrongdoc release_notes > $@+
84
- $(VISUAL) $@+ && test -s $@+ && mv $@+ $@
85
-
86
- # ensures we're actually on the tagged $(VERSION), only used for release
87
- verify:
88
- test x"$(shell umask)" = x0022
89
- git rev-parse --verify refs/tags/v$(VERSION)^{}
90
- git diff-index --quiet HEAD^0
91
- test `git rev-parse --verify HEAD^0` = \
92
- `git rev-parse --verify refs/tags/v$(VERSION)^{}`
93
-
94
- fix-perms:
95
- -git ls-tree -r HEAD | awk '/^100644 / {print $$NF}' | xargs chmod 644
96
- -git ls-tree -r HEAD | awk '/^100755 / {print $$NF}' | xargs chmod 755
97
-
98
- gem: $(pkggem)
99
-
100
- install-gem: $(pkggem)
101
- gem install $(CURDIR)/$<
102
-
103
- $(pkggem): manifest fix-perms
104
- gem build $(rfpackage).gemspec
105
- mkdir -p pkg
106
- mv $(@F) $@
107
-
108
- $(pkgtgz): distdir = $(basename $@)
109
- $(pkgtgz): HEAD = v$(VERSION)
110
- $(pkgtgz): manifest fix-perms
111
- @test -n "$(distdir)"
112
- $(RM) -r $(distdir)
113
- mkdir -p $(distdir)
114
- tar c `cat .manifest` | (cd $(distdir) && tar x)
115
- cd pkg && tar c $(basename $(@F)) | gzip -9 > $(@F)+
116
- mv $@+ $@
117
-
118
- package: $(pkgtgz) $(pkggem)
119
-
120
- test-release: verify package $(release_notes) $(release_changes)
121
- release: verify package $(release_notes) $(release_changes)
122
- # make tgz release on RubyForge
123
- rubyforge add_release -f -n $(release_notes) -a $(release_changes) \
124
- $(rfproject) $(rfpackage) $(VERSION) $(pkgtgz)
125
- # push gem to Gemcutter
126
- gem push $(pkggem)
127
- # in case of gem downloads from RubyForge releases page
128
- -rubyforge add_file \
129
- $(rfproject) $(rfpackage) $(VERSION) $(pkggem)
130
- else
131
- gem install-gem: GIT-VERSION-FILE
132
- $(MAKE) $@ VERSION=$(GIT_VERSION)
133
- endif
134
-
135
- ext := ext/posix_mq/posix_mq_ext.$(DLEXT)
136
- ext/posix_mq/Makefile: ext/posix_mq/extconf.rb
137
- cd $(@D) && $(RUBY) extconf.rb
138
- $(ext): $(wildcard $(addprefix ext/posix_mq/,*.c *.h)) ext/posix_mq/Makefile
139
- $(MAKE) -C $(@D)
140
-
141
- all:: test
142
-
143
- build: $(ext)
144
- test: test-unit
145
- test-unit: build
146
- $(RUBY) -I lib:ext/posix_mq test/test_posix_mq.rb
147
-
148
- # publishes docs to http://bogomips.org/ruby_posix_mq/
149
- publish_doc:
150
- -git set-file-times
151
- $(RM) -r doc
152
- $(MAKE) doc
153
- find doc/images -type f | \
154
- TZ=UTC xargs touch -d '1970-01-01 00:00:03' doc/rdoc.css
155
- $(MAKE) doc_gz
156
- $(RSYNC) -av doc/ bogomips.org:/srv/bogomips/ruby_posix_mq/
157
- git ls-files | xargs touch
158
-
159
- # Create gzip variants of the same timestamp as the original so nginx
160
- # "gzip_static on" can serve the gzipped versions directly.
161
- doc_gz: docs = $(shell find doc -type f ! -regex '^.*\.\(gif\|jpg\|png\|gz\)$$')
162
- doc_gz:
163
- for i in $(docs); do \
164
- gzip --rsyncable -9 < $$i > $$i.gz; touch -r $$i $$i.gz; done
165
-
166
- .PHONY: .FORCE-GIT-VERSION-FILE doc manifest man test html
31
+ .PHONY: man html
data/LATEST CHANGED
@@ -1,4 +1,4 @@
1
- === posix_mq 0.6.0 - Rubinius support /
1
+ === posix_mq 0.6.0 - Rubinius support / 2010-12-25 08:28 UTC
2
2
 
3
3
  Rubinius 1.2 as well as Ruby 1.9. Ruby 1.8 works except it will
4
4
  block the entire interpreter for blocking operations. Spurious
data/Rakefile CHANGED
@@ -1,12 +1,26 @@
1
1
  # -*- encoding: binary -*-
2
- cgit_url = "http://git.bogomips.org/cgit/ruby_posix_mq.git"
3
- git_url = 'git://git.bogomips.org/ruby_posix_mq.git'
2
+ require 'wrongdoc'
3
+ cgit_url = Wrongdoc.config[:cgit_url]
4
+ git_url = Wrongdoc.config[:git_url]
4
5
 
5
- desc "read news article from STDIN and post to rubyforge"
6
+ desc "post news article to rubyforge"
6
7
  task :publish_news do
7
8
  require 'rubyforge'
8
- IO.select([STDIN], nil, nil, 1) or abort "E: news must be read from stdin"
9
- msg = STDIN.readlines
9
+ spec = Gem::Specification.load('posix_mq.gemspec')
10
+ tmp = Tempfile.new('rf-news')
11
+ _, subject, body = `git cat-file tag v#{spec.version}`.split(/\n\n/, 3)
12
+ tmp.puts subject
13
+ tmp.puts
14
+ tmp.puts spec.description.strip
15
+ tmp.puts ""
16
+ tmp.puts "* #{spec.homepage}"
17
+ tmp.puts "* #{spec.email}"
18
+ tmp.puts "* #{git_url}"
19
+ tmp.print "\nChanges:\n\n"
20
+ tmp.puts body
21
+ tmp.flush
22
+ system(ENV["VISUAL"], tmp.path) or abort "#{ENV["VISUAL"]} failed: #$?"
23
+ msg = File.readlines(tmp.path)
10
24
  subject = msg.shift
11
25
  blank = msg.shift
12
26
  blank == "\n" or abort "no newline after subject!"
@@ -10,5 +10,7 @@ have_func('rb_thread_blocking_region')
10
10
  have_library("m")
11
11
  have_library("rt")
12
12
  have_library("pthread")
13
- dir_config("posix_mq")
13
+
14
+ have_func("mq_timedsend")
15
+ have_func("mq_timedreceive")
14
16
  create_makefile("posix_mq_ext")
@@ -32,7 +32,7 @@
32
32
  # define MQ_IO_MARK(mq) ((void)(0))
33
33
  # define MQ_IO_SET(mq,val) ((void)(0))
34
34
  # define MQ_IO_CLOSE(mq) ((void)(0))
35
- # define MQ_IO_NILP(mq) ((void)(1))
35
+ # define MQ_IO_NIL_P(mq) ((void)(1))
36
36
  #endif
37
37
 
38
38
  struct posix_mq {
@@ -89,6 +89,7 @@ static void rb_18_str_set_len(VALUE str, long len)
89
89
  RSTRING(str)->len = len;
90
90
  RSTRING(str)->ptr[len] = '\0';
91
91
  }
92
+ #define rb_str_set_len rb_18_str_set_len
92
93
  #endif /* !defined(HAVE_RB_STR_SET_LEN) */
93
94
 
94
95
  /* partial emulation of the 1.9 rb_thread_blocking_region under 1.8 */
@@ -132,6 +133,30 @@ struct rw_args {
132
133
  struct timespec *timeout;
133
134
  };
134
135
 
136
+ #ifndef HAVE_MQ_TIMEDSEND
137
+ static mqd_t
138
+ not_timedsend(mqd_t mqdes, const char *msg_ptr,
139
+ size_t msg_len, unsigned msg_prio,
140
+ const struct timespec *abs_timeout)
141
+ {
142
+ rb_bug("mq_timedsend workaround failed");
143
+ return (mqd_t)-1;
144
+ }
145
+ # define mq_timedsend not_timedsend
146
+ #endif
147
+ #ifndef HAVE_MQ_TIMEDRECEIVE
148
+ static ssize_t
149
+ not_timedreceive(mqd_t mqdes, char *msg_ptr,
150
+ size_t msg_len, unsigned *msg_prio,
151
+ const struct timespec *abs_timeout)
152
+ {
153
+ rb_bug("mq_timedreceive workaround failed");
154
+ return (mqd_t)-1;
155
+ }
156
+ # define mq_timedreceive not_timedreceive
157
+ #endif
158
+
159
+ #if defined(HAVE_MQ_TIMEDRECEIVE) && defined(HAVE_MQ_TIMEDSEND)
135
160
  static void num2timespec(struct timespec *ts, VALUE t)
136
161
  {
137
162
  switch (TYPE(t)) {
@@ -173,6 +198,13 @@ static void num2timespec(struct timespec *ts, VALUE t)
173
198
  }
174
199
  }
175
200
  }
201
+ #else
202
+ static void num2timespec(struct timespec *ts, VALUE t)
203
+ {
204
+ rb_raise(rb_eNotImpError,
205
+ "mq_timedsend and/or mq_timedreceive missing");
206
+ }
207
+ #endif
176
208
 
177
209
  static struct timespec *convert_timeout(struct timespec *dest, VALUE t)
178
210
  {
@@ -345,9 +377,6 @@ static VALUE init(int argc, VALUE *argv, VALUE self)
345
377
 
346
378
  rb_scan_args(argc, argv, "13", &name, &oflags, &mode, &attr);
347
379
 
348
- if (TYPE(name) != T_STRING)
349
- rb_raise(rb_eArgError, "name must be a string");
350
-
351
380
  switch (TYPE(oflags)) {
352
381
  case T_NIL:
353
382
  x.oflags = O_RDONLY;
@@ -374,7 +403,7 @@ static VALUE init(int argc, VALUE *argv, VALUE self)
374
403
  rb_raise(rb_eArgError, "flags must be an int, :r, :w, or :wr");
375
404
  }
376
405
 
377
- x.name = RSTRING_PTR(name);
406
+ x.name = StringValueCStr(name);
378
407
  x.argc = 2;
379
408
 
380
409
  switch (TYPE(mode)) {
@@ -433,12 +462,8 @@ static VALUE init(int argc, VALUE *argv, VALUE self)
433
462
  */
434
463
  static VALUE s_unlink(VALUE self, VALUE name)
435
464
  {
436
- mqd_t rv;
437
-
438
- if (TYPE(name) != T_STRING)
439
- rb_raise(rb_eArgError, "argument must be a string");
465
+ mqd_t rv = mq_unlink(StringValueCStr(name));
440
466
 
441
- rv = mq_unlink(RSTRING_PTR(name));
442
467
  if (rv == MQD_INVALID)
443
468
  rb_sys_fail("mq_unlink");
444
469
 
@@ -130,13 +130,13 @@ This may not be used in conjunction with --nonblock.
130
130
  Output the priority of the received message to stderr in the
131
131
  following format:
132
132
  .RS
133
- .RE
134
133
  .PP
135
134
  \f[CR]
136
- \ \ \ \ priority=3
137
-
138
- The\ priority\ is\ an\ unsigned\ integer.
135
+ priority=3
139
136
  \f[]
137
+ .PP
138
+ The priority is an unsigned integer.
139
+ .RE
140
140
  .SH WAIT USAGE
141
141
  .PP
142
142
  The \f[I]wait\f[] command will cause posix-mq-rb(1) to sleep until
data/pkg.mk ADDED
@@ -0,0 +1,171 @@
1
+ RUBY = ruby
2
+ RAKE = rake
3
+ RSYNC = rsync
4
+ WRONGDOC = wrongdoc
5
+
6
+ GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
7
+ @./GIT-VERSION-GEN
8
+ -include GIT-VERSION-FILE
9
+ -include local.mk
10
+ DLEXT := $(shell $(RUBY) -rrbconfig -e 'puts RbConfig::CONFIG["DLEXT"]')
11
+ RUBY_VERSION := $(shell $(RUBY) -e 'puts RUBY_VERSION')
12
+ RUBY_ENGINE := $(shell $(RUBY) -e 'puts((RUBY_ENGINE rescue "ruby"))')
13
+ lib := lib
14
+
15
+ ifeq ($(shell test -f script/isolate_for_tests && echo t),t)
16
+ isolate_libs := tmp/isolate/$(RUBY_ENGINE)-$(RUBY_VERSION)/isolate.mk
17
+ $(isolate_libs): script/isolate_for_tests
18
+ @$(RUBY) script/isolate_for_tests
19
+ -include $(isolate_libs)
20
+ lib := $(lib):$(ISOLATE_LIBS)
21
+ endif
22
+
23
+ ext := $(firstword $(wildcard ext/*))
24
+ ifneq ($(ext),)
25
+ ext_pfx := tmp/ext/$(RUBY_ENGINE)-$(RUBY_VERSION)
26
+ ext_h := $(wildcard $(ext)/*/*.h $(ext)/*.h)
27
+ ext_src := $(wildcard $(ext)/*.c $(ext_h))
28
+ ext_pfx_src := $(addprefix $(ext_pfx)/,$(ext_src))
29
+ ext_d := $(ext_pfx)/$(ext)/.d
30
+ $(ext)/extconf.rb: $(wildcard $(ext)/*.h)
31
+ @>> $@
32
+ $(ext_d):
33
+ @mkdir -p $(@D)
34
+ @> $@
35
+ $(ext_pfx)/$(ext)/%: $(ext)/% $(ext_d)
36
+ install -m 644 $< $@
37
+ $(ext_pfx)/$(ext)/Makefile: $(ext)/extconf.rb $(ext_d) $(ext_h)
38
+ $(RM) -f $(@D)/*.o
39
+ cd $(@D) && $(RUBY) $(CURDIR)/$(ext)/extconf.rb
40
+ ext_sfx := _ext.$(DLEXT)
41
+ ext_dl := $(ext_pfx)/$(ext)/$(notdir $(ext)_ext.$(DLEXT))
42
+ $(ext_dl): $(ext_src) $(ext_pfx_src) $(ext_pfx)/$(ext)/Makefile
43
+ @echo $^ == $@
44
+ $(MAKE) -C $(@D)
45
+ lib := $(lib):$(ext_pfx)/$(ext)
46
+ build: $(ext_dl)
47
+ else
48
+ build:
49
+ endif
50
+
51
+ pkg_extra += GIT-VERSION-FILE NEWS ChangeLog LATEST
52
+ ChangeLog: GIT-VERSION-FILE .wrongdoc.yml
53
+ $(WRONGDOC) prepare
54
+ NEWS LATEST: ChangeLog
55
+
56
+ manifest:
57
+ $(RM) .manifest
58
+ $(MAKE) .manifest
59
+
60
+ .manifest: $(pkg_extra)
61
+ (git ls-files && for i in $@ $(pkg_extra); do echo $$i; done) | \
62
+ LC_ALL=C sort > $@+
63
+ cmp $@+ $@ || mv $@+ $@
64
+ $(RM) $@+
65
+
66
+ doc:: .document .wrongdoc.yml $(pkg_extra)
67
+ -find lib -type f -name '*.rbc' -exec rm -f '{}' ';'
68
+ -find ext -type f -name '*.rbc' -exec rm -f '{}' ';'
69
+ $(RM) -r doc
70
+ $(WRONGDOC) all
71
+ install -m644 COPYING doc/COPYING
72
+ install -m644 $(shell grep '^[A-Z]' .document) doc/
73
+
74
+ ifneq ($(VERSION),)
75
+ pkggem := pkg/$(rfpackage)-$(VERSION).gem
76
+ pkgtgz := pkg/$(rfpackage)-$(VERSION).tgz
77
+ release_notes := release_notes-$(VERSION)
78
+ release_changes := release_changes-$(VERSION)
79
+
80
+ release-notes: $(release_notes)
81
+ release-changes: $(release_changes)
82
+ $(release_changes):
83
+ $(WRONGDOC) release_changes > $@+
84
+ $(VISUAL) $@+ && test -s $@+ && mv $@+ $@
85
+ $(release_notes):
86
+ $(WRONGDOC) release_notes > $@+
87
+ $(VISUAL) $@+ && test -s $@+ && mv $@+ $@
88
+
89
+ # ensures we're actually on the tagged $(VERSION), only used for release
90
+ verify:
91
+ test x"$(shell umask)" = x0022
92
+ git rev-parse --verify refs/tags/v$(VERSION)^{}
93
+ git diff-index --quiet HEAD^0
94
+ test $$(git rev-parse --verify HEAD^0) = \
95
+ $$(git rev-parse --verify refs/tags/v$(VERSION)^{})
96
+
97
+ fix-perms:
98
+ -git ls-tree -r HEAD | awk '/^100644 / {print $$NF}' | xargs chmod 644
99
+ -git ls-tree -r HEAD | awk '/^100755 / {print $$NF}' | xargs chmod 755
100
+
101
+ gem: $(pkggem)
102
+
103
+ install-gem: $(pkggem)
104
+ gem install $(CURDIR)/$<
105
+
106
+ $(pkggem): manifest fix-perms
107
+ gem build $(rfpackage).gemspec
108
+ mkdir -p pkg
109
+ mv $(@F) $@
110
+
111
+ $(pkgtgz): distdir = $(basename $@)
112
+ $(pkgtgz): HEAD = v$(VERSION)
113
+ $(pkgtgz): manifest fix-perms
114
+ @test -n "$(distdir)"
115
+ $(RM) -r $(distdir)
116
+ mkdir -p $(distdir)
117
+ tar cf - $$(cat .manifest) | (cd $(distdir) && tar xf -)
118
+ cd pkg && tar cf - $(basename $(@F)) | gzip -9 > $(@F)+
119
+ mv $@+ $@
120
+
121
+ package: $(pkgtgz) $(pkggem)
122
+
123
+ test-release:: verify package $(release_notes) $(release_changes)
124
+ # make tgz release on RubyForge
125
+ @echo rubyforge add_release -f \
126
+ -n $(release_notes) -a $(release_changes) \
127
+ $(rfproject) $(rfpackage) $(VERSION) $(pkgtgz)
128
+ @echo gem push $(pkggem)
129
+ @echo rubyforge add_file \
130
+ $(rfproject) $(rfpackage) $(VERSION) $(pkggem)
131
+ release:: verify package $(release_notes) $(release_changes)
132
+ # make tgz release on RubyForge
133
+ rubyforge add_release -f -n $(release_notes) -a $(release_changes) \
134
+ $(rfproject) $(rfpackage) $(VERSION) $(pkgtgz)
135
+ # push gem to RubyGems.org
136
+ gem push $(pkggem)
137
+ # in case of gem downloads from RubyForge releases page
138
+ rubyforge add_file \
139
+ $(rfproject) $(rfpackage) $(VERSION) $(pkggem)
140
+ else
141
+ gem install-gem: GIT-VERSION-FILE
142
+ $(MAKE) $@ VERSION=$(GIT_VERSION)
143
+ endif
144
+
145
+ all:: test
146
+ test_units := $(wildcard test/test_*.rb)
147
+ test: test-unit
148
+ test-unit: $(test_units)
149
+ $(test_units): build
150
+ $(RUBY) -I $(lib) $@ $(RUBY_TEST_OPTS)
151
+
152
+ # this requires GNU coreutils variants
153
+ ifneq ($(RSYNC_DEST),)
154
+ publish_doc:
155
+ -git set-file-times
156
+ $(MAKE) doc
157
+ find doc/images -type f | \
158
+ TZ=UTC xargs touch -d '1970-01-01 00:00:06' doc/rdoc.css
159
+ $(MAKE) doc_gz
160
+ $(RSYNC) -av doc/ $(RSYNC_DEST)/
161
+ git ls-files | xargs touch
162
+ endif
163
+
164
+ # Create gzip variants of the same timestamp as the original so nginx
165
+ # "gzip_static on" can serve the gzipped versions directly.
166
+ doc_gz: docs = $(shell find doc -type f ! -regex '^.*\.\(gif\|jpg\|png\|gz\)$$')
167
+ doc_gz:
168
+ for i in $(docs); do \
169
+ gzip --rsyncable -9 < $$i > $$i.gz; touch -r $$i $$i.gz; done
170
+
171
+ .PHONY: all .FORCE-GIT-VERSION-FILE doc test $(test_units) manifest
data/posix_mq.gemspec CHANGED
@@ -19,10 +19,9 @@ Gem::Specification.new do |s|
19
19
  s.homepage = Wrongdoc.config[:rdoc_url]
20
20
  s.summary = summary
21
21
  s.rdoc_options = rdoc_options
22
- s.require_paths = %w(lib)
23
22
  s.rubyforge_project = %q{qrp}
24
23
  s.test_files = manifest.grep(%r{\Atest/test_.*\.rb\z})
25
- s.add_development_dependency(%q<wrongdoc>, "~> 1.0")
24
+ s.add_development_dependency(%q<wrongdoc>, "~> 1.5")
26
25
 
27
26
  # s.licenses = %w(LGPLv3) # accessor not compatible with older RubyGems
28
27
  end
@@ -25,6 +25,14 @@ class Test_POSIX_MQ < Test::Unit::TestCase
25
25
  assert @mq.closed?
26
26
  end
27
27
 
28
+ def test_open_with_null_byte
29
+ assert_raises(ArgumentError) { POSIX_MQ.open("/hello\0world", :rw) }
30
+ end
31
+
32
+ def test_unlink_with_null_byte
33
+ assert_raises(ArgumentError) { POSIX_MQ.open("/hello\0world", :rw) }
34
+ end
35
+
28
36
  def test_gc
29
37
  assert_nothing_raised do
30
38
  2025.times { POSIX_MQ.new(@path, :rw) }
@@ -54,7 +62,7 @@ class Test_POSIX_MQ < Test::Unit::TestCase
54
62
  @mq = POSIX_MQ.new(@path, :rw)
55
63
  assert ! @mq.nonblock?
56
64
  t0 = Time.now
57
- assert_raises(Errno::ETIMEDOUT) { @mq.receive "", interval }
65
+ maybe_timeout { @mq.receive "", interval } or return
58
66
  elapsed = Time.now - t0
59
67
  assert elapsed > interval, elapsed.inspect
60
68
  assert elapsed < 0.02, elapsed.inspect
@@ -68,7 +76,7 @@ class Test_POSIX_MQ < Test::Unit::TestCase
68
76
  @mq = POSIX_MQ.new(@path, :rw)
69
77
  assert ! @mq.nonblock?
70
78
  t0 = Time.now
71
- assert_raises(Errno::ETIMEDOUT) { @mq.receive "", interval }
79
+ maybe_timeout { @mq.receive "", interval } or return
72
80
  elapsed = Time.now - t0
73
81
  assert elapsed >= 0.01, elapsed.inspect
74
82
  assert elapsed <= 0.02, elapsed.inspect
@@ -79,7 +87,7 @@ class Test_POSIX_MQ < Test::Unit::TestCase
79
87
  @mq = POSIX_MQ.new(@path, :rw)
80
88
  assert ! @mq.nonblock?
81
89
  t0 = Time.now
82
- assert_raises(Errno::ETIMEDOUT) { @mq.receive "", interval }
90
+ maybe_timeout { @mq.receive "", interval } or return
83
91
  elapsed = Time.now - t0
84
92
  assert elapsed >= interval, elapsed.inspect
85
93
  assert elapsed < 1.10, elapsed.inspect
@@ -89,9 +97,15 @@ class Test_POSIX_MQ < Test::Unit::TestCase
89
97
  interval = 0.01
90
98
  @mq = POSIX_MQ.new(@path, :rw, 0666, POSIX_MQ::Attr[0, 1, 1, 0])
91
99
  assert ! @mq.nonblock?
92
- assert_nothing_raised { @mq.send "A", 1, interval }
100
+ assert_nothing_raised {
101
+ begin
102
+ @mq.send "A", 1, interval
103
+ rescue NotImplementedError
104
+ return
105
+ end
106
+ }
93
107
  t0 = Time.now
94
- assert_raises(Errno::ETIMEDOUT) { @mq.send "B", 1, interval }
108
+ maybe_timeout { @mq.send "B", 1, interval } or return
95
109
  elapsed = Time.now - t0
96
110
  assert elapsed > interval
97
111
  end
@@ -336,4 +350,15 @@ class Test_POSIX_MQ < Test::Unit::TestCase
336
350
  assert_raises(TypeError) { @mq.attr = {} }
337
351
  assert_raises(TypeError) { @mq.attr = Struct.new(:a,:b,:c,:d).new }
338
352
  end
353
+
354
+ def maybe_timeout
355
+ yield
356
+ assert_raises(exc) { } # FAIL
357
+ return true
358
+ rescue Errno::ETIMEDOUT => e
359
+ return true
360
+ rescue NotImplementedError => e
361
+ warn "E: #{e}"
362
+ return false
363
+ end
339
364
  end
metadata CHANGED
@@ -1,13 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: posix_mq
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
5
- prerelease: false
4
+ hash: 4974
5
+ prerelease: 8
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
9
  - 0
10
- version: 0.6.0
10
+ - 7
11
+ - g
12
+ - 3
13
+ - a
14
+ - 8
15
+ - a
16
+ version: 0.6.0.7.g3a8a
11
17
  platform: ruby
12
18
  authors:
13
19
  - Ruby POSIX MQ hackers
@@ -15,7 +21,7 @@ autorequire:
15
21
  bindir: bin
16
22
  cert_chain: []
17
23
 
18
- date: 2010-12-25 00:00:00 +00:00
24
+ date: 2011-02-23 00:00:00 -08:00
19
25
  default_executable:
20
26
  dependencies:
21
27
  - !ruby/object:Gem::Dependency
@@ -26,11 +32,11 @@ dependencies:
26
32
  requirements:
27
33
  - - ~>
28
34
  - !ruby/object:Gem::Version
29
- hash: 15
35
+ hash: 5
30
36
  segments:
31
37
  - 1
32
- - 0
33
- version: "1.0"
38
+ - 5
39
+ version: "1.5"
34
40
  type: :development
35
41
  version_requirements: *id001
36
42
  description: |-
@@ -73,6 +79,7 @@ files:
73
79
  - ext/posix_mq/posix_mq.c
74
80
  - lib/posix_mq.rb
75
81
  - man/man1/posix-mq-rb.1
82
+ - pkg.mk
76
83
  - posix_mq.gemspec
77
84
  - setup.rb
78
85
  - test/test_posix_mq.rb
@@ -100,16 +107,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
100
107
  required_rubygems_version: !ruby/object:Gem::Requirement
101
108
  none: false
102
109
  requirements:
103
- - - ">="
110
+ - - ">"
104
111
  - !ruby/object:Gem::Version
105
- hash: 3
112
+ hash: 25
106
113
  segments:
107
- - 0
108
- version: "0"
114
+ - 1
115
+ - 3
116
+ - 1
117
+ version: 1.3.1
109
118
  requirements: []
110
119
 
111
120
  rubyforge_project: qrp
112
- rubygems_version: 1.3.7
121
+ rubygems_version: 1.5.2
113
122
  signing_key:
114
123
  specification_version: 3
115
124
  summary: POSIX Message Queues for Ruby