bleak_house 4.6 → 5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +8 -61
- data/{LICENSE → LICENSE_AFL} +0 -0
- data/Manifest +22 -21
- data/README +25 -109
- data/Rakefile +101 -9
- data/init.rb +2 -0
- data/install.rb +7 -0
- data/lib/bleak_house.rb +8 -17
- data/{LICENSE_BSD → lib/bleak_house/LICENSE_BSD} +0 -0
- data/lib/bleak_house/action_controller.rb +16 -0
- data/lib/bleak_house/analyze.rb +135 -0
- data/lib/bleak_house/bleak_house.rb +43 -0
- data/lib/bleak_house/c.rb +184 -0
- data/lib/bleak_house/dispatcher.rb +20 -0
- data/lib/bleak_house/gruff_hacks.rb +62 -0
- data/lib/bleak_house/mem_logger.rb +15 -0
- data/lib/bleak_house/rake_task_redefine_task.rb +25 -0
- data/lib/bleak_house/ruby.rb +46 -0
- data/lib/bleak_house/support_methods.rb +47 -0
- data/patches/gc.c.patch +30 -0
- data/tasks/bleak_house_tasks.rake +14 -0
- data/test/unit/test_bleak_house.rb +31 -41
- metadata +81 -101
- data.tar.gz.sig +0 -0
- data/TODO +0 -10
- data/bin/bleak +0 -13
- data/bleak_house.gemspec +0 -36
- data/ext/build_ruby.rb +0 -114
- data/ext/build_snapshot.rb +0 -5
- data/ext/extconf.rb +0 -26
- data/ext/snapshot.c +0 -151
- data/ext/snapshot.h +0 -59
- data/lib/bleak_house/analyzer.rb +0 -54
- data/lib/bleak_house/hook.rb +0 -24
- data/ruby/ruby-1.8.7-p174.tar.bz2 +0 -0
- data/ruby/ruby-1.8.7.patch +0 -483
- data/test/benchmark/bench.rb +0 -16
- data/test/test_helper.rb +0 -6
- metadata.gz.sig +0 -0
data/patches/gc.c.patch
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
Index: gc.c
|
2
|
+
===================================================================
|
3
|
+
RCS file: /src/ruby/gc.c,v
|
4
|
+
retrieving revision 1.168.2.45
|
5
|
+
diff -p -u -r1.168.2.45 gc.c
|
6
|
+
--- gc.c 25 Aug 2006 08:12:46 -0000 1.168.2.45
|
7
|
+
+++ gc.c 31 Aug 2006 18:47:55 -0000
|
8
|
+
@@ -323,6 +323,22 @@ static struct heaps_slot {
|
9
|
+
static int heaps_length = 0;
|
10
|
+
static int heaps_used = 0;
|
11
|
+
|
12
|
+
+struct heaps_slot *
|
13
|
+
+rb_gc_heap_slots()
|
14
|
+
+{
|
15
|
+
+ return heaps;
|
16
|
+
+}
|
17
|
+
+
|
18
|
+
+int
|
19
|
+
+rb_gc_heaps_used() {
|
20
|
+
+ return heaps_used;
|
21
|
+
+}
|
22
|
+
+
|
23
|
+
+int
|
24
|
+
+rb_gc_heaps_length() {
|
25
|
+
+ return heaps_length;
|
26
|
+
+}
|
27
|
+
+
|
28
|
+
#define HEAP_MIN_SLOTS 10000
|
29
|
+
static int heap_slots = HEAP_MIN_SLOTS;
|
30
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
|
2
|
+
namespace :bleak_house do
|
3
|
+
desc 'Analyze and chart all data'
|
4
|
+
task :analyze do
|
5
|
+
begin
|
6
|
+
gem 'gruff', '= 0.2.8'
|
7
|
+
require "#{File.dirname(__FILE__)}/../lib/bleak_house/analyze"
|
8
|
+
rescue LoadError
|
9
|
+
require 'bleak_house/analyze'
|
10
|
+
end
|
11
|
+
BleakHouse::Analyze.build_all("#{RAILS_ROOT}/log/bleak_house_#{RAILS_ENV}.dump")
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
@@ -1,58 +1,48 @@
|
|
1
1
|
|
2
|
-
|
2
|
+
DIR = File.dirname(__FILE__) + "/../../"
|
3
3
|
|
4
|
-
ENV['NO_EXIT_HANDLER'] = "1"
|
5
|
-
|
6
|
-
require 'bleak_house'
|
7
4
|
require 'rubygems'
|
8
|
-
require 'echoe'
|
9
5
|
require 'test/unit'
|
10
|
-
|
6
|
+
require 'yaml'
|
7
|
+
|
11
8
|
class BleakHouseTest < Test::Unit::TestCase
|
9
|
+
require "#{DIR}lib/bleak_house/mem_logger"
|
10
|
+
require "#{DIR}lib/bleak_house/c"
|
11
|
+
require "#{DIR}lib/bleak_house/ruby"
|
12
12
|
|
13
|
-
|
14
|
-
|
13
|
+
SNAPSHOT_FILE = "/tmp/bleak_house"
|
14
|
+
SNAPS = {:c => SNAPSHOT_FILE + ".c.yaml",
|
15
|
+
:ruby => SNAPSHOT_FILE + ".rb.yaml"}
|
15
16
|
|
16
17
|
def setup
|
17
|
-
File.delete FILE rescue nil
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_snapshot
|
21
|
-
BleakHouse.snapshot(FILE)
|
22
|
-
assert File.exist?(FILE)
|
23
|
-
assert BleakHouse.heaps_used > 0
|
24
|
-
assert BleakHouse.heaps_length > 0
|
25
18
|
end
|
26
19
|
|
27
|
-
def
|
28
|
-
|
29
|
-
assert File.exist?(FILE)
|
30
|
-
assert BleakHouse.heaps_used > 0
|
31
|
-
assert BleakHouse.heaps_length > 0
|
20
|
+
def test_mem_inspect
|
21
|
+
assert `ruby-bleak-house -rrubygems -e "require 'mem_inspect'; puts 'ok'"` == "ok\n"
|
32
22
|
end
|
33
|
-
|
34
|
-
def
|
35
|
-
|
36
|
-
|
23
|
+
|
24
|
+
def test_ruby_snapshot
|
25
|
+
File.delete SNAPS[:ruby] rescue nil
|
26
|
+
::BleakHouse::RubyLogger.new.snapshot(SNAPS[:ruby], "ruby_test", true)
|
27
|
+
assert File.exist?(SNAPS[:ruby])
|
28
|
+
assert_nothing_raised do
|
29
|
+
assert YAML.load_file(SNAPS[:ruby]).is_a?(Array)
|
37
30
|
end
|
38
31
|
end
|
39
|
-
|
40
|
-
def
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
assert_match(/free heap/, output[3])
|
47
|
-
assert_match(/\d+ __null__:__null__:__node__/, output[5])
|
32
|
+
|
33
|
+
def test_c_snapshot
|
34
|
+
File.delete SNAPS[:c] rescue nil
|
35
|
+
::BleakHouse::CLogger.new.snapshot(SNAPS[:c], "c_test", true)
|
36
|
+
assert File.exist?(SNAPS[:c])
|
37
|
+
assert_nothing_raised do
|
38
|
+
assert YAML.load_file(SNAPS[:c]).is_a?(Array)
|
48
39
|
end
|
49
40
|
end
|
50
|
-
|
51
|
-
def
|
52
|
-
|
53
|
-
|
54
|
-
end
|
55
|
-
assert File.exist?(FILE)
|
41
|
+
|
42
|
+
def test_c_raises
|
43
|
+
assert_raises(RuntimeError) do
|
44
|
+
::BleakHouse::CLogger.new.snapshot("/", "c_test", true)
|
45
|
+
end
|
56
46
|
end
|
57
|
-
|
47
|
+
|
58
48
|
end
|
metadata
CHANGED
@@ -1,112 +1,92 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
+
rubygems_version: 0.9.2
|
3
|
+
specification_version: 1
|
2
4
|
name: bleak_house
|
3
5
|
version: !ruby/object:Gem::Version
|
4
|
-
version: "
|
5
|
-
|
6
|
-
|
7
|
-
|
6
|
+
version: "5"
|
7
|
+
date: 2007-05-06 00:00:00 -04:00
|
8
|
+
summary: BleakHouse is a Rails plugin for finding memory leaks. It tracks ObjectSpace for your entire app, and produces charts of references by controller, by action, and by object class.
|
9
|
+
require_paths:
|
10
|
+
- lib
|
11
|
+
email: evan at cloudbur dot st
|
12
|
+
homepage: http://blog.evanweaver.com
|
13
|
+
rubyforge_project: fauna
|
14
|
+
description: BleakHouse is a Rails plugin for finding memory leaks. It tracks ObjectSpace for your entire app, and produces charts of references by controller, by action, and by object class.
|
8
15
|
autorequire:
|
9
|
-
bindir: bin
|
10
|
-
cert_chain:
|
11
|
-
- |
|
12
|
-
-----BEGIN CERTIFICATE-----
|
13
|
-
MIIDLjCCAhagAwIBAgIBADANBgkqhkiG9w0BAQUFADA9MQ0wCwYDVQQDDARldmFu
|
14
|
-
MRgwFgYKCZImiZPyLGQBGRYIY2xvdWRidXIxEjAQBgoJkiaJk/IsZAEZFgJzdDAe
|
15
|
-
Fw0wNzA5MTYxMDMzMDBaFw0wODA5MTUxMDMzMDBaMD0xDTALBgNVBAMMBGV2YW4x
|
16
|
-
GDAWBgoJkiaJk/IsZAEZFghjbG91ZGJ1cjESMBAGCgmSJomT8ixkARkWAnN0MIIB
|
17
|
-
IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA5C0Io89nyApnr+PvbNFge9Vs
|
18
|
-
yRWAlGBUEMahpXp28VrrfXZT0rAW7JBo4PlCE3jl4nE4dzE6gAdItSycjTosrw7A
|
19
|
-
Ir5+xoyl4Vb35adv56TIQQXvNz+BzlqnkAY5JN0CSBRTQb6mxS3hFyD/h4qgDosj
|
20
|
-
R2RFVzHqSxCS8xq4Ny8uzOwOi+Xyu4w67fI5JvnPvMxqrlR1eaIQHmxnf76RzC46
|
21
|
-
QO5QhufjAYGGXd960XzbQsQyTDUYJzrvT7AdOfiyZzKQykKt8dEpDn+QPjFTnGnT
|
22
|
-
QmgJBX5WJN0lHF2l1sbv3gh4Kn1tZu+kTUqeXY6ShAoDTyvZRiFqQdwh8w2lTQID
|
23
|
-
AQABozkwNzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQU+WqJz3xQ
|
24
|
-
XSea1hRvvHWcIMgeeC4wDQYJKoZIhvcNAQEFBQADggEBAGLZ75jfOEW8Nsl26CTt
|
25
|
-
JFrWxQTcQT/UljeefVE3xYr7lc9oQjbqO3FOyued3qW7TaNEtZfSHoYeUSMYbpw1
|
26
|
-
XAwocIPuSRFDGM4B+hgQGVDx8PMGiJKom4qLXjO40UZsR7QyN/u869Vj45LURm6h
|
27
|
-
MBcPeqCASI+WNprj9+uZa2kmHiitrFqqfMBNlm5IFbn9XeYSta9AHVvs5QQqV2m5
|
28
|
-
hIPfLqCyxsn/YgOGvo6iwyQTWyTswamaAC3HRWZxIS1sfn/Ssqa7E7oQMkv5FAXr
|
29
|
-
x5rKePfXINf8XTJczkl9OBEYdE9aNdJsJpXD0asLgGVwBICS5Bjohp6mizJcDC1+
|
30
|
-
yZ0=
|
31
|
-
-----END CERTIFICATE-----
|
32
|
-
|
33
|
-
date: 2009-10-02 00:00:00 -07:00
|
34
16
|
default_executable:
|
35
|
-
|
36
|
-
|
37
|
-
description: A library for finding memory leaks.
|
38
|
-
email: ""
|
39
|
-
executables:
|
40
|
-
- bleak
|
41
|
-
extensions:
|
42
|
-
- ext/extconf.rb
|
43
|
-
extra_rdoc_files:
|
44
|
-
- CHANGELOG
|
45
|
-
- LICENSE
|
46
|
-
- LICENSE_BSD
|
47
|
-
- README
|
48
|
-
- TODO
|
49
|
-
- ext/snapshot.c
|
50
|
-
- lib/bleak_house.rb
|
51
|
-
- lib/bleak_house/analyzer.rb
|
52
|
-
- lib/bleak_house/hook.rb
|
53
|
-
files:
|
54
|
-
- CHANGELOG
|
55
|
-
- LICENSE
|
56
|
-
- LICENSE_BSD
|
57
|
-
- Manifest
|
58
|
-
- README
|
59
|
-
- Rakefile
|
60
|
-
- TODO
|
61
|
-
- bin/bleak
|
62
|
-
- ext/build_ruby.rb
|
63
|
-
- ext/build_snapshot.rb
|
64
|
-
- ext/extconf.rb
|
65
|
-
- ext/snapshot.c
|
66
|
-
- ext/snapshot.h
|
67
|
-
- lib/bleak_house.rb
|
68
|
-
- lib/bleak_house/analyzer.rb
|
69
|
-
- lib/bleak_house/hook.rb
|
70
|
-
- ruby/ruby-1.8.7-p174.tar.bz2
|
71
|
-
- ruby/ruby-1.8.7.patch
|
72
|
-
- test/benchmark/bench.rb
|
73
|
-
- test/test_helper.rb
|
74
|
-
- test/unit/test_bleak_house.rb
|
75
|
-
- bleak_house.gemspec
|
17
|
+
bindir: bin
|
76
18
|
has_rdoc: true
|
77
|
-
|
78
|
-
licenses: []
|
79
|
-
|
80
|
-
post_install_message:
|
81
|
-
rdoc_options:
|
82
|
-
- --line-numbers
|
83
|
-
- --inline-source
|
84
|
-
- --title
|
85
|
-
- Bleak_house
|
86
|
-
- --main
|
87
|
-
- README
|
88
|
-
require_paths:
|
89
|
-
- lib
|
90
|
-
- ext
|
91
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
19
|
+
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
92
20
|
requirements:
|
93
|
-
- - "
|
21
|
+
- - ">"
|
94
22
|
- !ruby/object:Gem::Version
|
95
|
-
version:
|
96
|
-
version:
|
97
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
|
-
requirements:
|
99
|
-
- - ">="
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
version: "1.2"
|
23
|
+
version: 0.0.0
|
102
24
|
version:
|
25
|
+
platform: ruby
|
26
|
+
signing_key:
|
27
|
+
cert_chain:
|
28
|
+
post_install_message: |+
|
29
|
+
|
30
|
+
Thanks for installing Bleak House 5.
|
31
|
+
|
32
|
+
For each Rails app you want to profile, you will need to add the following
|
33
|
+
rake task in RAILS_ROOT/lib/tasks/bleak_house_tasks.rake to be able to run
|
34
|
+
the analyzer:
|
35
|
+
|
36
|
+
namespace :bleak_house do
|
37
|
+
desc 'Analyze and chart all data'
|
38
|
+
task :analyze do
|
39
|
+
rescue LoadError
|
40
|
+
end
|
41
|
+
BleakHouse::Analyze.build_all("#{RAILS_ROOT}/log/bleak_house_#{RAILS_ENV}.dump")
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
authors:
|
47
|
+
- Evan Weaver
|
48
|
+
files:
|
49
|
+
- ./CHANGELOG
|
50
|
+
- ./LICENSE_AFL
|
51
|
+
- ./Manifest
|
52
|
+
- ./README
|
53
|
+
- ./Rakefile
|
54
|
+
- ./init.rb
|
55
|
+
- ./install.rb
|
56
|
+
- ./lib/bleak_house/LICENSE_BSD
|
57
|
+
- ./lib/bleak_house/action_controller.rb
|
58
|
+
- ./lib/bleak_house/analyze.rb
|
59
|
+
- ./lib/bleak_house/bleak_house.rb
|
60
|
+
- ./lib/bleak_house/c.rb
|
61
|
+
- ./lib/bleak_house/dispatcher.rb
|
62
|
+
- ./lib/bleak_house/gruff_hacks.rb
|
63
|
+
- ./lib/bleak_house/mem_logger.rb
|
64
|
+
- ./lib/bleak_house/rake_task_redefine_task.rb
|
65
|
+
- ./lib/bleak_house/ruby.rb
|
66
|
+
- ./lib/bleak_house/support_methods.rb
|
67
|
+
- ./lib/bleak_house.rb
|
68
|
+
- ./patches/gc.c.patch
|
69
|
+
- ./tasks/bleak_house_tasks.rake
|
70
|
+
- ./test/unit/test_bleak_house.rb
|
71
|
+
test_files: []
|
72
|
+
|
73
|
+
rdoc_options: []
|
74
|
+
|
75
|
+
extra_rdoc_files: []
|
76
|
+
|
77
|
+
executables: []
|
78
|
+
|
79
|
+
extensions: []
|
80
|
+
|
103
81
|
requirements: []
|
104
82
|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
-
|
112
|
-
-
|
83
|
+
dependencies:
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: RubyInline
|
86
|
+
version_requirement:
|
87
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">"
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: 0.0.0
|
92
|
+
version:
|
data.tar.gz.sig
DELETED
Binary file
|
data/TODO
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
|
2
|
-
* Figure out why Rubygems 1.2.0 is a hard requirement
|
3
|
-
|
4
|
-
* Override Kernel#eval to always include sourceline macros.
|
5
|
-
* Mimic Valgrind's output format as much as possible
|
6
|
-
* Log remaining heap reference traces
|
7
|
-
* Add some kind of start/end delta support
|
8
|
-
* Log entire backtrace by allocating pointer arrays on the heap
|
9
|
-
- Add some kind of hashing procedure to avoid duplicating identical backtrace pointer arrays
|
10
|
-
* Report individual types of nodes
|
data/bin/bleak
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'rubygems'
|
4
|
-
|
5
|
-
if !ARGV[0]
|
6
|
-
puts "Please specify up to two BleakHouse logfiles"
|
7
|
-
exit
|
8
|
-
else
|
9
|
-
$LOAD_PATH << "#{File.dirname(__FILE__)}/../lib/"
|
10
|
-
require 'bleak_house/analyzer'
|
11
|
-
require 'ruby-debug' if ENV['DEBUG']
|
12
|
-
BleakHouse::Analyzer.run(*ARGV)
|
13
|
-
end
|
data/bleak_house.gemspec
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
|
-
Gem::Specification.new do |s|
|
4
|
-
s.name = %q{bleak_house}
|
5
|
-
s.version = "4.6"
|
6
|
-
|
7
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
|
-
s.authors = ["Evan Weaver"]
|
9
|
-
s.cert_chain = ["/Users/eweaver/p/configuration/gem_certificates/evan_weaver-original-public_cert.pem"]
|
10
|
-
s.date = %q{2009-10-02}
|
11
|
-
s.default_executable = %q{bleak}
|
12
|
-
s.description = %q{A library for finding memory leaks.}
|
13
|
-
s.email = %q{}
|
14
|
-
s.executables = ["bleak"]
|
15
|
-
s.extensions = ["ext/extconf.rb"]
|
16
|
-
s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "LICENSE_BSD", "README", "TODO", "ext/snapshot.c", "lib/bleak_house.rb", "lib/bleak_house/analyzer.rb", "lib/bleak_house/hook.rb"]
|
17
|
-
s.files = ["CHANGELOG", "LICENSE", "LICENSE_BSD", "Manifest", "README", "Rakefile", "TODO", "bin/bleak", "ext/build_ruby.rb", "ext/build_snapshot.rb", "ext/extconf.rb", "ext/snapshot.c", "ext/snapshot.h", "lib/bleak_house.rb", "lib/bleak_house/analyzer.rb", "lib/bleak_house/hook.rb", "ruby/ruby-1.8.7-p174.tar.bz2", "ruby/ruby-1.8.7.patch", "test/benchmark/bench.rb", "test/test_helper.rb", "test/unit/test_bleak_house.rb", "bleak_house.gemspec"]
|
18
|
-
s.homepage = %q{http://blog.evanweaver.com/files/doc/fauna/bleak_house/}
|
19
|
-
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Bleak_house", "--main", "README"]
|
20
|
-
s.require_paths = ["lib", "ext"]
|
21
|
-
s.rubyforge_project = %q{fauna}
|
22
|
-
s.rubygems_version = %q{1.3.4}
|
23
|
-
s.signing_key = %q{/Users/eweaver/p/configuration/gem_certificates/evan_weaver-original-private_key.pem}
|
24
|
-
s.summary = %q{A library for finding memory leaks.}
|
25
|
-
s.test_files = ["test/test_helper.rb", "test/unit/test_bleak_house.rb"]
|
26
|
-
|
27
|
-
if s.respond_to? :specification_version then
|
28
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
29
|
-
s.specification_version = 3
|
30
|
-
|
31
|
-
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
32
|
-
else
|
33
|
-
end
|
34
|
-
else
|
35
|
-
end
|
36
|
-
end
|
data/ext/build_ruby.rb
DELETED
@@ -1,114 +0,0 @@
|
|
1
|
-
|
2
|
-
# Extension abuse in order to build our patched binary as part of the gem install process.
|
3
|
-
|
4
|
-
raise "Windows is not supported." if RUBY_PLATFORM =~ /win32|windows/
|
5
|
-
|
6
|
-
source_dir = File.expand_path(File.dirname(__FILE__)) + "/../ruby"
|
7
|
-
tmp = "/tmp/"
|
8
|
-
|
9
|
-
require 'fileutils'
|
10
|
-
require 'rbconfig'
|
11
|
-
|
12
|
-
def execute(command)
|
13
|
-
puts command
|
14
|
-
unless system(command)
|
15
|
-
puts "Failed: #{command.inspect}"
|
16
|
-
exit -1
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def which(basename)
|
21
|
-
# execute('which') is not compatible across Linux and BSD
|
22
|
-
ENV['PATH'].split(File::PATH_SEPARATOR).detect do |directory|
|
23
|
-
path = File.join(directory, basename.to_s)
|
24
|
-
path if File.exist? path
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
if which('ruby-bleak-house') and
|
29
|
-
(patchlevel = `ruby-bleak-house -e "puts RUBY_PATCHLEVEL"`.to_i) >= 905
|
30
|
-
puts "** Binary `ruby-bleak-house` is already available (patchlevel #{patchlevel})"
|
31
|
-
else
|
32
|
-
# Build
|
33
|
-
Dir.chdir(tmp) do
|
34
|
-
build_dir = "bleak_house"
|
35
|
-
|
36
|
-
FileUtils.rm_rf(build_dir) rescue nil
|
37
|
-
if File.exist? build_dir
|
38
|
-
raise "Could not delete previous build dir #{Dir.pwd}/#{build_dir}"
|
39
|
-
end
|
40
|
-
|
41
|
-
Dir.mkdir(build_dir)
|
42
|
-
|
43
|
-
begin
|
44
|
-
Dir.chdir(build_dir) do
|
45
|
-
|
46
|
-
puts "** Copy Ruby source"
|
47
|
-
bz2 = "ruby-1.8.7-p174.tar.bz2"
|
48
|
-
FileUtils.copy "#{source_dir}/#{bz2}", bz2
|
49
|
-
|
50
|
-
puts "** Extract"
|
51
|
-
execute("tar xjf #{bz2}")
|
52
|
-
File.delete bz2
|
53
|
-
|
54
|
-
Dir.chdir("ruby-1.8.7-p174") do
|
55
|
-
|
56
|
-
puts "** Patch Ruby"
|
57
|
-
execute("patch -p1 < '#{source_dir}/ruby-1.8.7.patch'")
|
58
|
-
|
59
|
-
env = Config::CONFIG.map do |key, value|
|
60
|
-
"#{key}=#{value.inspect}" if key.upcase == key and value
|
61
|
-
end.compact.join(" ")
|
62
|
-
|
63
|
-
puts "** Configure"
|
64
|
-
|
65
|
-
args = Config::CONFIG['configure_args']
|
66
|
-
args.sub("'--enable-shared'", "")
|
67
|
-
args << " --disable-shared"
|
68
|
-
args << " --enable-valgrind" if which("valgrind")
|
69
|
-
execute("env #{env} ./configure #{args}")
|
70
|
-
|
71
|
-
puts "Patch Makefile"
|
72
|
-
# FIXME Why is this necessary?
|
73
|
-
makefile = File.read('Makefile')
|
74
|
-
%w{arch sitearch sitedir}.each do | key |
|
75
|
-
makefile.gsub!(/#{key} = .*/, "#{key} = #{Config::CONFIG[key]}")
|
76
|
-
end
|
77
|
-
File.open('Makefile', 'w'){|f| f.puts(makefile)}
|
78
|
-
|
79
|
-
puts "Patch config.h"
|
80
|
-
constants = {
|
81
|
-
'RUBY_LIB' => 'rubylibdir',
|
82
|
-
'RUBY_SITE_LIB' => 'sitedir',
|
83
|
-
'RUBY_SITE_LIB2' => 'sitelibdir',
|
84
|
-
'RUBY_PLATFORM' => 'arch',
|
85
|
-
'RUBY_ARCHLIB' => 'topdir',
|
86
|
-
'RUBY_SITE_ARCHLIB' => 'sitearchdir'
|
87
|
-
}
|
88
|
-
config_h = File.read('config.h')
|
89
|
-
constants.each do | const, key |
|
90
|
-
config_h.gsub!(/#define #{const} .*/, "#define #{const} \"#{Config::CONFIG[key]}\"")
|
91
|
-
end
|
92
|
-
File.open('config.h', 'w') do |f|
|
93
|
-
f.puts(config_h)
|
94
|
-
end
|
95
|
-
|
96
|
-
puts "** Make"
|
97
|
-
execute("env #{env} make")
|
98
|
-
|
99
|
-
bleak_binary = "#{Config::CONFIG['bindir']}/ruby-bleak-house"
|
100
|
-
ruby_binary = Config::CONFIG["RUBY_INSTALL_NAME"] || "ruby"
|
101
|
-
|
102
|
-
puts "** Install binary"
|
103
|
-
raise unless File.exist? ruby_binary
|
104
|
-
File.delete bleak_binary if File.exist? bleak_binary # Avoid "Text file busy" error
|
105
|
-
exec("cp ./#{ruby_binary} #{bleak_binary}; chmod 755 #{bleak_binary}")
|
106
|
-
end
|
107
|
-
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
puts "Success"
|
112
|
-
end
|
113
|
-
|
114
|
-
end
|