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.
Files changed (44) hide show
  1. data/History.txt +27 -0
  2. data/KNOWN_PROBLEMS +0 -3
  3. data/Manifest.txt +0 -16
  4. data/Rakefile +3 -2
  5. data/lib/build-tool.rb +1 -1
  6. data/lib/build-tool/build-system/autoconf.rb +2 -2
  7. data/lib/build-tool/build-system/base.rb +1 -29
  8. data/lib/build-tool/build-system/make.rb +2 -0
  9. data/lib/build-tool/command_actions.rb +7 -4
  10. data/lib/build-tool/commands.rb +70 -25
  11. data/lib/build-tool/commands/build.rb +7 -2
  12. data/lib/build-tool/commands/configure.rb +6 -2
  13. data/lib/build-tool/commands/fetch.rb +1 -1
  14. data/lib/build-tool/commands/history.rb +3 -3
  15. data/lib/build-tool/commands/rebase.rb +9 -6
  16. data/lib/build-tool/commands/recipes/info.rb +1 -3
  17. data/lib/build-tool/module.rb +19 -4
  18. data/lib/build-tool/recipe.rb +15 -2
  19. data/lib/build-tool/vcs/archive.rb +1 -1
  20. data/lib/build-tool/vcs/base.rb +10 -2
  21. data/lib/build-tool/vcs/git-svn.rb +9 -1
  22. data/lib/build-tool/vcs/git.rb +16 -4
  23. data/lib/build-tool/vcs/svn.rb +2 -2
  24. data/lib/mj/logging.rb +34 -0
  25. metadata +122 -185
  26. data.tar.gz.sig +0 -3
  27. data/.gemtest +0 -0
  28. data/tasks/rspec.rake +0 -22
  29. data/test/commands/test_build.rb +0 -29
  30. data/test/test_build_system.rb +0 -98
  31. data/test/test_cli.rb +0 -61
  32. data/test/test_command.rb +0 -175
  33. data/test/test_configuration_parser.rb +0 -597
  34. data/test/test_environment.rb +0 -82
  35. data/test/test_feature.rb +0 -34
  36. data/test/test_helper.rb +0 -46
  37. data/test/test_history.rb +0 -149
  38. data/test/test_module.rb +0 -158
  39. data/test/test_repository.rb +0 -75
  40. data/test/test_singleton.rb +0 -51
  41. data/test/test_ssh_key.rb +0 -14
  42. data/test/test_svn_parser.rb +0 -28
  43. data/test/test_vcs.rb +0 -33
  44. metadata.gz.sig +0 -2
data.tar.gz.sig DELETED
@@ -1,3 +0,0 @@
1
- �<5FY�_0��fM綈푥�K(���^�d0$�:FTz�����]�.�X-D��������
2
- �r!��h��F�V�J��O��fV|�w|bu�������a�H�S���:�Lu�E���8�7�q̩�6;�T�te�� ^�e=S�[���E6�d��n_hS=�'��w��vy~
3
- +�X�\��̡+{ܙ�U�0�D��7u�X��#��R���~]�S@:�^�&1�:*�1�bh!c}d��a_f;���8�k�
data/.gemtest DELETED
File without changes
data/tasks/rspec.rake DELETED
@@ -1,22 +0,0 @@
1
- begin
2
- require 'rspec'
3
- rescue LoadError
4
- require 'rubygems' unless ENV['NO_RUBYGEMS']
5
- require 'rspec'
6
- end
7
- begin
8
- require 'rspec/core/rake_task'
9
- rescue LoadError
10
- puts <<-EOS
11
- To use rspec for testing you must install rspec gem:
12
- gem install rspec
13
- EOS
14
- exit(0)
15
- end
16
-
17
- desc "Run the specs under spec/models"
18
- RSpec::Core::RakeTask.new do |t|
19
- t.rspec_opts = ['--options', "spec/spec.opts"]
20
- # :TODO: Port me
21
- # t.spec_files = FileList['spec/**/*_spec.rb']
22
- end
@@ -1,29 +0,0 @@
1
- require 'pathname'
2
- require Pathname.new( File.dirname(__FILE__)).join( '../test_helper' ).cleanpath
3
-
4
- require 'build-tool/configuration'
5
- require 'build-tool/commands'
6
- require 'build-tool/commands/build'
7
-
8
- class TestBuildCommand < ::Test::Unit::TestCase
9
-
10
- def test_default_values
11
- cmd = BuildTool::Commands::Build.new( BuildTool::Configuration.new(nil) )
12
- assert_equal cmd.name, "build"
13
- assert_equal cmd.description, "Build a module."
14
- # clean is off by default
15
- assert_equal false, cmd.instance_variable_get( "@clean" )
16
- # configure is off by default
17
- assert_equal false, cmd.instance_variable_get( "@configure" )
18
- # from-scratch is off by default
19
- assert_equal false, cmd.instance_variable_get( "@from_scratch" )
20
- # install is off by default
21
- assert_equal true, cmd.instance_variable_get( "@install" )
22
- # reconfigure is off by default
23
- assert_equal false, cmd.instance_variable_get( "@reconfigure" )
24
- # update is off by default
25
- assert_equal false, cmd.instance_variable_get( "@update" )
26
- end
27
-
28
- end
29
-
@@ -1,98 +0,0 @@
1
- require 'pathname'
2
- require Pathname.new( File.dirname(__FILE__)).join( 'test_helper' ).cleanpath
3
-
4
- require 'build-tool/build-system/base'
5
- require 'build-tool/module'
6
- require 'build-tool/cfg/parser'
7
-
8
- class TestBuildSystem < Test::Unit::TestCase
9
-
10
- def test_creation
11
- base = BuildTool::BuildSystem::Base.new
12
-
13
- # Out of source build is default
14
- assert base.out_of_source
15
-
16
- # No module is set
17
- assert_nil base.module
18
-
19
- # No options set
20
- assert_equal 0, base.options.size
21
- end
22
-
23
- def test_virtual_methods
24
- base = BuildTool::BuildSystem::Base.new
25
-
26
- assert_raise NotImplementedError do
27
- base.configure
28
- end
29
-
30
- assert_raise NotImplementedError do
31
- base.configured?
32
- end
33
-
34
- assert_raise NotImplementedError do
35
- base.make
36
- end
37
-
38
- assert_raise NotImplementedError do
39
- base.name
40
- end
41
-
42
- assert_raise NotImplementedError do
43
- base.reconfigure
44
- end
45
- end
46
-
47
- def test_module_required
48
- base = BuildTool::BuildSystem::Base.new
49
-
50
- assert_raise BuildTool::ConfigurationError do
51
- base.source_directory
52
- end
53
-
54
- assert_raise BuildTool::ConfigurationError do
55
- base.install_prefix
56
- end
57
-
58
- mod = BuildTool::Module::new( "kdelibs" )
59
- base.module = mod
60
-
61
- assert_raise BuildTool::ConfigurationError do
62
- base.source_directory
63
- end
64
-
65
- assert_raise BuildTool::ConfigurationError do
66
- base.install_prefix
67
- end
68
-
69
- mod.install_prefix= "/opt/kde"
70
- assert_equal "/opt/kde", base.install_prefix.to_s
71
-
72
- mod.build_prefix= "/home/user/kde"
73
- assert_equal "/home/user/kde/src/kdelibs", base.source_directory
74
- end
75
-
76
- def test_dup
77
- base = BuildTool::BuildSystem::CMake.new
78
- base['CMAKE_BUILD_TYPE'] = 'Debug'
79
- assert_equal 'Debug', base['CMAKE_BUILD_TYPE']
80
- copy = base.dup
81
- base['CMAKE_BUILD_TYPE'] = 'Release'
82
- assert_equal 'Debug', copy['CMAKE_BUILD_TYPE']
83
- assert_equal 'Release', base['CMAKE_BUILD_TYPE']
84
- end
85
-
86
- def test_parsing
87
- text = <<EOS
88
- build-system "cmake"
89
- inplace
90
- end
91
- EOS
92
- parser = BuildTool::Cfg::Parser.new
93
- configuration = parser.parse_string(text)
94
- test = configuration.build_system( "cmake" )
95
- assert !test.out_of_source
96
- end
97
-
98
- end
data/test/test_cli.rb DELETED
@@ -1,61 +0,0 @@
1
- require 'pathname'
2
- require Pathname.new( File.dirname(__FILE__)).join( 'test_helper' ).cleanpath
3
-
4
- require 'build-tool/configuration'
5
- require 'build-tool/commands'
6
- require 'build-tool/commands/build'
7
- require 'build-tool/commands/help'
8
- require 'build-tool/commands/recipes'
9
- require 'build-tool/commands/recipes/list'
10
- require 'build-tool/commands/recipes/install'
11
-
12
- class TestCli < Test::Unit::TestCase
13
-
14
- def setup
15
- cfg = BuildTool::Configuration.new(nil)
16
- @cmd = BuildTool::Commands::Shell.new( cfg )
17
- @cmd.add_command( BuildTool::Commands::Build.new( cfg ) )
18
- @cmd.add_command( BuildTool::Commands::Help.new( cfg ) )
19
- @cmd.add_command( BuildTool::Commands::Recipes::CLI.new( cfg ) )
20
- @cmd.get_command( "recipes" ).add_command( BuildTool::Commands::Recipes::List.new( cfg ) )
21
- @cmd.get_command( "recipes" ).add_command( BuildTool::Commands::Recipes::Install.new( cfg ) )
22
- end
23
-
24
- def teardown
25
- @cmd = nil
26
- end
27
-
28
- def test_command_completion
29
- assert_equal ["build"], @cmd.complete_command("bui")
30
- assert_equal ["build", "help", "recipes"], @cmd.complete_command("")
31
-
32
- assert_equal ["build"], @cmd.complete("bui")
33
- assert_equal ["build", "help", "recipes"], @cmd.complete("")
34
-
35
-
36
- end
37
-
38
- def test_subcommand_completion
39
- if !Readline.respond_to? 'line_buffer'
40
- assert_equal ["recipes list", "recipes install"], @cmd.complete( "recipes")
41
- assert_equal ["recipes list", "recipes install"], @cmd.complete( "recipes ")
42
- else
43
- assert_equal ["list", "install"], @cmd.complete( "recipes")
44
- assert_equal ["list", "install"], @cmd.complete( "recipes ")
45
- end
46
- end
47
-
48
- def test_argument_completion
49
- require 'readline'
50
- cmd = @cmd.get_command( "build" )
51
- if !Readline.respond_to? 'line_buffer'
52
- assert_equal ["build --clean", "build --configure"], cmd.complete( "build --c" )
53
- assert_equal ["build --from-scratch --clean", "build --from-scratch --configure"], cmd.complete( "build --from-scratch --c")
54
- assert_equal ["build --from-scratch --install"], cmd.complete( "build --from-scratch --inst")
55
- else
56
- assert_equal ["--clean", "--configure"], cmd.complete( "build --c" )
57
- assert_equal ["--clean", "--configure"], cmd.complete( "build --from-scratch --c" )
58
- end
59
- end
60
-
61
- end
data/test/test_command.rb DELETED
@@ -1,175 +0,0 @@
1
- require 'pathname'
2
- require Pathname.new( File.dirname(__FILE__)).join( 'test_helper' ).cleanpath
3
-
4
- require 'build-tool/configuration'
5
- require 'build-tool/commands'
6
-
7
- class TestCommand < BuildTool::Commands::Standard
8
-
9
- name "simple_test"
10
- description "For Testing purposes"
11
-
12
- attr_reader :do_clean, :do_configure, :do_from_scratch, :do_install, :do_reconfigure, :do_update
13
-
14
- def initialize_options
15
- @do_clean = false
16
- @do_configure = false
17
- @do_from_scratch = false
18
- @do_install = true
19
- @do_reconfigure = false
20
- @do_update = false
21
-
22
- reset_done_markers
23
-
24
- options.on( "--[no-]clean", "Make clean before building." ) { |t|
25
- @do_clean = t
26
- }
27
-
28
- options.on( "--[no-]install", "Do not install" ) { |t|
29
- @do_install = t
30
- }
31
-
32
- options.on( "--[no-]update", "Do not update from the repository" ) { |t|
33
- @do_update = t
34
- }
35
-
36
- options.on( "-c", "--configure", "Run the configuration step again" ) { |t|
37
- @do_configure = true
38
- }
39
-
40
- options.on( "--reconfigure", "Remove old configuration then run configuration again" ) { |t|
41
- @do_reconfigure = true
42
- }
43
-
44
- options.on( nil, "--from-scratch", "Rebuild from scratch" ) { |t|
45
- @do_from_scratch = true
46
- }
47
-
48
- super
49
-
50
- end
51
-
52
- # Reset the done markers
53
- def reset_done_markers
54
- @done_help = false
55
- @done_command = false
56
- end
57
-
58
- # Overload the show_help method to check if it was executed
59
- def show_help( args = [] )
60
- @done_help = true
61
- super
62
- end
63
- attr_reader :done_help
64
-
65
- # # Overload the do_execute method to check if it was executed
66
- def do_execute( args )
67
- @done_command = true
68
- end
69
- attr_reader :done_command
70
-
71
- end # class Build
72
-
73
-
74
- class TestBuildtoolCommands < ::Test::Unit::TestCase
75
-
76
- def test_default_values
77
- cmd = TestCommand.new( BuildTool::Configuration.new(nil) )
78
-
79
- assert_equal cmd.name, "simple_test"
80
- assert_equal cmd.description, "For Testing purposes"
81
-
82
- # clean is off by default
83
- assert !cmd.do_clean, "do not clean"
84
- # configure is off by default
85
- assert !cmd.do_configure, "do not configure"
86
- # from-scratch is off by default
87
- assert !cmd.do_from_scratch, "do not build from scratch"
88
- # install is off by default
89
- assert cmd.do_install, "do install"
90
- # reconfigure is off by default
91
- assert !cmd.do_reconfigure, "do not reconfigure"
92
- # update is off by default
93
- assert !cmd.do_update, "do not update"
94
-
95
- end
96
-
97
- def test_help
98
- # With --help call show_help and then return without executing the
99
- # command
100
- cmd = TestCommand.new( BuildTool::Configuration.new(nil) )
101
- assert !cmd.done_help.nil? and !cmd.done_help
102
- assert !cmd.done_command.nil? and !cmd.done_command
103
-
104
- expected_output = <<EOS
105
- Usage: simple_test [options]
106
- --[no-]clean Make clean before building.
107
- --[no-]install Do not install
108
- --[no-]update Do not update from the repository
109
- -c, --configure Run the configuration step again
110
- --reconfigure Remove old configuration then run configuration again
111
- --from-scratch Rebuild from scratch
112
- Common options
113
- -v, --verbose Enable verbose output
114
- --dry-run Enable dry run.
115
- -h, --help Show this help text
116
- EOS
117
- # *TODO* make that work again
118
- # assert_output( expected_output ) { cmd.execute(["--help"]) }
119
- cmd.execute(["--help"])
120
- assert cmd.done_help, "help was shown"
121
- assert !cmd.done_command, "command was not executed"
122
- end
123
-
124
- def test_verbose
125
-
126
- Logging.logger.root.appenders = Logging.appenders.stdout(
127
- :layout => Logging::Layouts::Pattern.new( :pattern => '%m\n' ),
128
- :level => :info)
129
-
130
- # --verbose should increase the verbosity by one
131
- cmd = TestCommand.new( BuildTool::Configuration.new(nil) )
132
-
133
- Logging.appenders['stdout'].level = :info
134
- current = Logging.appenders['stdout'].level
135
- cmd.execute(["--verbose"])
136
- assert_equal current - 1, Logging.appenders['stdout'].level
137
-
138
- Logging.appenders['stdout'].level = current
139
- cmd.execute(["--verbose", "--verbose"])
140
- assert_equal current - 2, Logging.appenders['stdout'].level
141
-
142
- # There are no more levels.
143
- Logging.appenders['stdout'].level = current
144
- cmd.execute(["--verbose", "--verbose", "--verbose", "--verbose", "--verbose", "--verbose", "--verbose"])
145
- assert_equal 0, Logging.appenders['stdout'].level
146
-
147
- Logging.logger.root.clear_appenders()
148
- end
149
-
150
- def test_execute_twice
151
- # When executing the command more than once make sure the options are
152
- # reset
153
- cmd = TestCommand.new( BuildTool::Configuration.new(nil) )
154
- assert !cmd.done_help.nil? and !cmd.done_help
155
- assert !cmd.done_command.nil? and !cmd.done_command
156
- cmd.execute(["--install", "--clean"])
157
- assert cmd.do_install, "do make install"
158
- assert cmd.do_clean, "do make clean"
159
-
160
- cmd.execute(["--update", "--configure"])
161
- assert cmd.do_install, "do not make install"
162
- assert !cmd.do_clean, "do not make clean"
163
- assert cmd.do_update, "do update"
164
- assert cmd.do_configure, "do configure"
165
- end
166
-
167
- def test_completion
168
- cmd = TestCommand.new( BuildTool::Configuration.new(nil) )
169
- assert_equal [ "--from-scratch" ], cmd.complete_arguments( ["--from"] )
170
- assert_equal ["--no-clean", "--no-install", "--no-update"], cmd.complete_arguments( ["--no"] )
171
- assert_equal ["--clean", "--configure"], cmd.complete_arguments( ["--c"] )
172
- end
173
-
174
- end
175
-
@@ -1,597 +0,0 @@
1
- require 'pathname'
2
- require Pathname.new( File.dirname(__FILE__)).join( 'test_helper' ).cleanpath
3
-
4
- require 'build-tool/cfg/parser'
5
-
6
- class TestConfigurationParser < Test::Unit::TestCase
7
-
8
- def test_build_system
9
- text = <<-EOS
10
- # Check that build systems are open. You can add to them. by just
11
- # redeclaring them
12
- build-system cmake
13
- option CMAKE_CXXFLAGS "-Wall"
14
- option CMAKE_VERBOSE_MAKEFILE "1"
15
- end
16
-
17
- # Add a value
18
- build-system cmake
19
- option CMAKE_BUILD_TYPE "Debug"
20
- end
21
-
22
- # Overwrite a value
23
- build-system cmake
24
- option CMAKE_CXXFLAGS "-Wall -pipe -O0"
25
- end
26
- EOS
27
- parser = BuildTool::Cfg::Parser.new
28
- configuration = parser.parse_string(text)
29
-
30
- default = configuration.build_system("cmake")
31
- assert_not_nil default
32
- assert_equal "-Wall -pipe -O0", default['CMAKE_CXXFLAGS']
33
- assert_equal "1", default['CMAKE_VERBOSE_MAKEFILE']
34
- assert_equal "Debug", default['CMAKE_BUILD_TYPE']
35
- end
36
-
37
- def test_environment
38
- text = <<-EOS
39
- # Check that environments are open. You can add to them. by just
40
- # redeclaring them
41
- environment default
42
- var PATH set "/usr/bin"
43
- var MANPATH set "/usr/share/man"
44
- end
45
-
46
- environment default
47
- var PATH set "/usr/bin:/bin"
48
- var PKG_CONFIG_PATH set "/usr/lib64/pkgconfig"
49
- end
50
-
51
- environment copy < default
52
- end
53
-
54
- # Test inheritance
55
- environment kde4 < default
56
- var PATH prepend "/opt/kde4/bin"
57
- var MANPATH append "/opt/kde4/share/man"
58
- var PKG_CONFIG_PATH set "/opt/kde4/lib64/pkgconfig"
59
- end
60
- EOS
61
- parser = BuildTool::Cfg::Parser.new
62
- configuration = parser.parse_string(text)
63
-
64
- default = configuration.environment("default")
65
- assert_not_nil default
66
- assert_equal "/usr/bin:/bin", default['PATH']
67
- assert_equal "/usr/share/man", default['MANPATH']
68
- assert_equal "/usr/lib64/pkgconfig", default['PKG_CONFIG_PATH']
69
-
70
- # Copy is just that. a copy
71
- copy = configuration.environment("copy")
72
- assert_not_nil copy
73
- assert_equal default['PATH'], copy['PATH']
74
- assert_equal default['MANPATH'], copy['MANPATH']
75
- assert_equal default['PKG_CONFIG_PATH'], copy['PKG_CONFIG_PATH']
76
-
77
- # kde4 add to default
78
- kde4 = configuration.environment("kde4")
79
- assert_not_nil kde4
80
- assert_equal "/opt/kde4/bin:/usr/bin:/bin", kde4['PATH']
81
- assert_equal "/usr/share/man:/opt/kde4/share/man", kde4['MANPATH']
82
- assert_equal "/opt/kde4/lib64/pkgconfig", kde4['PKG_CONFIG_PATH']
83
- end
84
-
85
- def test_repository
86
- text = <<-EOS
87
- server kde
88
- protocol "svn+ssh"
89
- host "svn.kde.org"
90
- end
91
-
92
- repository kde
93
- use server kde
94
- path "KDE"
95
- end
96
-
97
- repository kde
98
- user mjansen
99
- end
100
-
101
- server kde
102
- protocol "svn+ssh"
103
- host "svn.kde.org"
104
- path "home/kde"
105
- end
106
- EOS
107
- parser = BuildTool::Cfg::Parser.new
108
- configuration = parser.parse_string(text)
109
-
110
- default = configuration.repository("kde")
111
- assert_not_nil default
112
- assert_equal "svn+ssh", default.server.protocol
113
- assert_equal "svn.kde.org", default.server.host
114
- assert_equal "home/kde", default.server.path
115
- assert_equal "mjansen", default.user
116
- assert_equal "KDE", default.path
117
- assert_equal "svn+ssh://mjansen@svn.kde.org/home/kde/KDE", default.url
118
- end
119
-
120
- def test_features
121
- text = <<-EOS
122
- feature devel
123
- short description "KDE Development Tools"
124
- feature playground
125
- short description "Playground modules"
126
- end
127
- end
128
-
129
- feature graphics
130
- short description "KDE Development Tools"
131
- feature playground
132
- short description "Playground modules"
133
- module kdesupport end
134
- end
135
- end
136
-
137
- disable feature graphics
138
- EOS
139
- parser = BuildTool::Cfg::Parser.new
140
- configuration = parser.parse_string(text)
141
-
142
- # Check devel top level feature ( active )
143
- devel = configuration.feature("devel")
144
- assert devel.active?
145
- assert "KDE Development Tools", devel.description
146
- assert "devel", devel.path
147
- assert "devel", devel.name
148
- assert_nil devel.parent
149
-
150
- # Check devel/playground feature ( active )
151
- playground = configuration.feature("devel/playground")
152
- assert playground.active?
153
- assert "Playground modules", playground.description
154
- assert "playground", playground.path
155
- assert "devel/playground", playground.name
156
- assert_equal devel, playground.parent
157
-
158
- # Check graphics top level feature ( not active )
159
- graphics = configuration.feature("graphics")
160
- assert !graphics.active?
161
- assert "KDE Development Tools", graphics.description
162
- assert "graphics", graphics.path
163
- assert "graphics", graphics.name
164
- assert_nil graphics.parent
165
-
166
- # Check graphics/playground feature ( not active )
167
- playground = configuration.feature("graphics/playground")
168
- assert !playground.active?
169
- assert "Playground modules", playground.description
170
- assert "playground", playground.path
171
- assert "graphics/playground", playground.name
172
- assert_equal graphics, playground.parent
173
- end
174
-
175
- def test_module
176
- text = <<-EOS
177
- environment kdelibs end
178
-
179
- server kde
180
- protocol "svn+ssh"
181
- host "svn.kde.org"
182
- end
183
-
184
- repository kde
185
- use server kde
186
- path "/home/kde"
187
- end
188
-
189
- repository kde-core
190
- use server kde
191
- path "/home/kde"
192
- end
193
-
194
- module kdelibs
195
- use environment kdelibs
196
- use repository kde-core
197
- use vcs git-svn
198
- local-path "kdelibs"
199
- end
200
-
201
- module kdelibs
202
- remote-path "kdelibs2"
203
- use repository kde
204
- build-prefix "/build/kde"
205
- end
206
- EOS
207
- parser = BuildTool::Cfg::Parser.new
208
- configuration = parser.parse_string(text)
209
-
210
- kdelibs = configuration.module("kdelibs")
211
- assert_not_nil kdelibs
212
- assert_equal "kdelibs", kdelibs.name
213
- assert_not_nil kdelibs.repository
214
- assert_equal "kde", kdelibs.repository.name
215
- assert_equal "kdelibs", kdelibs.environment.name
216
- assert_equal "kdelibs", kdelibs.local_path
217
- assert_equal "kdelibs2", kdelibs.remote_path
218
- assert_equal "/build/kde/src/kdelibs", kdelibs.source_directory
219
- assert_equal "/build/kde/bld/kdelibs", kdelibs.build_directory
220
- assert_equal "/build/kde/src/kdelibs", kdelibs.vcs.local_path
221
- end
222
-
223
- def test_module_inheritance
224
- text = <<-EOS
225
- environment kdelibs end
226
-
227
- server kde
228
- protocol "svn+ssh"
229
- host "svn.kde.org"
230
- end
231
-
232
- repository kde
233
- use server kde
234
- path "/home"
235
- user mjansen
236
- end
237
-
238
- module kdelibs
239
- use environment kdelibs
240
- use repository kde
241
- use build-system cmake
242
- use vcs git-svn
243
- local-path "kdelibs"
244
- end
245
-
246
- # test inheritance
247
- module kdebase-runtime < kdelibs
248
- end
249
-
250
- module kdebase-workspace < kdebase-runtime
251
- use vcs svn
252
- environment kdebase end
253
- end
254
-
255
- module kdelibs_copy < kdelibs
256
- use vcs svn
257
- end
258
-
259
- module kdelibs
260
- remote-path "kdelibs2"
261
- build-prefix "/build/kde"
262
- end
263
- EOS
264
- parser = BuildTool::Cfg::Parser.new
265
- configuration = parser.parse_string(text)
266
-
267
- kdelibs = configuration.module("kdelibs")
268
- assert_not_nil kdelibs
269
- assert_equal "kdelibs", kdelibs.name
270
- assert_equal "kde", kdelibs.repository.name
271
- assert_equal "kdelibs", kdelibs.environment.name
272
- assert_equal "kdelibs", kdelibs.local_path
273
- assert_equal "kdelibs2", kdelibs.remote_path
274
- assert_equal "/build/kde/src/kdelibs", kdelibs.source_directory
275
- assert_equal "/build/kde/bld/kdelibs", kdelibs.build_directory
276
- assert_equal "/build/kde/src/kdelibs", kdelibs.vcs.local_path
277
-
278
- mod = configuration.module("kdebase-runtime")
279
- assert_not_nil mod
280
- assert_equal "kdebase-runtime", mod.name
281
- assert_equal kdelibs.repository, mod.repository
282
- assert_equal kdelibs.build_prefix, mod.build_prefix
283
- assert_equal kdelibs.repository.name, mod.repository.name
284
- assert_equal kdelibs.environment.name, mod.environment.name
285
- # Those are not inherited and fall back to module name
286
- assert_equal "kdebase-runtime", mod.local_path
287
- assert_equal "kdebase-runtime", mod.remote_path
288
- assert_equal "/build/kde/src/kdebase-runtime", mod.source_directory
289
- assert_equal "/build/kde/bld/kdebase-runtime", mod.build_directory
290
- assert_equal "/build/kde/src/kdebase-runtime", mod.vcs.local_path
291
- # Check we work on a copy
292
- assert_equal "/build/kde/src/kdelibs", kdelibs.vcs.local_path
293
-
294
- mod = configuration.module("kdebase-workspace")
295
- assert_not_nil mod
296
- assert_equal "kdebase-workspace", mod.name
297
- assert_equal "kdebase", mod.environment.name
298
- assert_equal "svn", mod.vcs.name
299
-
300
- kdelibs = configuration.module("kdelibs_copy")
301
- assert_not_nil kdelibs
302
- assert_equal "kdelibs_copy", kdelibs.name
303
- assert_equal "kde", kdelibs.repository.name
304
- assert_equal "kdelibs", kdelibs.environment.name
305
- assert_equal "kdelibs_copy", kdelibs.local_path
306
- assert_equal "kdelibs_copy", kdelibs.remote_path
307
- assert_equal "/build/kde/src/kdelibs_copy", kdelibs.source_directory
308
- assert_equal "/build/kde/bld/kdelibs_copy", kdelibs.build_directory
309
- assert_equal "/build/kde/src/kdelibs_copy", kdelibs.vcs.local_path
310
-
311
- end
312
-
313
- def test_existing_configuration
314
-
315
- parser = BuildTool::Cfg::Parser.new
316
-
317
- text = <<-EOS
318
- environment kdelibs end
319
-
320
- server kde
321
- protocol "svn+ssh"
322
- host "svn.kde.org"
323
- end
324
-
325
- repository kde
326
- use server kde
327
- path "/home"
328
- user mjansen
329
- end
330
-
331
- module kdelibs
332
- use environment kdelibs
333
- use repository kde
334
- use vcs git-svn
335
- local-path "kdelibs"
336
- remote-path "kdelibs2"
337
- build-prefix "/build/kde"
338
- end
339
- EOS
340
- configuration = parser.parse_string(text)
341
-
342
- kdelibs = configuration.module("kdelibs")
343
- assert_not_nil kdelibs
344
- assert_equal "kdelibs", kdelibs.name
345
- assert_not_nil kdelibs.repository
346
- assert_equal "kde", kdelibs.repository.name
347
- assert_equal "kdelibs", kdelibs.environment.name
348
- assert_equal "kdelibs", kdelibs.local_path
349
- assert_equal "kdelibs2", kdelibs.remote_path
350
- assert_equal "/build/kde/src/kdelibs", kdelibs.source_directory
351
- assert_equal "/build/kde/bld/kdelibs", kdelibs.build_directory
352
- assert_equal "/build/kde/src/kdelibs", kdelibs.vcs.local_path
353
-
354
- text2 = <<-EOS
355
- environment kde2 end
356
-
357
- # Change one aspect of kdelibs
358
- module kdelibs
359
- use environment kde2
360
- end
361
-
362
- server kde
363
- protocol "svn+ssh"
364
- host "svn.kde.org"
365
- end
366
-
367
- # Change the kde repository
368
- repository kde
369
- use server kde
370
- path "/home"
371
- user meier
372
- end
373
-
374
- # test inheritance
375
- module kdebase-runtime < kdelibs
376
- end
377
-
378
- module kdebase-workspace < kdebase-runtime
379
- use vcs svn
380
- environment kdebase end
381
- end
382
- EOS
383
- parser = BuildTool::Cfg::Parser.new( configuration )
384
- configuration = parser.parse_string( text2 )
385
-
386
- kdelibs = configuration.module("kdelibs")
387
- assert_not_nil kdelibs
388
- assert_equal "kdelibs", kdelibs.name
389
- assert_not_nil kdelibs.repository
390
- assert_equal "kde", kdelibs.repository.name
391
- assert_equal "kde2", kdelibs.environment.name
392
- assert_equal "kdelibs", kdelibs.local_path
393
- assert_equal "kdelibs2", kdelibs.remote_path
394
- assert_equal "/build/kde/src/kdelibs", kdelibs.source_directory
395
- assert_equal "/build/kde/bld/kdelibs", kdelibs.build_directory
396
- assert_equal "/build/kde/src/kdelibs", kdelibs.vcs.local_path
397
- assert_equal "meier", kdelibs.repository.user
398
-
399
- mod = configuration.module("kdebase-runtime")
400
- assert_not_nil mod
401
- assert_equal "kdebase-runtime", mod.name
402
- assert_equal kdelibs.repository, mod.repository
403
- assert_equal kdelibs.build_prefix, mod.build_prefix
404
- assert_equal kdelibs.repository.name, mod.repository.name
405
- assert_equal kdelibs.environment.name, mod.environment.name
406
- # Those are not inherited and fall back to module name
407
- assert_equal "kdebase-runtime", mod.local_path
408
- assert_equal "kdebase-runtime", mod.remote_path
409
- assert_equal "/build/kde/src/kdebase-runtime", mod.source_directory
410
- assert_equal "/build/kde/bld/kdebase-runtime", mod.build_directory
411
- assert_equal "/build/kde/src/kdebase-runtime", mod.vcs.local_path
412
- # Check we work on a copy
413
- assert_equal "/build/kde/src/kdelibs", kdelibs.vcs.local_path
414
-
415
- mod = configuration.module("kdebase-workspace")
416
- assert_not_nil mod
417
- assert_equal "kdebase-workspace", mod.name
418
- assert_equal "kdebase", mod.environment.name
419
- assert_equal "svn", mod.vcs.name
420
- end
421
-
422
- def test_sshkeys
423
- text = <<-EOS
424
- ssh-key "user@userdomain.example"
425
- file "~/.ssh/id_dsa"
426
- end
427
-
428
- ssh-key "user_other_email@userdomain.example"
429
- file "~/.ssh/id_other_email_dsa"
430
- end
431
- EOS
432
- parser = BuildTool::Cfg::Parser.new
433
- configuration = parser.parse_string(text)
434
-
435
- default = configuration.sshkey("user@userdomain.example")
436
- assert_not_nil default
437
- assert_equal File.expand_path( "~/.ssh/id_dsa" ), default.file
438
-
439
- other = configuration.sshkey("user_other_email@userdomain.example")
440
- assert_not_nil other
441
- assert_equal File.expand_path( "~/.ssh/id_other_email_dsa" ), other.file
442
- end
443
-
444
- def test_template
445
- text = <<-EOS
446
- environment kdelibs end
447
-
448
- server kde
449
- protocol "svn+ssh"
450
- host "svn.kde.org"
451
- end
452
-
453
- repository kde
454
- use server kde
455
- path "/home"
456
- user mjansen
457
- end
458
-
459
- module kdelibstemplate TEMPLATE
460
- use environment kdelibs
461
- use repository kde
462
- use vcs git-svn
463
- build-prefix "/build/kde"
464
- end
465
-
466
- module kdelibs < kdelibstemplate end
467
- EOS
468
- parser = BuildTool::Cfg::Parser.new
469
- configuration = parser.parse_string(text)
470
-
471
- kdelibs = configuration.module("kdelibs")
472
- assert_not_nil kdelibs
473
- assert_equal "kdelibs", kdelibs.name
474
- assert_not_nil kdelibs.repository
475
- assert_equal "kde", kdelibs.repository.name
476
- assert_equal "kdelibs", kdelibs.environment.name
477
- assert_equal "kdelibs", kdelibs.local_path
478
- assert_equal "kdelibs", kdelibs.remote_path
479
- assert_equal "/build/kde/src/kdelibs", kdelibs.source_directory
480
- assert_equal "/build/kde/bld/kdelibs", kdelibs.build_directory
481
- assert_equal "/build/kde/src/kdelibs", kdelibs.vcs.local_path
482
- end
483
-
484
- # Just test that a complete configuration file with all parts is read
485
- def test_complete
486
- text = <<-EOS
487
- ssh-key "user@userdomain.example"
488
- file "~/.ssh/id_dsa"
489
- end
490
-
491
- build-system cmake
492
- option CMAKE_CXXFLAGS "-Wall -pipe -O0"
493
- option CMAKE_VERBOSE_MAKEFILE "1"
494
- option CMAKE_BUILD_TYPE "Debug"
495
- end
496
-
497
- build-system qt
498
- option flags ""
499
- end
500
-
501
- server kde
502
- protocol "svn+ssh"
503
- host "svn.kde.org"
504
- end
505
-
506
- repository kde
507
- use server kde
508
- path "/home"
509
- user mjansen
510
- end
511
-
512
- environment default
513
- var PATH set "/usr/bin:/bin"
514
- var MANPATH set "/usr/share/man"
515
- var KDEDIRS set ""
516
- var PKG_CONFIG_PATH set "/usr/lib64/pkgconfig"
517
- var LD_LIBRARY_PATH set ""
518
- end
519
-
520
- environment kdesupport < default
521
- var PATH prepend "/opt/kde/support/bin"
522
- var MANPATH append "/opt/kde/support/share/man"
523
- var KDEDIRS set "/opt/kde/support"
524
- var PKG_CONFIG_PATH prepend "/opt/kde/support/lib64/pkgconfig"
525
- end
526
-
527
- module kdesupport
528
- use environment kdesupport
529
- use repository kde
530
- end
531
-
532
-
533
- module kdelibs
534
-
535
- environment kdelibs < kdesupport
536
- var PATH prepend "/opt/kde/libs/bin"
537
- var MANPATH append "/opt/kde/libs/share/man"
538
- var KDEDIRS prepend "/opt/kde/libs"
539
- var PKG_CONFIG_PATH prepend "/opt/kde/libs/lib64/pkgconfig"
540
- end
541
-
542
- use repository kde
543
- use build-system cmake
544
- vcs git-svn
545
- external "kwin/clients/nitrogen/lib#<%= KDESVNSERVER %>/kde/trunk/KDE/kdebase/runtime/kstyles/oxygen/lib"
546
- external "kwin/clients/oxygen/lib#<%= KDESVNSERVER %>/kde/trunk/KDE/kdebase/runtime/kstyles/oxygen/lib"
547
- end
548
-
549
- remote-path "KDE/kdelibs"
550
- local-path "KDE/kdelibs"
551
- install-prefix "/opt/kde/libs"
552
- build-prefix "~"
553
-
554
- end
555
-
556
- environment kdepimlibs < kdesupport
557
- var PATH prepend "/opt/kde/pimlibs/bin"
558
- var MANPATH append "/opt/kde/pimlibs/share/man"
559
- var KDEDIRS prepend "/opt/kde/pimlibs"
560
- var PKG_CONFIG_PATH prepend "/opt/kde/pimlibs/lib64/pkgconfig"
561
- end
562
-
563
- module kdepimlibs
564
- use environment kdepimlibs
565
- use repository kde
566
- end
567
-
568
- environment kdebase < kdelibs
569
- var PATH prepend "/opt/kde/base/bin"
570
- var MANPATH append "/opt/kde/base/share/man"
571
- var KDEDIRS prepend "/opt/kde/base"
572
- var PKG_CONFIG_PATH prepend "/opt/kde/base/lib64/pkgconfig"
573
- end
574
-
575
- module kdebase
576
- use environment kdebase
577
- use repository kde
578
- end
579
- EOS
580
- parser = BuildTool::Cfg::Parser.new
581
- configuration = parser.parse_string(text)
582
- kdelibs = configuration.module("kdelibs")
583
-
584
- assert_not_nil kdelibs
585
- assert_equal "KDE/kdelibs", kdelibs.remote_path
586
- assert_equal "KDE/kdelibs", kdelibs.local_path
587
- assert_equal "/opt/kde/libs", kdelibs.install_prefix.to_s
588
- assert_not_nil kdelibs.vcs
589
- assert_equal "git-svn", kdelibs.vcs.name
590
-
591
- assert_same configuration.repository("kde"), kdelibs.repository
592
- assert_same configuration.environment("kdelibs"), kdelibs.environment
593
-
594
- assert_equal "/opt/kde/libs/bin:/opt/kde/support/bin:/usr/bin:/bin", configuration.environment("kdelibs")["PATH"]
595
- end
596
-
597
- end