build-tool 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +27 -0
- data/KNOWN_PROBLEMS +0 -3
- data/Manifest.txt +0 -16
- data/Rakefile +3 -2
- data/lib/build-tool.rb +1 -1
- data/lib/build-tool/build-system/autoconf.rb +2 -2
- data/lib/build-tool/build-system/base.rb +1 -29
- data/lib/build-tool/build-system/make.rb +2 -0
- data/lib/build-tool/command_actions.rb +7 -4
- data/lib/build-tool/commands.rb +70 -25
- data/lib/build-tool/commands/build.rb +7 -2
- data/lib/build-tool/commands/configure.rb +6 -2
- data/lib/build-tool/commands/fetch.rb +1 -1
- data/lib/build-tool/commands/history.rb +3 -3
- data/lib/build-tool/commands/rebase.rb +9 -6
- data/lib/build-tool/commands/recipes/info.rb +1 -3
- data/lib/build-tool/module.rb +19 -4
- data/lib/build-tool/recipe.rb +15 -2
- data/lib/build-tool/vcs/archive.rb +1 -1
- data/lib/build-tool/vcs/base.rb +10 -2
- data/lib/build-tool/vcs/git-svn.rb +9 -1
- data/lib/build-tool/vcs/git.rb +16 -4
- data/lib/build-tool/vcs/svn.rb +2 -2
- data/lib/mj/logging.rb +34 -0
- metadata +122 -185
- data.tar.gz.sig +0 -3
- data/.gemtest +0 -0
- data/tasks/rspec.rake +0 -22
- data/test/commands/test_build.rb +0 -29
- data/test/test_build_system.rb +0 -98
- data/test/test_cli.rb +0 -61
- data/test/test_command.rb +0 -175
- data/test/test_configuration_parser.rb +0 -597
- data/test/test_environment.rb +0 -82
- data/test/test_feature.rb +0 -34
- data/test/test_helper.rb +0 -46
- data/test/test_history.rb +0 -149
- data/test/test_module.rb +0 -158
- data/test/test_repository.rb +0 -75
- data/test/test_singleton.rb +0 -51
- data/test/test_ssh_key.rb +0 -14
- data/test/test_svn_parser.rb +0 -28
- data/test/test_vcs.rb +0 -33
- metadata.gz.sig +0 -2
data/test/test_environment.rb
DELETED
@@ -1,82 +0,0 @@
|
|
1
|
-
require 'pathname'
|
2
|
-
require Pathname.new( File.dirname(__FILE__)).join( 'test_helper' ).cleanpath
|
3
|
-
|
4
|
-
require 'build-tool/commands'
|
5
|
-
require 'build-tool/environment'
|
6
|
-
|
7
|
-
class TestEnvironment < Test::Unit::TestCase
|
8
|
-
|
9
|
-
# Test a simple default created object
|
10
|
-
def test_simple_creation
|
11
|
-
env = BuildTool::Environment.new('kde4')
|
12
|
-
# Check that all available properties are initialized correctly
|
13
|
-
assert_equal env.name, 'kde4'
|
14
|
-
|
15
|
-
assert_raise StandardError do
|
16
|
-
BuildTool::Environment.new(nil)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
# Test all properties for required behaviour
|
21
|
-
def test_properties
|
22
|
-
env = BuildTool::Environment.new('kde4')
|
23
|
-
|
24
|
-
# It's not allowed to change the name
|
25
|
-
assert !env.respond_to?( 'name=' )
|
26
|
-
end
|
27
|
-
|
28
|
-
# Test variables
|
29
|
-
def test_variables
|
30
|
-
env = BuildTool::Environment.new('kde4')
|
31
|
-
|
32
|
-
# Set a value by symbol
|
33
|
-
env.set( :PATH, "/usr/bin:bin" )
|
34
|
-
assert_equal "/usr/bin:bin", env[:PATH]
|
35
|
-
assert_equal "/usr/bin:bin", env["PATH"]
|
36
|
-
|
37
|
-
# Set a value by string
|
38
|
-
env.set( "PATH", "/usr/bin:bin" )
|
39
|
-
assert_equal "/usr/bin:bin", env[:PATH]
|
40
|
-
assert_equal "/usr/bin:bin", env["PATH"]
|
41
|
-
|
42
|
-
# Add another variable
|
43
|
-
env.set( :MANPATH, "/usr/man" )
|
44
|
-
assert_equal "/usr/man", env[:MANPATH]
|
45
|
-
assert_equal "/usr/man", env["MANPATH"]
|
46
|
-
|
47
|
-
# Make sure the variables are independent
|
48
|
-
assert_equal "/usr/bin:bin", env[:PATH]
|
49
|
-
end
|
50
|
-
|
51
|
-
# Test setting and adding to variables
|
52
|
-
def test_setting_variables
|
53
|
-
env = BuildTool::Environment.new('kde4')
|
54
|
-
|
55
|
-
# Make sure it's empty to start with
|
56
|
-
assert_equal "", env[:PATH]
|
57
|
-
|
58
|
-
# Set a value by symbol
|
59
|
-
env.set( :PATH, "/usr/bin:bin" )
|
60
|
-
assert_equal "/usr/bin:bin", env[:PATH]
|
61
|
-
assert_equal "/usr/bin:bin", env["PATH"]
|
62
|
-
|
63
|
-
# Set a value by string
|
64
|
-
env.set( "PATH", "/usr/bin:bin" )
|
65
|
-
assert_equal "/usr/bin:bin", env[:PATH]
|
66
|
-
assert_equal "/usr/bin:bin", env["PATH"]
|
67
|
-
|
68
|
-
# Append a value
|
69
|
-
env.set( :PATH, "/usr/bin:/bin:/usr/local/bin" )
|
70
|
-
assert_equal "/usr/bin:/bin:/usr/local/bin", env[:PATH]
|
71
|
-
|
72
|
-
# Prepend a value
|
73
|
-
env.prepend( :PATH, "/usr/X11R6/bin" )
|
74
|
-
assert_equal "/usr/X11R6/bin:/usr/bin:/bin:/usr/local/bin", env[:PATH]
|
75
|
-
|
76
|
-
# Both at once
|
77
|
-
env.append( :PATH, "/opt/kde4/bin" )
|
78
|
-
assert_equal "/usr/X11R6/bin:/usr/bin:/bin:/usr/local/bin:/opt/kde4/bin", env[:PATH]
|
79
|
-
|
80
|
-
end
|
81
|
-
|
82
|
-
end
|
data/test/test_feature.rb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
require 'pathname'
|
2
|
-
require Pathname.new( File.dirname(__FILE__)).join( 'test_helper' ).cleanpath
|
3
|
-
|
4
|
-
require 'build-tool/feature'
|
5
|
-
|
6
|
-
class TestFeature < Test::Unit::TestCase
|
7
|
-
|
8
|
-
def test_simple_creation
|
9
|
-
testfeat = BuildTool::Feature.new( "test" )
|
10
|
-
assert_equal "test", testfeat.name
|
11
|
-
assert testfeat.active?
|
12
|
-
assert_nil testfeat.parent
|
13
|
-
assert_equal "test", testfeat.path
|
14
|
-
|
15
|
-
test2feat = BuildTool::Feature.new( "test2", testfeat, false )
|
16
|
-
assert_equal "test2", test2feat.name
|
17
|
-
assert !test2feat.active?
|
18
|
-
assert_equal testfeat, test2feat.parent
|
19
|
-
assert_equal "test/test2", test2feat.path
|
20
|
-
|
21
|
-
test3feat = BuildTool::Feature.new( "test3", testfeat )
|
22
|
-
assert_equal "test3", test3feat.name
|
23
|
-
assert test3feat.active?
|
24
|
-
assert_equal testfeat, test3feat.parent
|
25
|
-
assert_equal "test/test3", test3feat.path
|
26
|
-
|
27
|
-
# Check that disabling the parent feature disables the child feature
|
28
|
-
testfeat.active = false
|
29
|
-
assert !testfeat.active?
|
30
|
-
assert !test3feat.active?
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
34
|
-
|
data/test/test_helper.rb
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
require 'pathname'
|
2
|
-
require Pathname.new( File.dirname(__FILE__)).join( '../lib/build-tool' ).cleanpath
|
3
|
-
|
4
|
-
require 'rubygems'
|
5
|
-
require 'logging'
|
6
|
-
require 'sequel'
|
7
|
-
require 'stringio'
|
8
|
-
require 'test/unit'
|
9
|
-
|
10
|
-
Logging.init :debug, :verbose, :trace, :info, :warn, :error
|
11
|
-
include Logging.globally
|
12
|
-
Logging.logger.root.level = :debug
|
13
|
-
Logging.logger.root.clear_appenders()
|
14
|
-
|
15
|
-
|
16
|
-
def keep_stdout(&block)
|
17
|
-
begin
|
18
|
-
orig_stream, $stdout = $stdout, StringIO.new
|
19
|
-
block.call($stdout)
|
20
|
-
ensure
|
21
|
-
s, $stdout = $stdout.string, orig_stream
|
22
|
-
s
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def assert_signals( obj, signal, &block )
|
27
|
-
called = false
|
28
|
-
|
29
|
-
proc = obj.connect( signal ) { called = true }
|
30
|
-
yield
|
31
|
-
obj.disconnect( signal, &proc )
|
32
|
-
assert called, "Slot was called"
|
33
|
-
end
|
34
|
-
|
35
|
-
def assert_output(expected, &block)
|
36
|
-
keep_stdout do |stdout|
|
37
|
-
block.call
|
38
|
-
if expected.is_a?(Regexp)
|
39
|
-
assert_match expected, stdout.string
|
40
|
-
else
|
41
|
-
assert_equal expected.to_s, stdout.string
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
@database = Sequel.sqlite
|
data/test/test_history.rb
DELETED
@@ -1,149 +0,0 @@
|
|
1
|
-
require 'pathname'
|
2
|
-
require Pathname.new( File.dirname(__FILE__)).join( 'test_helper' ).cleanpath
|
3
|
-
|
4
|
-
require 'sequel'
|
5
|
-
require 'sequel/extensions/migration'
|
6
|
-
|
7
|
-
# Create a memory database
|
8
|
-
database = Sequel.sqlite
|
9
|
-
Sequel::Migrator.apply( database, 'db/migrations' )
|
10
|
-
|
11
|
-
require 'build-tool/history'
|
12
|
-
|
13
|
-
class TestHistory < Test::Unit::TestCase
|
14
|
-
|
15
|
-
def test_command_log
|
16
|
-
cmd = BuildTool::History::CommandLog.new(
|
17
|
-
:command => "test" )
|
18
|
-
assert_equal cmd.command, "test"
|
19
|
-
assert_nil cmd.started_at
|
20
|
-
assert_nil cmd.finished_at
|
21
|
-
assert_nil cmd.id
|
22
|
-
assert_nil cmd.state
|
23
|
-
|
24
|
-
# #started sets the started_at attribute and saves the object. Nothing else.
|
25
|
-
cmd.started
|
26
|
-
assert_not_nil cmd.id
|
27
|
-
assert_equal cmd.command, "test"
|
28
|
-
assert_not_nil cmd.started_at
|
29
|
-
assert_nil cmd.finished_at
|
30
|
-
assert_equal BuildTool::History::CommandLog::STARTED, cmd.state
|
31
|
-
|
32
|
-
# Check that the started state will lead to an exception on finished
|
33
|
-
assert_raises StandardError do
|
34
|
-
cmd.finished( BuildTool::History::CommandLog::STARTED )
|
35
|
-
end
|
36
|
-
|
37
|
-
# #finished sets the finished_at attribute and saves the object. Nothing else.
|
38
|
-
cmd.finished( BuildTool::History::CommandLog::FINISHED_SUCCESSFUL )
|
39
|
-
assert_not_nil cmd.id
|
40
|
-
assert_equal cmd.command, "test"
|
41
|
-
assert_not_nil cmd.started_at
|
42
|
-
assert_not_nil cmd.finished_at
|
43
|
-
assert cmd.finished_at > cmd.started_at
|
44
|
-
assert_equal BuildTool::History::CommandLog::FINISHED_SUCCESSFUL, cmd.state
|
45
|
-
|
46
|
-
# Reload the object from db
|
47
|
-
id = cmd.id
|
48
|
-
cmd = nil
|
49
|
-
cmd = BuildTool::History::CommandLog[id]
|
50
|
-
assert_equal id, cmd.id
|
51
|
-
assert_equal cmd.command, "test"
|
52
|
-
assert_not_nil cmd.started_at
|
53
|
-
assert_not_nil cmd.finished_at
|
54
|
-
assert cmd.finished_at > cmd.started_at
|
55
|
-
|
56
|
-
# Create more entried
|
57
|
-
for i in 1..50 do
|
58
|
-
cmd = BuildTool::History::CommandLog.new(
|
59
|
-
:command => "test #{i}" )
|
60
|
-
cmd.started
|
61
|
-
cmd.finished( BuildTool::History::CommandLog::FINISHED_SUCCESSFUL )
|
62
|
-
# Remember the last id
|
63
|
-
maxid = cmd.id
|
64
|
-
end
|
65
|
-
|
66
|
-
# Get the latest history entry
|
67
|
-
cmd = BuildTool::History::CommandLog::most_recent
|
68
|
-
assert_equal maxid, cmd.id
|
69
|
-
|
70
|
-
# Get the latest ten history entries
|
71
|
-
arr = BuildTool::History::CommandLog.last( 10 )
|
72
|
-
assert_equal 10, arr.size
|
73
|
-
assert_equal maxid, arr[0].id
|
74
|
-
|
75
|
-
lastid = maxid+1
|
76
|
-
while nxt = arr.shift
|
77
|
-
assert lastid > nxt.id
|
78
|
-
lastid = nxt.id
|
79
|
-
end
|
80
|
-
|
81
|
-
end # test_command_log
|
82
|
-
|
83
|
-
|
84
|
-
def test_module_log
|
85
|
-
# Get a command to work with
|
86
|
-
cmd = BuildTool::History::CommandLog::most_recent
|
87
|
-
|
88
|
-
# Create a empty one
|
89
|
-
mod = BuildTool::History::ModuleLog.new
|
90
|
-
assert_nil mod.id
|
91
|
-
assert_nil mod.module
|
92
|
-
assert_nil mod.command_log_id
|
93
|
-
assert_nil mod.event
|
94
|
-
assert_nil mod.logfile
|
95
|
-
assert_nil mod.started_at
|
96
|
-
assert_nil mod.finished_at
|
97
|
-
assert_nil mod.state
|
98
|
-
|
99
|
-
assert_raises Sequel::DatabaseError do
|
100
|
-
mod.save
|
101
|
-
end
|
102
|
-
|
103
|
-
mod.module = "test"
|
104
|
-
assert_raises Sequel::DatabaseError do
|
105
|
-
mod.save
|
106
|
-
end
|
107
|
-
|
108
|
-
mod.event = "update"
|
109
|
-
assert_raises Sequel::DatabaseError do
|
110
|
-
mod.save
|
111
|
-
end
|
112
|
-
|
113
|
-
# SQLite3 does not check foreign keys (just to remember
|
114
|
-
mod.command_log_id = 45000
|
115
|
-
mod.save
|
116
|
-
|
117
|
-
mod = BuildTool::History::ModuleLog.new(
|
118
|
-
:command_log_id => cmd.id,
|
119
|
-
:module => "test_module",
|
120
|
-
:event => "update",
|
121
|
-
:logfile => "/path/to/my/logfile")
|
122
|
-
assert_equal mod.command_log_id, cmd.id
|
123
|
-
assert_equal "test_module", mod.module
|
124
|
-
assert_equal "update", mod.event
|
125
|
-
assert_equal "/path/to/my/logfile", mod.logfile
|
126
|
-
assert_nil mod.id
|
127
|
-
|
128
|
-
# Start the event
|
129
|
-
mod.started
|
130
|
-
assert_not_nil mod.id
|
131
|
-
assert_not_nil mod.started_at
|
132
|
-
assert_equal mod.state, BuildTool::History::ModuleLog::STARTED
|
133
|
-
|
134
|
-
# Finish the event
|
135
|
-
assert_raises StandardError do
|
136
|
-
mod.finished( BuildTool::History::ModuleLog::STARTED )
|
137
|
-
end
|
138
|
-
|
139
|
-
mod.finished( BuildTool::History::ModuleLog::FINISHED_SUCCESSFUL )
|
140
|
-
assert_not_nil mod.finished_at
|
141
|
-
assert_equal mod.state, BuildTool::History::ModuleLog::FINISHED_SUCCESSFUL
|
142
|
-
|
143
|
-
cmds = BuildTool::History::CommandLog.last_by_module( "test_module" )
|
144
|
-
puts cmds.inspect
|
145
|
-
assert_equal 1, cmds.count
|
146
|
-
end
|
147
|
-
|
148
|
-
end # class TestHistory
|
149
|
-
|
data/test/test_module.rb
DELETED
@@ -1,158 +0,0 @@
|
|
1
|
-
require 'pathname'
|
2
|
-
require Pathname.new( File.dirname(__FILE__)).join( 'test_helper' ).cleanpath
|
3
|
-
|
4
|
-
require 'build-tool/module'
|
5
|
-
require 'build-tool/repository'
|
6
|
-
require 'build-tool/errors'
|
7
|
-
require 'build-tool/vcs/git-svn'
|
8
|
-
require 'build-tool/environment'
|
9
|
-
require 'build-tool/build-system/cmake'
|
10
|
-
|
11
|
-
class TestModule < Test::Unit::TestCase
|
12
|
-
|
13
|
-
# Test a simple default created object
|
14
|
-
def test_simple_creation
|
15
|
-
mod = BuildTool::Module.new('kdelibs')
|
16
|
-
assert_raise StandardError do
|
17
|
-
BuildTool::Module.new(nil)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_template
|
22
|
-
mod = BuildTool::Module.new('kdelibs')
|
23
|
-
mod.is_template = true
|
24
|
-
assert_raise BuildTool::ConfigurationError do
|
25
|
-
mod.local_path = "/kde/trunk"
|
26
|
-
end
|
27
|
-
assert_raise BuildTool::ConfigurationError do
|
28
|
-
mod.remote_path = "/kde/trunk"
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
# Test all properties for required behaviour
|
33
|
-
def test_properties
|
34
|
-
mod = BuildTool::Module.new('kdelibs')
|
35
|
-
# It's not allowed to change the name
|
36
|
-
assert !mod.respond_to?( 'name=' )
|
37
|
-
# The name
|
38
|
-
assert_equal mod.name, 'kdelibs'
|
39
|
-
# defaults to name
|
40
|
-
assert_equal mod.local_path, 'kdelibs'
|
41
|
-
# defaults to name
|
42
|
-
assert_equal mod.remote_path, 'kdelibs'
|
43
|
-
end
|
44
|
-
|
45
|
-
# Test checking out the module
|
46
|
-
def test_checkout
|
47
|
-
mod = BuildTool::Module.new('kdelibs')
|
48
|
-
assert_raise BuildTool::ConfigurationError do
|
49
|
-
mod.rebase( nil )
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
# Test checking error message because of missing configuration
|
54
|
-
def test_build_prefix
|
55
|
-
mod = BuildTool::Module.new('kdelibs')
|
56
|
-
assert_raise BuildTool::ConfigurationError do
|
57
|
-
mod.build_prefix_required
|
58
|
-
end
|
59
|
-
assert_nothing_raised do
|
60
|
-
mod.build_prefix
|
61
|
-
end
|
62
|
-
assert_nothing_raised do
|
63
|
-
mod.build_prefix= "/kde/src"
|
64
|
-
mod.build_prefix_required
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
# Test checking error message because of missing configuration
|
69
|
-
def test_build_system
|
70
|
-
mod = BuildTool::Module.new('kdelibs')
|
71
|
-
assert_raise BuildTool::ConfigurationError do
|
72
|
-
mod.build_system_required
|
73
|
-
end
|
74
|
-
assert_nothing_raised do
|
75
|
-
mod.build_system
|
76
|
-
end
|
77
|
-
assert_nothing_raised do
|
78
|
-
mod.build_system= BuildTool::BuildSystem::CMake.new
|
79
|
-
mod.build_system_required
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
# Test checking error message because of missing configuration
|
84
|
-
def test_environment
|
85
|
-
mod = BuildTool::Module.new('kdelibs')
|
86
|
-
assert_raise BuildTool::ConfigurationError do
|
87
|
-
mod.environment_required
|
88
|
-
end
|
89
|
-
assert_nothing_raised do
|
90
|
-
mod.environment
|
91
|
-
end
|
92
|
-
assert_nothing_raised do
|
93
|
-
mod.environment= BuildTool::Environment.new( 'kde' )
|
94
|
-
mod.environment_required
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
# Test checking error message because of missing configuration
|
99
|
-
def test_install_prefix
|
100
|
-
mod = BuildTool::Module.new('kdelibs')
|
101
|
-
# It's nil
|
102
|
-
assert_nil mod.install_prefix
|
103
|
-
# Raises an expression if required
|
104
|
-
assert_raise BuildTool::ConfigurationError do
|
105
|
-
mod.install_prefix_required
|
106
|
-
end
|
107
|
-
# But not on the normal accessor
|
108
|
-
assert_nothing_raised do
|
109
|
-
mod.install_prefix
|
110
|
-
end
|
111
|
-
|
112
|
-
# Set a value
|
113
|
-
mod.install_prefix= "/opt/kde"
|
114
|
-
assert_kind_of Pathname, mod.install_prefix
|
115
|
-
# It's available on the normal accessor
|
116
|
-
assert_equal "/opt/kde", mod.install_prefix.to_s
|
117
|
-
# Does not throw an expception
|
118
|
-
assert_nothing_raised do
|
119
|
-
mod.install_prefix_required
|
120
|
-
end
|
121
|
-
# It's available on the normal accessor
|
122
|
-
assert_equal mod.install_prefix, mod.install_prefix_required
|
123
|
-
end
|
124
|
-
|
125
|
-
# Test checking error message because of missing configuration
|
126
|
-
def test_repository
|
127
|
-
mod = BuildTool::Module.new('kdelibs')
|
128
|
-
assert_raise BuildTool::ConfigurationError do
|
129
|
-
mod.repository_required
|
130
|
-
end
|
131
|
-
assert_nothing_raised do
|
132
|
-
mod.repository
|
133
|
-
end
|
134
|
-
assert_nothing_raised do
|
135
|
-
mod.repository= BuildTool::Repository.new( 'kde' )
|
136
|
-
mod.repository_required
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
|
-
# Test checking error message because of missing configuration
|
141
|
-
def test_vcs
|
142
|
-
mod = BuildTool::Module.new('kdelibs')
|
143
|
-
assert_raise BuildTool::ConfigurationError do
|
144
|
-
mod.vcs_required
|
145
|
-
end
|
146
|
-
assert_nothing_raised do
|
147
|
-
mod.vcs
|
148
|
-
end
|
149
|
-
mod.repository = BuildTool::Repository.new( "repo" )
|
150
|
-
mod.build_prefix = "$HOME/build"
|
151
|
-
assert_nothing_raised do
|
152
|
-
mod.vcs_configuration = BuildTool::VCS::GitSvnConfiguration.new
|
153
|
-
mod.vcs_required
|
154
|
-
end
|
155
|
-
end
|
156
|
-
|
157
|
-
|
158
|
-
end
|