build-tool 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/.gitignore +1 -1
- data/History.txt +17 -0
- data/KNOWN_PROBLEMS +5 -0
- data/Manifest.txt +2 -0
- data/Rakefile +8 -0
- data/lib/build-tool.rb +1 -1
- data/lib/build-tool/application.rb +2 -0
- data/lib/build-tool/build-system/autoconf.rb +3 -10
- data/lib/build-tool/build-system/base.rb +65 -0
- data/lib/build-tool/build-system/cmake.rb +23 -10
- data/lib/build-tool/build-system/make.rb +43 -0
- data/lib/build-tool/build-system/qmake.rb +2 -10
- data/lib/build-tool/build-system/qt.rb +3 -10
- data/lib/build-tool/command_actions.rb +16 -58
- data/lib/build-tool/commands.rb +44 -6
- data/lib/build-tool/commands/build.rb +18 -5
- data/lib/build-tool/commands/fetch.rb +7 -1
- data/lib/build-tool/module.rb +15 -8
- data/lib/build-tool/vcs/archive.rb +1 -7
- data/lib/build-tool/vcs/base.rb +15 -7
- data/lib/build-tool/vcs/git-svn.rb +2 -14
- data/lib/build-tool/vcs/git.rb +29 -13
- data/lib/build-tool/vcs/svn.rb +1 -10
- data/lib/mj/tools/ssh.rb +3 -1
- data/lib/mj/tools/subprocess.rb +2 -9
- data/test/test_helper.rb +2 -0
- metadata +133 -111
- metadata.gz.sig +2 -1
data.tar.gz.sig
CHANGED
Binary file
|
data/.gitignore
CHANGED
data/History.txt
CHANGED
@@ -1,3 +1,20 @@
|
|
1
|
+
== 0.5.3
|
2
|
+
- Feature
|
3
|
+
- Errors during a make call are both printed to the logfile and stdout even without verbose
|
4
|
+
mode. Currently lines with "error:" and "ld:" are considered as errors. Report more. If the
|
5
|
+
progressbar was active it is stopped.
|
6
|
+
- Git: Check for a dirty index if asked for rebase. No automatic stashing (Yet?). Build-tool
|
7
|
+
will bail out with an error message if you have uncommited changes. This step will be done
|
8
|
+
before asking for the ssh key.
|
9
|
+
- Enhancements
|
10
|
+
- Do not print the classname for BuildTool Error classes. Only the message.
|
11
|
+
- First fetch and rebase, then clean out the build-dir. If the fetch rebase fails you still have
|
12
|
+
your old build to sort out the problems.
|
13
|
+
- Improve the error message if --resume-from is given an invalid/ambiguous module name.
|
14
|
+
- Bugfix
|
15
|
+
- Fix ssh key handling. Now build-tool will stop if ssh-add fails.
|
16
|
+
- Fix the progressbar for build-system not giving progress information(like qmake)
|
17
|
+
|
1
18
|
== 0.5.2
|
2
19
|
- Bugfix
|
3
20
|
- Be less verbose about adding ssh-key to the agent. One time is enough.
|
data/KNOWN_PROBLEMS
ADDED
data/Manifest.txt
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
.gitattributes
|
2
2
|
.gitignore
|
3
3
|
History.txt
|
4
|
+
KNOWN_PROBLEMS
|
4
5
|
Manifest.txt
|
5
6
|
README.txt
|
6
7
|
Rakefile
|
@@ -16,6 +17,7 @@ lib/build-tool/build-system/base.rb
|
|
16
17
|
lib/build-tool/build-system/cmake.rb
|
17
18
|
lib/build-tool/build-system/custom.rb
|
18
19
|
lib/build-tool/build-system/kdel10n.rb
|
20
|
+
lib/build-tool/build-system/make.rb
|
19
21
|
lib/build-tool/build-system/none.rb
|
20
22
|
lib/build-tool/build-system/qmake.rb
|
21
23
|
lib/build-tool/build-system/qt.rb
|
data/Rakefile
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# -*- ruby -*-
|
2
2
|
require 'rubygems'
|
3
|
+
|
4
|
+
# http://rubyforge.org/tracker/index.php?func=detail&aid=28920&group_id=1513&atid=5921
|
5
|
+
begin
|
6
|
+
require 'psych'
|
7
|
+
rescue ::LoadError
|
8
|
+
end
|
9
|
+
|
3
10
|
require 'hoe'
|
4
11
|
require 'fileutils'
|
5
12
|
require './lib/build-tool'
|
@@ -9,6 +16,7 @@ Hoe.plugin :doofus
|
|
9
16
|
Hoe.plugin :debugging
|
10
17
|
Hoe.plugin :racc
|
11
18
|
|
19
|
+
|
12
20
|
# Generate all the Rake tasks
|
13
21
|
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
14
22
|
Hoe.spec( 'build-tool' ) do
|
data/lib/build-tool.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'build-tool/build-system/make'
|
2
|
+
|
1
3
|
module BuildTool; module BuildSystem
|
2
4
|
|
3
5
|
#
|
@@ -7,7 +9,6 @@ class AutoConf < Base
|
|
7
9
|
|
8
10
|
include MJ::Tools::SubProcess
|
9
11
|
|
10
|
-
class MakeError < BuildTool::Error; end
|
11
12
|
class AutoConfError < BuildTool::Error; end
|
12
13
|
|
13
14
|
def intitialize( *args )
|
@@ -90,14 +91,6 @@ def configure
|
|
90
91
|
rc
|
91
92
|
end
|
92
93
|
|
93
|
-
def do_make( target = nil )
|
94
|
-
rc = self.class.execute( "make #{target ? target : "" }", build_directory, self.module.environment.values )
|
95
|
-
if rc != 0
|
96
|
-
raise MakeError, "make #{target || "" } failed with error code #{rc}";
|
97
|
-
end
|
98
|
-
rc
|
99
|
-
end
|
100
|
-
|
101
94
|
def install( fast )
|
102
95
|
make( "install" )
|
103
96
|
end
|
@@ -107,7 +100,7 @@ def install_fast_supported?
|
|
107
100
|
end
|
108
101
|
|
109
102
|
def make( target = nil )
|
110
|
-
|
103
|
+
Make.make( "#{target ? target : "" }", build_directory, self.module.environment.values )
|
111
104
|
end
|
112
105
|
|
113
106
|
def option_string
|
@@ -167,6 +167,11 @@ def source_directory
|
|
167
167
|
def after_rebase
|
168
168
|
end
|
169
169
|
|
170
|
+
def progressbar( title, &block )
|
171
|
+
logger.info title
|
172
|
+
yield
|
173
|
+
end
|
174
|
+
|
170
175
|
#
|
171
176
|
### METHODS
|
172
177
|
#
|
@@ -229,4 +234,64 @@ def remove_build_directory
|
|
229
234
|
|
230
235
|
end # class Base
|
231
236
|
|
237
|
+
class ProgressbarBase < Logging::Appender
|
238
|
+
|
239
|
+
def initialize( title, &block )
|
240
|
+
super( 'Progressbar', :level => :DEBUG )
|
241
|
+
@pbar = nil
|
242
|
+
@oldlogger = nil
|
243
|
+
if Logging.appenders['stdout'].level >= ::Logging::level_num(:INFO)
|
244
|
+
# We only do the progressbar thing if there is no verbose output active.
|
245
|
+
begin
|
246
|
+
# Remove the old stdout logger.
|
247
|
+
@oldlogger = Logging.appenders[ 'stdout' ]
|
248
|
+
Logging.logger[ 'root' ].remove_appenders( 'stdout' )
|
249
|
+
Logging.logger[ 'root' ].add_appenders( self )
|
250
|
+
# Add the progressbar logger
|
251
|
+
@pbar = ANSI::Progressbar.new( title, 100 )
|
252
|
+
yield
|
253
|
+
ensure
|
254
|
+
@pbar.finish unless @pbar.nil?
|
255
|
+
# Reset the logger
|
256
|
+
Logging.logger[ 'root' ].remove_appenders( 'Progressbar' )
|
257
|
+
Logging.logger[ 'root' ].add_appenders( @oldlogger )
|
258
|
+
end
|
259
|
+
else
|
260
|
+
# If there is verbose output just print the text
|
261
|
+
logger.info( title )
|
262
|
+
yield
|
263
|
+
end
|
264
|
+
|
265
|
+
end
|
266
|
+
|
267
|
+
def write( event )
|
268
|
+
message = event.data
|
269
|
+
return if message.empty?
|
270
|
+
|
271
|
+
case event.level
|
272
|
+
when ::Logging::level_num( :ERROR ), ::Logging::level_num( :WARN )
|
273
|
+
begin
|
274
|
+
# if we get an error we finish the pbar and print out the error waiting for
|
275
|
+
# the end
|
276
|
+
@pbar.finish unless @pbar.nil?
|
277
|
+
@pbar = nil
|
278
|
+
@oldlogger.append( event )
|
279
|
+
rescue Exception => e
|
280
|
+
puts e
|
281
|
+
end
|
282
|
+
else
|
283
|
+
begin
|
284
|
+
grep_progress( message )
|
285
|
+
rescue Exception => e
|
286
|
+
puts e
|
287
|
+
puts e.backtrace
|
288
|
+
end
|
289
|
+
end
|
290
|
+
self
|
291
|
+
end
|
292
|
+
|
293
|
+
end # class Progressbar
|
294
|
+
|
295
|
+
|
296
|
+
|
232
297
|
end; end # module BuildTool::BuildSystem
|
@@ -1,8 +1,24 @@
|
|
1
1
|
require 'mj/tools/subprocess'
|
2
2
|
require 'build-tool/build-system/base'
|
3
|
+
require 'build-tool/build-system/make'
|
3
4
|
|
4
5
|
module BuildTool; module BuildSystem
|
5
6
|
|
7
|
+
class Progressbar < ProgressbarBase
|
8
|
+
|
9
|
+
def grep_progress( message )
|
10
|
+
|
11
|
+
match = /^\[ *(\d+)%\]/.match( message )
|
12
|
+
if match and not @pbar.nil?
|
13
|
+
# puts match[ 1 ]
|
14
|
+
@pbar.set( match[ 1 ].to_i )
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
end # class ProgressLayout
|
20
|
+
|
21
|
+
|
6
22
|
|
7
23
|
#
|
8
24
|
#
|
@@ -11,7 +27,6 @@ class CMake < Base
|
|
11
27
|
|
12
28
|
include MJ::Tools::SubProcess
|
13
29
|
|
14
|
-
class MakeError < BuildTool::Error; end
|
15
30
|
class CMakeError < BuildTool::Error; end
|
16
31
|
|
17
32
|
def initialize( *args )
|
@@ -65,14 +80,6 @@ def configure
|
|
65
80
|
rc
|
66
81
|
end
|
67
82
|
|
68
|
-
def do_make( target = nil )
|
69
|
-
rc = self.class.execute( "make #{target ? target : "" }", build_directory, self.module.environment.values )
|
70
|
-
if rc != 0
|
71
|
-
raise MakeError, "make #{target || "" } failed with error code #{rc}";
|
72
|
-
end
|
73
|
-
rc
|
74
|
-
end
|
75
|
-
|
76
83
|
def install( fast )
|
77
84
|
if fast
|
78
85
|
make( "install/fast" )
|
@@ -86,7 +93,7 @@ def install_fast_supported?
|
|
86
93
|
end
|
87
94
|
|
88
95
|
def make( target = nil )
|
89
|
-
|
96
|
+
Make.make( "#{target ? target : "" }", build_directory, self.module.environment.values )
|
90
97
|
end
|
91
98
|
|
92
99
|
def option_string
|
@@ -98,6 +105,12 @@ def option_string
|
|
98
105
|
arr.join(" ")
|
99
106
|
end
|
100
107
|
|
108
|
+
def progressbar( title, &block )
|
109
|
+
Progressbar.new( title ) do
|
110
|
+
yield
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
101
114
|
end # class CMake
|
102
115
|
|
103
116
|
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'mj/tools/subprocess'
|
2
|
+
|
3
|
+
|
4
|
+
module BuildTool; module BuildSystem
|
5
|
+
|
6
|
+
|
7
|
+
# The make buildsystem.
|
8
|
+
#
|
9
|
+
# Provides helper methods for other build-system currently.
|
10
|
+
class Make
|
11
|
+
|
12
|
+
include MJ::Tools::SubProcess
|
13
|
+
|
14
|
+
class MakeError < BuildTool::Error; end
|
15
|
+
|
16
|
+
# Class Methods
|
17
|
+
class << self
|
18
|
+
|
19
|
+
def make( target, build_directory, environment )
|
20
|
+
rc = self.execute( "make #{target ? target : "" }", build_directory, environment ) do |line|
|
21
|
+
line.chomp
|
22
|
+
if line.index( /[^\w]error:/ )
|
23
|
+
logger.error( line )
|
24
|
+
elsif line.index( /\/ld:/ )
|
25
|
+
logger.error( line )
|
26
|
+
else
|
27
|
+
logger.verbose( line )
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
if rc != 0
|
32
|
+
raise MakeError, "make #{ target || "" } failed with error code #{rc}";
|
33
|
+
end
|
34
|
+
rc
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
end; end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'mj/tools/subprocess'
|
2
2
|
require 'build-tool/build-system/base'
|
3
|
+
require 'build-tool/build-system/make'
|
3
4
|
|
4
5
|
module BuildTool; module BuildSystem
|
5
6
|
|
@@ -10,7 +11,6 @@ class QMake < Base
|
|
10
11
|
|
11
12
|
include MJ::Tools::SubProcess
|
12
13
|
|
13
|
-
class MakeError < BuildTool::Error; end
|
14
14
|
class QMakeError < BuildTool::Error; end
|
15
15
|
|
16
16
|
def initialize( *args )
|
@@ -56,14 +56,6 @@ def configure
|
|
56
56
|
rc
|
57
57
|
end
|
58
58
|
|
59
|
-
def do_make( target = nil )
|
60
|
-
rc = self.class.execute( "make #{target ? target : "" }", build_directory, self.module.environment.values )
|
61
|
-
if rc != 0
|
62
|
-
raise MakeError, "make #{target || "" } failed with error code #{rc}";
|
63
|
-
end
|
64
|
-
rc
|
65
|
-
end
|
66
|
-
|
67
59
|
def install( fast )
|
68
60
|
make( "install" )
|
69
61
|
end
|
@@ -73,7 +65,7 @@ def install_fast_supported?
|
|
73
65
|
end
|
74
66
|
|
75
67
|
def make( target = nil )
|
76
|
-
|
68
|
+
Make.make( "#{target ? target : "" }", build_directory, self.module.environment.values )
|
77
69
|
end
|
78
70
|
|
79
71
|
def option_string
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'build-tool/build-system/make'
|
2
|
+
|
1
3
|
module BuildTool; module BuildSystem
|
2
4
|
|
3
5
|
|
@@ -8,7 +10,6 @@ class Qt < Base
|
|
8
10
|
|
9
11
|
include MJ::Tools::SubProcess
|
10
12
|
|
11
|
-
class MakeError < BuildTool::Error; end
|
12
13
|
class QMakeError < BuildTool::Error; end
|
13
14
|
|
14
15
|
def intitialize( *args )
|
@@ -57,14 +58,6 @@ def configure
|
|
57
58
|
rc
|
58
59
|
end
|
59
60
|
|
60
|
-
def do_make( target = nil )
|
61
|
-
rc = self.class.execute( "make #{target ? target : "" }", build_directory, self.module.environment.values )
|
62
|
-
if rc != 0
|
63
|
-
raise MakeError, "make #{target || "" } failed with error code #{rc}";
|
64
|
-
end
|
65
|
-
rc
|
66
|
-
end
|
67
|
-
|
68
61
|
def install( fast )
|
69
62
|
make( "install" )
|
70
63
|
end
|
@@ -74,7 +67,7 @@ def install_fast_supported?
|
|
74
67
|
end
|
75
68
|
|
76
69
|
def make( target = nil )
|
77
|
-
|
70
|
+
Make.make( "#{target ? target : "" }", build_directory, self.module.environment.values )
|
78
71
|
end
|
79
72
|
|
80
73
|
# Configure the module
|
@@ -4,60 +4,6 @@
|
|
4
4
|
|
5
5
|
module BuildTool
|
6
6
|
|
7
|
-
class Progressbar < Logging::Appender
|
8
|
-
|
9
|
-
def initialize( title, &block )
|
10
|
-
super( 'Progressbar', :level => :DEBUG )
|
11
|
-
@pbar = nil
|
12
|
-
@oldlogger = nil
|
13
|
-
if Logging.appenders['stdout'].level >= ::Logging::level_num(:INFO)
|
14
|
-
# We only do the progressbar thing if there is no verbose output active.
|
15
|
-
begin
|
16
|
-
# Remove the old stdout logger.
|
17
|
-
@oldlogger = Logging.appenders[ 'stdout' ]
|
18
|
-
Logging.logger[ 'root' ].remove_appenders( 'stdout' )
|
19
|
-
Logging.logger[ 'root' ].add_appenders( self )
|
20
|
-
# Add the progressbar logger
|
21
|
-
@pbar = ANSI::Progressbar.new( title, 100 )
|
22
|
-
yield
|
23
|
-
ensure
|
24
|
-
@pbar.finish
|
25
|
-
# Reset the logger
|
26
|
-
Logging.logger[ 'root' ].remove_appenders( 'Progressbar' )
|
27
|
-
Logging.logger[ 'root' ].add_appenders( @oldlogger )
|
28
|
-
end
|
29
|
-
else
|
30
|
-
# If there is verbose output just print the text
|
31
|
-
logger.info( title )
|
32
|
-
yield
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
36
|
-
|
37
|
-
def write( event )
|
38
|
-
message = event.data
|
39
|
-
return if message.empty?
|
40
|
-
|
41
|
-
case event.level
|
42
|
-
when ::Logging::level_num( :ERROR )
|
43
|
-
when ::Logging::level_num( :WARN )
|
44
|
-
# This should never happen. In case of errors an exception is thrown which should
|
45
|
-
# be catched in the initialize() method above. And this logger is removed there.
|
46
|
-
raise NotImplementedError
|
47
|
-
|
48
|
-
else
|
49
|
-
match = /^\[ *(\d+)%\]/.match( message )
|
50
|
-
if match
|
51
|
-
# puts match[ 1 ]
|
52
|
-
@pbar.set( match[ 1 ].to_i )
|
53
|
-
end
|
54
|
-
end
|
55
|
-
self
|
56
|
-
end
|
57
|
-
|
58
|
-
end # class ProgressLayout
|
59
|
-
|
60
|
-
|
61
7
|
|
62
8
|
module ModuleActions
|
63
9
|
|
@@ -124,11 +70,9 @@ def while_logging( level = :trace, &block )
|
|
124
70
|
yield
|
125
71
|
rescue Interrupt => e
|
126
72
|
state = History::ModuleLog::CANCELED_BY_USER
|
127
|
-
logger.error "User Interrupt!"
|
128
73
|
raise e
|
129
74
|
rescue Exception => e
|
130
75
|
state = History::ModuleLog::FINISHED_WITH_ERRORS
|
131
|
-
logger.error "#{e.class}:#{e.message}"
|
132
76
|
got_exception = true
|
133
77
|
raise e
|
134
78
|
ensure
|
@@ -160,6 +104,7 @@ def execute()
|
|
160
104
|
class Clone < Base
|
161
105
|
|
162
106
|
def initialize( command, mod )
|
107
|
+
logger.info "Cleaning build directory"
|
163
108
|
super( command, 20, :fetch, mod )
|
164
109
|
end
|
165
110
|
|
@@ -203,6 +148,19 @@ def execute()
|
|
203
148
|
|
204
149
|
end
|
205
150
|
|
151
|
+
class RemoveBuildDirectory < Base
|
152
|
+
|
153
|
+
def initialize( command, mod )
|
154
|
+
super( command, 10, :clean, mod )
|
155
|
+
end
|
156
|
+
|
157
|
+
def execute()
|
158
|
+
logger.info "Removing build directory"
|
159
|
+
@module.remove_build_directory
|
160
|
+
end
|
161
|
+
|
162
|
+
end
|
163
|
+
|
206
164
|
class Configure < Base
|
207
165
|
|
208
166
|
def initialize( command, mod )
|
@@ -243,7 +201,7 @@ def initialize( command, mod, target = nil )
|
|
243
201
|
end
|
244
202
|
|
245
203
|
def execute()
|
246
|
-
|
204
|
+
@module.build_system_required.progressbar( "Make #{@target}" ) do
|
247
205
|
@module.build_system_required.make( @target )
|
248
206
|
end
|
249
207
|
end
|
@@ -258,7 +216,7 @@ def initialize( command, mod, fast = false )
|
|
258
216
|
end
|
259
217
|
|
260
218
|
def execute()
|
261
|
-
|
219
|
+
@module.build_system_required.progressbar( "Install #{@fast ? 'fast' : ''}" ) do
|
262
220
|
@module.build_system_required.install( @fast )
|
263
221
|
end
|
264
222
|
end
|