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,22 +1,31 @@
1
1
  module BuildTool; module BuildSystem
2
2
 
3
-
4
3
  #
5
4
  #
6
5
  #
7
- class Autoconf < Base
6
+ class AutoConf < Base
7
+
8
+ include MJ::Tools::SubProcess
9
+
10
+ class MakeError < BuildTool::Error; end
11
+ class AutoConfError < BuildTool::Error; end
8
12
 
9
- #
10
- ### ATTRIBUTES
11
- #
12
13
  def intitialize( *args )
13
14
  super( *args )
14
15
  end
15
16
 
17
+ #
18
+ ### ATTRIBUTES
19
+ #
16
20
  def name
17
21
  "autoconf"
18
22
  end
19
23
 
24
+ # Check if the module is configured
25
+ def configured?
26
+ Pathname.new( build_directory ).join( 'Makefile' ).exist?
27
+ end
28
+
20
29
  #
21
30
  ### METHODS
22
31
  #
@@ -24,7 +33,7 @@ module BuildTool; module BuildSystem
24
33
  def[]( var )
25
34
  case var
26
35
 
27
- when 'CMAKE_CXXFLAGS'
36
+ when 'CXXFLAGS'
28
37
  return @options[var]
29
38
 
30
39
  else
@@ -46,6 +55,11 @@ module BuildTool; module BuildSystem
46
55
 
47
56
  end
48
57
 
58
+ # Configure the module
59
+ def reconfigure()
60
+ configure
61
+ end
62
+
49
63
  def install( fast )
50
64
  make( "install" )
51
65
  end
@@ -54,6 +68,55 @@ module BuildTool; module BuildSystem
54
68
  false
55
69
  end
56
70
 
71
+ def bootstrap
72
+ if File.exist?( "#{source_directory}/configure" )
73
+ return
74
+ end
75
+
76
+ logger.trace "Project has to be bootstrapped."
77
+ if File.exist?( "#{source_directory}/Makefile.cvs" )
78
+ rc = self.class.execute "make -f Makefile.cvs", source_directory, env
79
+ if rc != 0
80
+ raise AutoConfError, "'make -f Makefile.cvs' failed with error #{rc}!"
81
+ end
82
+ rc
83
+ else
84
+ raise AutoConfError, "No idea how to bootstrap this project!"
85
+ end
86
+ end
87
+
88
+ def configure
89
+ check_build_directory( true )
90
+ bootstrap
91
+ opt = ""
92
+ opt += " --prefix=#{install_prefix.to_s}" if install_prefix
93
+ rc = self.class.execute "#{source_directory}/configure #{opt}", build_directory, env
94
+ if rc != 0
95
+ raise AutoConfError, "configure failed with error #{rc}!"
96
+ end
97
+ rc
98
+ end
99
+
100
+ def do_make( target = nil )
101
+ rc = self.class.execute( "make #{target ? target : "" }", build_directory, self.module.environment.values )
102
+ if rc != 0
103
+ raise MakeError, "make #{target || "" } failed with error code #{rc}";
104
+ end
105
+ rc
106
+ end
107
+
108
+ def install( fast )
109
+ make( "install" )
110
+ end
111
+
112
+ def install_fast_supported?
113
+ true
114
+ end
115
+
116
+ def make( target = nil )
117
+ do_make( target )
118
+ end
119
+
57
120
  end # class Autoconf
58
121
 
59
122
  end; end # module BuildTool::BuildSystem
@@ -90,7 +90,7 @@ module BuildTool; module BuildSystem
90
90
  if !File.symlink?( build_directory )
91
91
  logger.warn( "Could not link build directory to source directory for inplace build of #{@module.name}." )
92
92
  end
93
- else
93
+ elsif !$noop
94
94
  FileUtils.mkdir_p( Pathname.new( build_directory ).parent )
95
95
  File.symlink( source_directory, build_directory )
96
96
  end
@@ -102,7 +102,7 @@ module BuildTool; module BuildSystem
102
102
  raise ConfigurationError, "Build directory #{build_directory} exists and is no directory!"
103
103
  end
104
104
  elsif create
105
- FileUtils.mkdir_p( build_directory )
105
+ FileUtils.mkdir_p( build_directory ) if !$noop
106
106
  return true
107
107
  else
108
108
  return false
@@ -116,27 +116,4 @@ module BuildTool; module BuildSystem
116
116
 
117
117
  end # class Base
118
118
 
119
- require 'build-tool/build-system/cmake'
120
- require 'build-tool/build-system/custom'
121
- require 'build-tool/build-system/qt'
122
-
123
-
124
- def self.create( name )
125
- case name
126
-
127
- when 'cmake'
128
- return CMake.new
129
-
130
- when 'qt'
131
- return Qt.new
132
-
133
- when 'custom'
134
- return Custom.new
135
-
136
- else
137
- raise ConfigurationError, "Buildsystem #{name} is not supported!"
138
- end
139
- end
140
-
141
-
142
119
  end; end # module BuildTool::BuildSystem
@@ -39,27 +39,11 @@ module BuildTool; module BuildSystem
39
39
  if @options.has_key? var
40
40
  return @options[var]
41
41
  end
42
-
43
- # case var
44
-
45
- # else
46
- # *TODO* raise correct exception
47
- raise NotImplementedError
48
-
49
- # end
42
+ raise NotImplementedError
50
43
  end
51
44
 
52
45
  def[]=( var, val )
53
- # case var
54
-
55
- # else
56
- # if var.start_with?( 'WITH_' )
57
- # @options[var] = val
58
- # else
59
- # *TODO* raise correct exception
60
- raise NotImplementedError
61
- # end
62
- # end
46
+ @options[var] = val
63
47
  end
64
48
 
65
49
  # Configure the module
@@ -82,7 +66,10 @@ module BuildTool; module BuildSystem
82
66
  end
83
67
  return self.module.environment.execute(
84
68
  "%s %s" % [ path.to_s, source_directory ],
85
- build_directory )
69
+ build_directory,
70
+ {
71
+ 'INSTALL_PREFIX' => install_prefix.to_s,
72
+ }.merge(Hash[@options]))
86
73
  end
87
74
 
88
75
  def install( fast )
@@ -0,0 +1,39 @@
1
+ require 'mj/tools/subprocess'
2
+ require 'build-tool/build-system/base'
3
+
4
+ module BuildTool; module BuildSystem
5
+
6
+
7
+ class KdeL10nError < BuildTool::BuildSystem::CMake::CMakeError; end
8
+ #
9
+ # Custom Build system.
10
+ #
11
+ # Uses scripts do to the actual work.
12
+ #
13
+ class KdeL10n < CMake
14
+
15
+ def name
16
+ "kdel10n"
17
+ end
18
+
19
+ def initialize( *args )
20
+ super( *args )
21
+ end
22
+
23
+ def configure
24
+ if ! File.directory? "#{source_directory}/../scripts"
25
+ raise KdeL10nError, "You have to enable/checkout l10n too."
26
+ end
27
+
28
+ dirname = File.basename source_directory
29
+ rc = self.class.execute( "./scripts/autogen.sh #{dirname}", source_directory + "/..", self.module.environment.values )
30
+ if rc != 0
31
+ raise KdeL10nError, "Call to autogen.sh failed!";
32
+ end
33
+ super
34
+ end
35
+
36
+ end # class KdeL10n
37
+
38
+ end; end # module BuildTool::BuildSystem
39
+
@@ -0,0 +1,82 @@
1
+ require 'mj/tools/subprocess'
2
+ require 'build-tool/build-system/base'
3
+
4
+ module BuildTool; module BuildSystem
5
+
6
+
7
+ #
8
+ #
9
+ #
10
+ class None < Base
11
+
12
+ include MJ::Tools::SubProcess
13
+
14
+ def initialize( *args )
15
+ super( *args )
16
+ end
17
+
18
+ #
19
+ ### ATTRIBUTES
20
+ #
21
+
22
+ # Check if the module is configured
23
+ def configured?
24
+ true
25
+ end
26
+
27
+ def name
28
+ "none"
29
+ end
30
+
31
+ #
32
+ ### METHODS
33
+ #
34
+
35
+ def[]( var )
36
+ if @options.has_key? var
37
+ return @options[var]
38
+ end
39
+
40
+ # case var
41
+
42
+ # else
43
+ # *TODO* raise correct exception
44
+ raise NotImplementedError
45
+
46
+ # end
47
+ end
48
+
49
+ def[]=( var, val )
50
+ @options[var] = val
51
+ end
52
+
53
+ # Configure the module
54
+ def reconfigure()
55
+ 0
56
+ end
57
+
58
+ # Execute a cmake command in the context of the build directory
59
+ def cmake( command, wd = build_directory )
60
+ 0
61
+ end
62
+
63
+ def configure
64
+ 0
65
+ end
66
+
67
+ def install( fast )
68
+ 0
69
+ end
70
+
71
+ def install_fast_supported?
72
+ true
73
+ end
74
+
75
+ def make( target = nil )
76
+ 0
77
+ end
78
+
79
+ end # class CMake
80
+
81
+
82
+ end; end # module BuildTool::BuildSystem
@@ -61,6 +61,30 @@ class Lexer < Racc::Parser
61
61
  when (text = @ss.scan(/log-directory\b/))
62
62
  action { [ :LOG_DIRECTORY, text ]; }
63
63
 
64
+ when (text = @ss.scan(/include\b/))
65
+ action { [ :INCLUDE, text ]; }
66
+
67
+ when (text = @ss.scan(/feature\b/))
68
+ action { [ :FEATURE, text ]; }
69
+
70
+ when (text = @ss.scan(/long\b/))
71
+ action { [ :LONG, text ]; }
72
+
73
+ when (text = @ss.scan(/short\b/))
74
+ action { [ :SHORT, text ]; }
75
+
76
+ when (text = @ss.scan(/description\b/))
77
+ action { [ :DESCRIPTION, text ]; }
78
+
79
+ when (text = @ss.scan(/end\b/))
80
+ action { [ :END, text ]; }
81
+
82
+ when (text = @ss.scan(/enable\b/))
83
+ action { @states.push @state; @state = :ENABLE; [:ENABLE, text]; }
84
+
85
+ when (text = @ss.scan(/disable\b/))
86
+ action { @states.push @state; @state = :DISABLE; [:DISABLE, text]; }
87
+
64
88
  when (text = @ss.scan(/vcs\b/))
65
89
  action { @states.push @state; @state = :VCS; [:VCS, text]; }
66
90
 
@@ -108,6 +132,37 @@ class Lexer < Racc::Parser
108
132
  raise ScanError, "can not match: '" + text + "'"
109
133
  end # if
110
134
 
135
+ when :ARCHIVE
136
+ case
137
+ when (text = @ss.scan(/end\b/))
138
+ action { @state = @states.pop; [ :END, text ]; }
139
+
140
+ when (text = @ss.scan(/"([^\"\r\n]*)"/))
141
+ action { [:STRING, @ss[1]]; }
142
+
143
+ when (text = @ss.scan(/[a-zA-Z][A-Za-z_0-9-]*/))
144
+ action { [:TOKEN, text]; }
145
+
146
+ when (text = @ss.scan(/\#[^\r\n]*/))
147
+ action { [:COMMENT, text]; }
148
+
149
+ when (text = @ss.scan(/[ \t]+/))
150
+ action { [:IGNORE, text]; }
151
+
152
+ when (text = @ss.scan(/[\r\n]/))
153
+ action { [:IGNORE, text]; }
154
+
155
+ when (text = @ss.scan(/"([^\"\r\n]*)$/))
156
+ action { [:GARBAGE, text]; }
157
+
158
+ when (text = @ss.scan(/./))
159
+ action { [:GARBAGE, text]; }
160
+
161
+ else
162
+ text = @ss.string[@ss.pos .. -1]
163
+ raise ScanError, "can not match: '" + text + "'"
164
+ end # if
165
+
111
166
  when :BUILD_SYSTEM
112
167
  case
113
168
  when (text = @ss.scan(/option/))
@@ -145,6 +200,74 @@ class Lexer < Racc::Parser
145
200
  raise ScanError, "can not match: '" + text + "'"
146
201
  end # if
147
202
 
203
+ when :DISABLE
204
+ case
205
+ when (text = @ss.scan(/feature\b/))
206
+ action { @state = @states.pop; [:FEATURE, text]; }
207
+
208
+ when (text = @ss.scan(/module\b/))
209
+ action { @state = @states.pop; [:MODULE, text]; }
210
+
211
+ when (text = @ss.scan(/"([^\"\r\n]*)"/))
212
+ action { [:STRING, @ss[1]]; }
213
+
214
+ when (text = @ss.scan(/[a-zA-Z][A-Za-z_0-9-]*/))
215
+ action { [:TOKEN, text]; }
216
+
217
+ when (text = @ss.scan(/\#[^\r\n]*/))
218
+ action { [:COMMENT, text]; }
219
+
220
+ when (text = @ss.scan(/[ \t]+/))
221
+ action { [:IGNORE, text]; }
222
+
223
+ when (text = @ss.scan(/[\r\n]/))
224
+ action { [:IGNORE, text]; }
225
+
226
+ when (text = @ss.scan(/"([^\"\r\n]*)$/))
227
+ action { [:GARBAGE, text]; }
228
+
229
+ when (text = @ss.scan(/./))
230
+ action { [:GARBAGE, text]; }
231
+
232
+ else
233
+ text = @ss.string[@ss.pos .. -1]
234
+ raise ScanError, "can not match: '" + text + "'"
235
+ end # if
236
+
237
+ when :ENABLE
238
+ case
239
+ when (text = @ss.scan(/feature\b/))
240
+ action { @state = @states.pop; [:FEATURE, text]; }
241
+
242
+ when (text = @ss.scan(/module\b/))
243
+ action { @state = @states.pop; [:MODULE, text]; }
244
+
245
+ when (text = @ss.scan(/"([^\"\r\n]*)"/))
246
+ action { [:STRING, @ss[1]]; }
247
+
248
+ when (text = @ss.scan(/[a-zA-Z][A-Za-z_0-9-]*/))
249
+ action { [:TOKEN, text]; }
250
+
251
+ when (text = @ss.scan(/\#[^\r\n]*/))
252
+ action { [:COMMENT, text]; }
253
+
254
+ when (text = @ss.scan(/[ \t]+/))
255
+ action { [:IGNORE, text]; }
256
+
257
+ when (text = @ss.scan(/[\r\n]/))
258
+ action { [:IGNORE, text]; }
259
+
260
+ when (text = @ss.scan(/"([^\"\r\n]*)$/))
261
+ action { [:GARBAGE, text]; }
262
+
263
+ when (text = @ss.scan(/./))
264
+ action { [:GARBAGE, text]; }
265
+
266
+ else
267
+ text = @ss.string[@ss.pos .. -1]
268
+ raise ScanError, "can not match: '" + text + "'"
269
+ end # if
270
+
148
271
  when :ENVIRONMENT
149
272
  case
150
273
  when (text = @ss.scan(/var\b/))
@@ -337,22 +460,22 @@ class Lexer < Racc::Parser
337
460
 
338
461
  when :REPOSITORY
339
462
  case
340
- when (text = @ss.scan(/server\b/))
341
- action { [:SERVER, text]; }
342
-
343
463
  when (text = @ss.scan(/path\b/))
344
- action { [:PATH, text]; }
464
+ action { [:PATH, text]; }
345
465
 
346
466
  when (text = @ss.scan(/user\b/))
347
- action { [:USER, text]; }
467
+ action { [:USER, text]; }
468
+
469
+ when (text = @ss.scan(/server\b/))
470
+ action { @states.push @state; @state = :SERVER; [:SERVER, text]; }
348
471
 
349
- when (text = @ss.scan(/ssh-key/))
472
+ when (text = @ss.scan(/ssh-key\b/))
350
473
  action { @states.push @state; @state = :SSH_KEY; [:SSH_KEY, text]; }
351
474
 
352
475
  when (text = @ss.scan(/use\b/))
353
476
  action { @states.push @state; @state = :USE; [:USE, text]; }
354
477
 
355
- when (text = @ss.scan(/end/))
478
+ when (text = @ss.scan(/end\b/))
356
479
  action { @state = @states.pop; [:END, text]; }
357
480
 
358
481
  when (text = @ss.scan(/"([^\"\r\n]*)"/))
@@ -512,6 +635,9 @@ class Lexer < Racc::Parser
512
635
  when (text = @ss.scan(/git\b/))
513
636
  action { @state = :GIT; [:GIT, text]; }
514
637
 
638
+ when (text = @ss.scan(/archive\b/))
639
+ action { @state = :ARCHIVE; [:ARCHIVE, text]; }
640
+
515
641
  when (text = @ss.scan(/"([^\"\r\n]*)"/))
516
642
  action { [:STRING, @ss[1]]; }
517
643