build-tool 0.1.4 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. data.tar.gz.sig +2 -3
  2. data/History.txt +29 -0
  3. data/Manifest.txt +39 -10
  4. data/README.txt +5 -8
  5. data/Rakefile +14 -6
  6. data/bin/build-tool +3 -35
  7. data/db/migrations/001_command_histories.rb +20 -0
  8. data/db/migrations/002_module_events.rb +24 -0
  9. data/db/migrations/003_command_histories_add_logfile.rb +19 -0
  10. data/lib/build-tool.rb +1 -1
  11. data/lib/build-tool/application.rb +103 -30
  12. data/lib/build-tool/build-system/autoconf.rb +69 -6
  13. data/lib/build-tool/build-system/base.rb +2 -25
  14. data/lib/build-tool/build-system/custom.rb +6 -19
  15. data/lib/build-tool/build-system/kdel10n.rb +39 -0
  16. data/lib/build-tool/build-system/none.rb +82 -0
  17. data/lib/build-tool/cfg/lexer.rb +133 -7
  18. data/lib/build-tool/cfg/lexer.rex +58 -6
  19. data/lib/build-tool/cfg/node.rb +13 -1
  20. data/lib/build-tool/cfg/parser.rb +519 -333
  21. data/lib/build-tool/cfg/parser.y +74 -11
  22. data/lib/build-tool/cfg/visitor.rb +182 -20
  23. data/lib/build-tool/command_actions.rb +202 -0
  24. data/lib/build-tool/commands.rb +193 -49
  25. data/lib/build-tool/commands/build.rb +13 -8
  26. data/lib/build-tool/commands/configure.rb +8 -3
  27. data/lib/build-tool/commands/environments.rb +4 -8
  28. data/lib/build-tool/commands/environments/list.rb +8 -0
  29. data/lib/build-tool/commands/fetch.rb +7 -2
  30. data/lib/build-tool/commands/gc.rb +53 -0
  31. data/lib/build-tool/commands/history.rb +111 -0
  32. data/lib/build-tool/commands/install.rb +6 -1
  33. data/lib/build-tool/commands/lsfeatures.rb +73 -0
  34. data/lib/build-tool/commands/modules.rb +3 -7
  35. data/lib/build-tool/commands/modules/info.rb +15 -6
  36. data/lib/build-tool/commands/modules/list.rb +10 -5
  37. data/lib/build-tool/commands/rebase.rb +6 -1
  38. data/lib/build-tool/commands/recipes.rb +3 -7
  39. data/lib/build-tool/configuration.rb +24 -1
  40. data/lib/build-tool/environment.rb +17 -3
  41. data/lib/build-tool/feature.rb +47 -0
  42. data/lib/build-tool/history.rb +173 -0
  43. data/lib/build-tool/module.rb +49 -90
  44. data/lib/build-tool/recipe.rb +5 -0
  45. data/lib/build-tool/vcs/archive.rb +140 -0
  46. data/lib/build-tool/vcs/base.rb +5 -5
  47. data/lib/build-tool/vcs/git-svn.rb +4 -0
  48. data/lib/build-tool/vcs/git.rb +4 -0
  49. data/lib/mj/logging.rb +11 -0
  50. data/recipes/{kdeqt4.6 → kde}/custom/qt/qtscriptgenerator/compile.sh +0 -0
  51. data/recipes/{kdeqt4.6 → kde}/custom/qt/qtscriptgenerator/configure.sh +0 -0
  52. data/recipes/{kdeqt4.6 → kde}/custom/qt/qtscriptgenerator/install.sh +0 -0
  53. data/recipes/kde/custom/scripting/pyqt4/compile.sh +10 -0
  54. data/recipes/kde/custom/scripting/pyqt4/configure.sh +14 -0
  55. data/recipes/kde/custom/scripting/pyqt4/install.sh +10 -0
  56. data/recipes/kde/custom/scripting/sip/compile.sh +10 -0
  57. data/recipes/kde/custom/scripting/sip/configure.sh +13 -0
  58. data/recipes/kde/custom/scripting/sip/install.sh +10 -0
  59. data/recipes/kde/files/xsession +8 -4
  60. data/recipes/kde/kde-bindings.recipe +22 -0
  61. data/recipes/kde/kde-core.recipe +104 -0
  62. data/recipes/kde/kde-devel.recipe +38 -0
  63. data/recipes/kde/kde-finance.recipe +17 -0
  64. data/recipes/kde/kde-graphics.recipe +27 -0
  65. data/recipes/kde/kde-kdevelop.recipe +116 -0
  66. data/recipes/kde/kde-l10n.recipe +14 -0
  67. data/recipes/kde/kde-multimedia.recipe +31 -0
  68. data/recipes/kde/kde-network.recipe +55 -0
  69. data/recipes/kde/kde-office.recipe +28 -0
  70. data/recipes/kde/kde-plasma.recipe +117 -0
  71. data/recipes/{kdeqt4.6/recipe → kde/kde-qt.recipe} +25 -57
  72. data/recipes/kde/kde-scripting.recipe +63 -0
  73. data/recipes/kde/kde-support.recipe +73 -0
  74. data/recipes/kde/kde-utils.recipe +22 -0
  75. data/recipes/kde/kde-webdev.recipe +41 -0
  76. data/recipes/kde/recipe +92 -532
  77. data/recipes/kde/recipe-local +58 -2
  78. data/recipes/kde/settings.yaml +17 -0
  79. data/recipes/kde43/recipe-local +58 -2
  80. data/test/test_configuration_parser.rb +76 -21
  81. data/test/test_feature.rb +34 -0
  82. data/test/test_history.rb +149 -0
  83. metadata +185 -30
  84. metadata.gz.sig +0 -0
  85. data/lib/build-tool/pluginbase.rb +0 -43
  86. data/recipes/kdeqt4.6/info.yaml +0 -7
  87. data/recipes/kdeqt4.6/recipe-local +0 -30
  88. data/recipes/kdeqt4.6/settings.yaml +0 -27
  89. data/tasks/rdoc.rake +0 -34
  90. data/test.rb +0 -28
@@ -1,20 +1,27 @@
1
1
  class BuildTool::Cfg::Parser < BuildTool::Cfg::Lexer
2
2
 
3
3
  token APPEND
4
+ token ARCHIVE
4
5
  token BUILD_PREFIX
5
6
  token BUILD_SYSTEM
7
+ token DESCRIPTION
8
+ token DISABLE
9
+ token ENABLE
6
10
  token END
7
11
  token ENVIRONMENT
8
12
  token EXTERNAL
13
+ token FEATURE
9
14
  token FILE
10
15
  token GIT
11
16
  token GIT_SVN
12
17
  token HOST
18
+ token INCLUDE
13
19
  token INHERITANCE
14
20
  token INPLACE
15
21
  token INSTALL_PREFIX
16
22
  token LOCAL_PATH
17
23
  token LOG_DIRECTORY
24
+ token LONG
18
25
  token MODULE
19
26
  token OPTION
20
27
  token PATH
@@ -25,6 +32,7 @@ class BuildTool::Cfg::Parser < BuildTool::Cfg::Lexer
25
32
  token REPOSITORY
26
33
  token SERVER
27
34
  token SET
35
+ token SHORT
28
36
  token SSH_KEY
29
37
  token STRING
30
38
  token TEMPLATE
@@ -38,7 +46,7 @@ class BuildTool::Cfg::Parser < BuildTool::Cfg::Lexer
38
46
  rule
39
47
 
40
48
  main
41
- : statements { result = ConfigurationFileList.new( val[0] ); }
49
+ : top_level_statements { result = ConfigurationFileList.new( val[0] ); }
42
50
  ;
43
51
 
44
52
  #
@@ -54,29 +62,59 @@ rule
54
62
  : INHERITANCE { result = :INHERITANCE; }
55
63
  ;
56
64
 
57
- #
65
+ #
58
66
  ### TOP LEVEL STATEMENTS
59
67
  #
60
- statements
68
+ top_level_statements
61
69
  : /* empty */
62
- | statement statements { result = val.flatten; }
70
+ | top_level_statement top_level_statements { result = val.flatten; }
71
+ ;
72
+
73
+ top_level_statement
74
+ : LOG_DIRECTORY STRING { result = LogDirectoryNode.new( val[1] ); }
75
+ | DISABLE FEATURE identifier { result = DisableFeatureNode.new( val[2] ); }
76
+ | ENABLE FEATURE identifier { result = EnableFeatureNode.new( val[2] ); }
77
+ | DISABLE MODULE identifier { result = DisableModuleNode.new( val[2] ); }
78
+ | ENABLE MODULE identifier { result = EnableModuleNode.new( val[2] ); }
79
+ | statement { result = val[0]; }
63
80
  ;
64
81
 
82
+ #
83
+ ### STATEMENTS
84
+ #
85
+
65
86
  statement
66
- : LOG_DIRECTORY STRING { result = LogDirectoryNode.new( val[1] ); }
67
- | build_system_declaration { result = val[0]; }
87
+ : build_system_declaration { result = val[0]; }
68
88
  | environment_declaration { result = val[0]; }
69
89
  | module_declaration { result = val[0]; }
70
90
  | repository_declaration { result = val[0]; }
71
91
  | server_declaration { result = val[0]; }
72
92
  | ssh_key_declaration { result = val[0]; }
93
+ | include_directive { result = val[0]; }
94
+ | feature_declaration { result = val[0]; }
73
95
  ;
74
96
 
75
97
  vcs_declaration
76
98
  : git_declaration { result = val[0]; }
77
99
  | git_svn_declaration { result = val[0]; }
100
+ | archive_declaration { result = val[0]; }
78
101
  ;
79
102
 
103
+ #
104
+ ### GIT-SVN CONFIGURATION
105
+ #
106
+ archive_declaration
107
+ : VCS ARCHIVE archive_statements END { result = ArchiveDeclarationNode.new( val[2] ); }
108
+ ;
109
+
110
+ archive_statements
111
+ : /* empty */
112
+ # | archive_statement archive_statements { result = val.flatten; }
113
+ ;
114
+
115
+ # archive_statement
116
+ # ;
117
+
80
118
  #
81
119
  ### BUILD SYSTEM DECLARATION
82
120
  #
@@ -113,6 +151,24 @@ rule
113
151
  | VAR TOKEN APPEND STRING { result = EnvironmentVariableNode.new( val[1..-1] ); }
114
152
  ;
115
153
 
154
+ #
155
+ ### FEATURE DECLARATION
156
+ #
157
+ feature_declaration
158
+ : FEATURE identifier feature_statements END { result = FeatureNode.new( val[1..-2] ) }
159
+ ;
160
+
161
+ feature_statements
162
+ : /* empty */
163
+ | feature_statement feature_statements { result = val.flatten; }
164
+ ;
165
+
166
+ feature_statement
167
+ : statement { result = val.flatten; }
168
+ | LONG DESCRIPTION STRING { result = LongDescriptionNode.new( val[2] ); }
169
+ | SHORT DESCRIPTION STRING { result = ShortDescriptionNode.new( val[2] ); }
170
+ ;
171
+
116
172
  #
117
173
  ### GIT CONFIGURATION
118
174
  #
@@ -152,8 +208,15 @@ rule
152
208
  ;
153
209
 
154
210
  git_svn_statement
155
- : git_statement
156
- | EXTERNAL STRING { result = GitSvnExternalNode.new( val[1] ); }
211
+ : git_statement { result = val[0]; }
212
+ | EXTERNAL STRING { result = GitSvnExternalNode.new( val[1] ); }
213
+ ;
214
+
215
+ #
216
+ ### INCLUDE DIRECTIVE
217
+ #
218
+ include_directive
219
+ : INCLUDE STRING { result = IncludeNode.new( val[1] ) };
157
220
  ;
158
221
 
159
222
  #
@@ -198,11 +261,12 @@ rule
198
261
  ;
199
262
 
200
263
  repository_statement
201
- : SERVER identifier { result = RepositoryServerNode.new( val[1] ); }
202
- | PATH STRING { result = RepositoryPathNode.new( val[1] ); }
264
+ : PATH STRING { result = RepositoryPathNode.new( val[1] ); }
203
265
  | USER identifier { result = RepositoryUserNode.new( val[1] ); }
204
266
  | USE SSH_KEY identifier { result = UseSshKeyNode.new( val[2] ); }
267
+ | USE SERVER identifier { result = UseServerNode.new( val[2] ); }
205
268
  | ssh_key_declaration { result = val[0]; }
269
+ | server_declaration { result = val[0]; }
206
270
  ;
207
271
 
208
272
  #
@@ -239,7 +303,6 @@ rule
239
303
  : FILE STRING { result = SshKeyFileNode.new( val[1] ); }
240
304
  ;
241
305
 
242
-
243
306
  end # class BuildTool::Cfg::GitParser
244
307
 
245
308
  ---- header ----
@@ -1,5 +1,6 @@
1
1
  require 'build-tool/configuration'
2
2
  require 'build-tool/environment'
3
+ require 'build-tool/feature'
3
4
  require 'build-tool/repository'
4
5
  require 'build-tool/module'
5
6
  require 'build-tool/sshkey'
@@ -13,6 +14,9 @@ module BuildTool; module Cfg;
13
14
  # The configuration object to fill with our parse results.
14
15
  attr_reader :configuration
15
16
 
17
+ class ArgumentsError < StandardError
18
+ end
19
+
16
20
  def initialize( configuration )
17
21
  @configuration = configuration
18
22
  end
@@ -72,11 +76,8 @@ module BuildTool; module Cfg;
72
76
 
73
77
  end
74
78
 
75
-
76
- # The Configuration File Visitor.
77
- #
78
- # This is the toplevel visitor.
79
- class ConfigurationFileVisitor < ListVisitor
79
+ # Statement Visitor
80
+ class StatementVisitor < ListVisitor
80
81
 
81
82
  def visit_BuildSystemDeclarationNode( node )
82
83
  raise ArgumentsError if node.values.length != 2
@@ -94,13 +95,55 @@ module BuildTool; module Cfg;
94
95
  node.accept( visitor )
95
96
  end
96
97
 
98
+ def visit_EnableFeatureNode( node )
99
+ featureName = node.value
100
+ feat = configuration.feature( featureName )
101
+ if feat.nil?
102
+ raise ConfigurationError, "Attempt to enable unknown feature '%s'!" % featureName
103
+ end
104
+ feat.active = true
105
+ end
106
+
107
+ def visit_EnableModuleNode( node )
108
+ modName = node.value
109
+ mod = configuration.module( modName )
110
+ if mod.nil?
111
+ raise ConfigurationError, "Attempt to enable unknown module '%s'!" % modName
112
+ end
113
+ mod.active = true
114
+ end
115
+
116
+ def visit_DisableFeatureNode( node )
117
+ featureName = node.value
118
+ feat = configuration.feature( featureName )
119
+ if feat.nil?
120
+ raise ConfigurationError, "Attempt to disable unknown feature '%s'!" % featureName
121
+ end
122
+ feat.active = false
123
+ end
124
+
125
+ def visit_DisableModuleNode( node )
126
+ modName = node.value
127
+ mod = configuration.module( modName )
128
+ if mod.nil?
129
+ raise ConfigurationError, "Attempt to disable unknown module '%s'!" % modName
130
+ end
131
+ mod.active = false
132
+ end
133
+
134
+ def visit_FeatureNode( node )
135
+ visitor = FeatureNodeVisitor.new( configuration )
136
+ node.accept( visitor )
137
+ end
138
+
97
139
  def visit_GitDeclarationNode( node )
98
140
  visitor = GitDeclarationNodeVisitor.new( configuration )
99
141
  return node.accept( visitor )
100
142
  end
101
143
 
102
- def visit_LogDirectoryNode( node )
103
- configuration.log_directory = node.value
144
+ def visit_IncludeNode( node )
145
+ visitor = IncludeNodeVisitor.new( configuration )
146
+ node.accept( visitor )
104
147
  end
105
148
 
106
149
  def visit_ModuleDeclarationNode( node )
@@ -123,6 +166,34 @@ module BuildTool; module Cfg;
123
166
  node.accept(visitor)
124
167
  end
125
168
 
169
+ end # class StatementVisitor
170
+
171
+
172
+ class ArchiveDeclarationNodeVisitor < ListVisitor
173
+
174
+ def initialize( configuration, vcs )
175
+ super( configuration )
176
+ @vcs = vcs
177
+ end
178
+
179
+ def visit_ArchiveDeclarationNode( node )
180
+ visit_nodes( node.values )
181
+ return @vcs
182
+ end
183
+
184
+ end # class ArchiveDeclarationNodeVisitor
185
+
186
+
187
+ # The Configuration File Visitor.
188
+ #
189
+ # This is the toplevel visitor.
190
+ class ConfigurationFileVisitor < StatementVisitor
191
+
192
+ def visit_LogDirectoryNode( node )
193
+ configuration.log_directory = node.value
194
+ end
195
+
196
+
126
197
  end # class ConfigurationFileVisitor
127
198
 
128
199
 
@@ -133,8 +204,16 @@ module BuildTool; module Cfg;
133
204
  @environment = configuration.environment( name )
134
205
  @environment = BuildTool::Environment.new( name ) if @environment.nil?
135
206
  configuration.add_environment( @environment )
207
+ if !configuration.active_feature.nil?
208
+ @environment.feature = configuration.active_feature
209
+ configuration.active_feature.environments << @environment
210
+ end
136
211
  if node.values[1] == :INHERITANCE
137
- @environment.parent = configuration.environment(node.values[2])
212
+ parentName = node.values[2]
213
+ @environment.parent = configuration.environment(parentName)
214
+ if @environment.parent.nil?
215
+ raise ConfigurationError, "Environment #{name} inherits from unknown environment #{parentName}!"
216
+ end
138
217
  self.visit_nodes( node.values[3] )
139
218
  else
140
219
  self.visit_nodes( node.values[1] )
@@ -154,6 +233,55 @@ module BuildTool; module Cfg;
154
233
  end # class EnvironmentDeclarationNodeVisitor
155
234
 
156
235
 
236
+ class FeatureNodeVisitor < ConfigurationFileVisitor
237
+
238
+ def initialize( configuration )
239
+ super( configuration )
240
+ @feature = nil
241
+ end
242
+
243
+ def visit_FeatureNode( node )
244
+ raise ArgumentsError if node.values.length != 2
245
+ childs = node.values
246
+ # Get the name if nested
247
+ name = childs.shift
248
+ if configuration.active_feature
249
+ @feature = configuration.feature( "#{configuration.active_feature.name}/#{name}" )
250
+ else
251
+ @feature = configuration.feature( name )
252
+ end
253
+ # Create a new feature if needed
254
+ if @feature.nil?
255
+ @feature = BuildTool::Feature.new( name, configuration.active_feature )
256
+ configuration.add_feature( @feature )
257
+ end
258
+ # Set it as the current feature
259
+ old_feat = configuration.active_feature
260
+ configuration.active_feature= @feature
261
+ # Visit the childs
262
+ visit_nodes( childs.shift )
263
+ # Reset the old current feature
264
+ configuration.active_feature = old_feat
265
+ end
266
+
267
+ def visit_LongDescriptionNode( node )
268
+ if @feature.long_description
269
+ puts @feature.description
270
+ logger.warn "Overwriting long description for feature #{@feature.name}"
271
+ end
272
+ @feature.long_description = node.values
273
+ end
274
+
275
+ def visit_ShortDescriptionNode( node )
276
+ if !@feature.description.nil?
277
+ logger.warn "Overwriting short description for feature #{@feature.name}"
278
+ end
279
+ @feature.description = node.values
280
+ end
281
+
282
+ end # class FeatureNodeVisitor
283
+
284
+
157
285
  class GitDeclarationNodeVisitor < ListVisitor
158
286
 
159
287
  def initialize( configuration, vcs = BuildTool::VCS::GitConfiguration.new )
@@ -232,6 +360,15 @@ module BuildTool; module Cfg;
232
360
  end # class GitRemoteNodeVisitor
233
361
 
234
362
 
363
+ class IncludeNodeVisitor < ListVisitor
364
+
365
+ def visit_IncludeNode( node )
366
+ name = node.value
367
+ configuration.recipe.include_file( name, configuration )
368
+ end
369
+ end
370
+
371
+
235
372
  class ModuleDeclarationNodeVisitor < ListVisitor
236
373
 
237
374
  def initialize( configuration )
@@ -239,6 +376,17 @@ module BuildTool; module Cfg;
239
376
  @module = nil
240
377
  end
241
378
 
379
+ def visit_ArchiveDeclarationNode( node )
380
+ if @module.vcs_configuration and @module.vcs_configuration.name == "archive"
381
+ vcs = @module.vcs_configuration.dup
382
+ else
383
+ vcs = BuildTool::VCS::ArchiveConfiguration.new
384
+ end
385
+ @module.vcs_configuration = vcs
386
+ visitor = ArchiveDeclarationNodeVisitor.new( configuration, vcs )
387
+ node.accept( visitor )
388
+ end
389
+
242
390
  def visit_BuildSystemDeclarationNode( node )
243
391
  raise ArgumentsError if node.values.length != 2
244
392
  name = node.values[0]
@@ -258,8 +406,7 @@ module BuildTool; module Cfg;
258
406
  end
259
407
 
260
408
  def visit_GitDeclarationNode( node )
261
- name = node.values[0]
262
- if @module.vcs_configuration and @module.vcs_configuration.name == name
409
+ if @module.vcs_configuration and @module.vcs_configuration.name == "git"
263
410
  vcs = @module.vcs_configuration.dup
264
411
  else
265
412
  vcs = BuildTool::VCS::GitConfiguration.new
@@ -274,8 +421,7 @@ module BuildTool; module Cfg;
274
421
  end
275
422
 
276
423
  def visit_GitSvnDeclarationNode( node )
277
- name = node.values[0]
278
- if @module.vcs_configuration and @module.vcs_configuration.name == name
424
+ if @module.vcs_configuration and @module.vcs_configuration.name == "gitsvn"
279
425
  vcs = @module.vcs_configuration.dup
280
426
  else
281
427
  vcs = BuildTool::VCS::GitSvnConfiguration.new
@@ -304,12 +450,23 @@ module BuildTool; module Cfg;
304
450
  raise ConfigurationError, "Attempt change existing module #{name} with inheritance!"
305
451
  end
306
452
  elsif inheritance
307
- @module = BuildTool::Module.new( name, configuration.module(node.values[2]) )
453
+ parentName = node.values[2]
454
+ parent = configuration.module( parentName )
455
+ if parent.nil?
456
+ raise ConfigurationError,
457
+ "Module %s attempts to inherit from not existant module %s" %
458
+ [ name, parentName ]
459
+ end
460
+ @module = BuildTool::Module.new( name, parent )
308
461
  configuration.add_module( @module )
309
462
  else
310
463
  @module = BuildTool::Module.new( name )
311
464
  configuration.add_module( @module )
312
465
  end
466
+ if !configuration.active_feature.nil?
467
+ @module.feature = configuration.active_feature
468
+ configuration.active_feature.modules << @module
469
+ end
313
470
  self.visit_nodes( stmts )
314
471
  end
315
472
 
@@ -378,21 +535,26 @@ module BuildTool; module Cfg;
378
535
  @repository.path = node.value
379
536
  end
380
537
 
381
- def visit_RepositoryServerNode( node )
382
- @repository.server = configuration.server( node.value )
383
- if @repository.server.nil?
384
- raise ConfigurationError, "Unknown server #{node.value} configured for repository #{@repository.name}!"
385
- end
386
- end
387
-
388
538
  def visit_RepositoryUserNode( node )
389
539
  @repository.user = node.value
390
540
  end
391
541
 
542
+ def visit_ServerDeclarationNode( node )
543
+ visitor = ServerDeclarationNodeVisitor.new( configuration )
544
+ @repository.server = node.accept(visitor)
545
+ end
546
+
392
547
  def visit_SshKeyDeclarationNode( node )
393
548
  @repository.sshkey = node.value
394
549
  end
395
550
 
551
+ def visit_UseServerNode( node )
552
+ @repository.server = configuration.server( node.value )
553
+ if @repository.server.nil?
554
+ raise ConfigurationError, "Unknown server #{node.value} configured for repository #{@repository.name}!"
555
+ end
556
+ end
557
+
396
558
  def visit_UseSshKeyNode( node )
397
559
  name = node.value
398
560
  @repository.sshkey = configuration.sshkey(name)