build-tool 0.5.3 → 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/History.txt
CHANGED
@@ -1,3 +1,30 @@
|
|
1
|
+
== 0.5.4 ==
|
2
|
+
|
3
|
+
- Features
|
4
|
+
- Support --resume-from for all module based commands (configure)
|
5
|
+
- Show a progressbar when checking for obstacles at the beginning. That can take quite some time.
|
6
|
+
- If a repository contains a file named .commit-template add it to the git configuration.
|
7
|
+
|
8
|
+
- Enhancements
|
9
|
+
- Check the recipe directory for validity before installing the recipe.
|
10
|
+
- Only consider a directory a valid recipe if it has a recipe file.
|
11
|
+
- Support --resume-from for all module based commands (configure)
|
12
|
+
- Support --resume-from for all module based commands (configure)
|
13
|
+
- Show core dumps too if make fails.
|
14
|
+
- If a exception happens when checking if modules are ready stop the command.
|
15
|
+
|
16
|
+
- Bugfixes
|
17
|
+
- If an svn repository had no repository an error occured while trying to build the error message.
|
18
|
+
- Fix reconfigure --from-scratch
|
19
|
+
- AutoConf: Fix options without values
|
20
|
+
- sqlite3-ruby was renamed to sqlite3 only.
|
21
|
+
- Add grit as dependency
|
22
|
+
- Bugfix: Use correct Error class
|
23
|
+
- Fix a exception of recipe info <recipe>.
|
24
|
+
- Do not claim to Fetch if we do Clone.
|
25
|
+
- Remove a wrong info() line
|
26
|
+
- Bugfix: history <modulename> -> Use same logic as build.
|
27
|
+
|
1
28
|
== 0.5.3
|
2
29
|
- Feature
|
3
30
|
- Errors during a make call are both printed to the logfile and stdout even without verbose
|
data/KNOWN_PROBLEMS
CHANGED
data/Manifest.txt
CHANGED
@@ -78,19 +78,3 @@ lib/mj/tools/ssh.rb
|
|
78
78
|
lib/mj/tools/subprocess.rb
|
79
79
|
lib/mj/vcs/git.rb
|
80
80
|
lib/mj/visitor.rb
|
81
|
-
tasks/rspec.rake
|
82
|
-
test/commands/test_build.rb
|
83
|
-
test/test_build_system.rb
|
84
|
-
test/test_cli.rb
|
85
|
-
test/test_command.rb
|
86
|
-
test/test_configuration_parser.rb
|
87
|
-
test/test_environment.rb
|
88
|
-
test/test_feature.rb
|
89
|
-
test/test_helper.rb
|
90
|
-
test/test_history.rb
|
91
|
-
test/test_module.rb
|
92
|
-
test/test_repository.rb
|
93
|
-
test/test_singleton.rb
|
94
|
-
test/test_ssh_key.rb
|
95
|
-
test/test_svn_parser.rb
|
96
|
-
test/test_vcs.rb
|
data/Rakefile
CHANGED
@@ -39,8 +39,9 @@ Hoe.spec( 'build-tool' ) do
|
|
39
39
|
self.extra_deps <<
|
40
40
|
['logging', ">= 1.4.3"] <<
|
41
41
|
['sequel', ">= 3.18.0"] <<
|
42
|
-
['sqlite3
|
43
|
-
['ansi', '>= 1.2.2' ]
|
42
|
+
['sqlite3', ">= 1.3.3" ] <<
|
43
|
+
['ansi', '>= 1.2.2' ] <<
|
44
|
+
['grit', ">= 2.4.1" ]
|
44
45
|
|
45
46
|
self.extra_dev_deps <<
|
46
47
|
['hoe-debugging', ">= 1.0.1"] <<
|
data/lib/build-tool.rb
CHANGED
@@ -107,10 +107,10 @@ def option_string
|
|
107
107
|
arr = []
|
108
108
|
option_names.each do |var|
|
109
109
|
val = self[var]
|
110
|
-
if val
|
110
|
+
if val and !val.empty?
|
111
111
|
arr << "--#{var}='#{val}'"
|
112
112
|
else
|
113
|
-
arr << "--#{var}
|
113
|
+
arr << "--#{var}"
|
114
114
|
end
|
115
115
|
end
|
116
116
|
arr.join(" ")
|
@@ -234,35 +234,7 @@ def remove_build_directory
|
|
234
234
|
|
235
235
|
end # class Base
|
236
236
|
|
237
|
-
class ProgressbarBase < Logging::
|
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
|
237
|
+
class ProgressbarBase < MJ::Logging::Progressbar
|
266
238
|
|
267
239
|
def write( event )
|
268
240
|
message = event.data
|
@@ -104,12 +104,11 @@ def execute()
|
|
104
104
|
class Clone < Base
|
105
105
|
|
106
106
|
def initialize( command, mod )
|
107
|
-
logger.info "Cleaning build directory"
|
108
107
|
super( command, 20, :fetch, mod )
|
109
108
|
end
|
110
109
|
|
111
110
|
def execute()
|
112
|
-
logger.info "
|
111
|
+
logger.info "Cloning"
|
113
112
|
@module.clone
|
114
113
|
end
|
115
114
|
|
@@ -155,8 +154,12 @@ def initialize( command, mod )
|
|
155
154
|
end
|
156
155
|
|
157
156
|
def execute()
|
158
|
-
|
159
|
-
|
157
|
+
if @module.build_system_required.out_of_source
|
158
|
+
logger.info "Removing build directory"
|
159
|
+
@module.remove_build_directory
|
160
|
+
else
|
161
|
+
logger.warn "in source build. Will not remove source directory!"
|
162
|
+
end
|
160
163
|
end
|
161
164
|
|
162
165
|
end
|
data/lib/build-tool/commands.rb
CHANGED
@@ -372,7 +372,9 @@ def complete_modules( name, include_templates = false )
|
|
372
372
|
res = []
|
373
373
|
found = false
|
374
374
|
should_be_unique = false
|
375
|
+
resume = ( @resume_from.nil? and @resume_after.nil? )
|
375
376
|
configuration.modules.each do |mod|
|
377
|
+
take_module = false
|
376
378
|
next if ( !include_templates and mod.is_template? )
|
377
379
|
# We match on the following conditions:
|
378
380
|
# 1. name = mod.name
|
@@ -382,20 +384,31 @@ def complete_modules( name, include_templates = false )
|
|
382
384
|
found = true
|
383
385
|
# Now check if it is active.
|
384
386
|
next if !( mod.active? || @all )
|
385
|
-
|
387
|
+
take_module = true
|
386
388
|
elsif mod.name == name
|
387
389
|
found = true
|
388
390
|
should_be_unique = true
|
389
391
|
# Now check if it is active.
|
390
392
|
next if !( mod.active? || @all )
|
391
|
-
|
393
|
+
take_module = true
|
392
394
|
elsif mod.name.end_with?( "/#{name}" )
|
393
395
|
found = true
|
394
396
|
should_be_unique = true
|
395
397
|
# Now check if it is active.
|
396
398
|
next if !( mod.active? || @all )
|
397
|
-
|
399
|
+
take_module = true
|
398
400
|
end
|
401
|
+
|
402
|
+
if not resume and @resume_from and mod.name == @resume_from.name
|
403
|
+
resume = true
|
404
|
+
end
|
405
|
+
|
406
|
+
res << mod if resume and take_module
|
407
|
+
|
408
|
+
if not resume and @resume_after and mod.name == @resume_after.name
|
409
|
+
resume = true
|
410
|
+
end
|
411
|
+
|
399
412
|
end
|
400
413
|
|
401
414
|
# Raise an error if the module was not found
|
@@ -405,7 +418,7 @@ def complete_modules( name, include_templates = false )
|
|
405
418
|
|
406
419
|
# Raise an error if the result should be unique but is not.
|
407
420
|
if should_be_unique and res.size > 1
|
408
|
-
raise UsageError, "#{name} is ambiguos. Please be more specific."
|
421
|
+
raise UsageError, "#{name} is ambiguos #{res}. Please be more specific."
|
409
422
|
end
|
410
423
|
|
411
424
|
# Give a warning if all modules where
|
@@ -487,12 +500,48 @@ def log_directory
|
|
487
500
|
|
488
501
|
end # class Standard
|
489
502
|
|
503
|
+
class ModuleProgressbar < MJ::Logging::Progressbar
|
504
|
+
|
505
|
+
def initialize( title, mod, &block )
|
506
|
+
super( title, mod.size ) do
|
507
|
+
mod.each_with_index do |mod, i|
|
508
|
+
if @pbar
|
509
|
+
@pbar.set( i )
|
510
|
+
@pbar.title= mod.name.split( '/' )[-1]
|
511
|
+
end
|
512
|
+
yield mod
|
513
|
+
end
|
514
|
+
@pbar.title= 'finished' if @pbar
|
515
|
+
end
|
516
|
+
end
|
517
|
+
|
518
|
+
|
519
|
+
def write( event )
|
520
|
+
message = event.data
|
521
|
+
return if message.empty?
|
522
|
+
|
523
|
+
# Remove the progressbar and print the message
|
524
|
+
case event.level
|
525
|
+
when ::Logging::level_num( :ERROR ), ::Logging::level_num( :WARN ), ::Logging::level_num( :INFO )
|
526
|
+
begin
|
527
|
+
@pbar.clear() if @pbar
|
528
|
+
@oldlogger.append(event)
|
529
|
+
rescue Exception => e
|
530
|
+
puts e
|
531
|
+
end
|
532
|
+
end
|
533
|
+
end
|
534
|
+
|
535
|
+
end # class ModuleProgress
|
536
|
+
|
490
537
|
class ModuleBasedCommand < Standard
|
491
538
|
|
492
539
|
def initialize( *args )
|
493
540
|
super( *args )
|
494
541
|
@failed_modules = []
|
495
542
|
@resume_from = nil
|
543
|
+
@resume_after = nil
|
544
|
+
@stop_on_error = false
|
496
545
|
end
|
497
546
|
|
498
547
|
def initialize_options
|
@@ -502,6 +551,18 @@ def initialize_options
|
|
502
551
|
rescue UsageError => e
|
503
552
|
raise UsageError, "--resume-from: #{e}"
|
504
553
|
end
|
554
|
+
raise UsageError, "Both --resume-from and --resume-after specified!" if @resume_after
|
555
|
+
}
|
556
|
+
options.on( "--resume-after [module]", "Skip all module before and including module." ) { |t|
|
557
|
+
begin
|
558
|
+
@resume_after = complete_module( t )
|
559
|
+
rescue UsageError => e
|
560
|
+
raise UsageError, "--resume-after: #{e}"
|
561
|
+
end
|
562
|
+
raise UsageError, "Both --resume-from and --resume-after specified!" if @resume_from
|
563
|
+
}
|
564
|
+
options.on( "--[no-]stop-on-error", "Break on the first error." ) { |t|
|
565
|
+
@stop_on_error = t
|
505
566
|
}
|
506
567
|
|
507
568
|
super
|
@@ -531,15 +592,10 @@ def do_execute( args )
|
|
531
592
|
end
|
532
593
|
|
533
594
|
# 2. Check if the modules are ready
|
595
|
+
logger.info( '#### Checking for obstacles' )
|
534
596
|
isready = true
|
535
|
-
|
536
|
-
|
537
|
-
isready &= is_module_ready?( mod )
|
538
|
-
rescue Exception => e
|
539
|
-
logger.error "#{mod.name}: #{e.message}"
|
540
|
-
logger.verbose e.backtrace.join("\n")
|
541
|
-
isready = false
|
542
|
-
end
|
597
|
+
ModuleProgressbar.new( 'Modules', modules ) do |mod|
|
598
|
+
isready &= is_module_ready?( mod )
|
543
599
|
end
|
544
600
|
|
545
601
|
if !isready
|
@@ -554,10 +610,6 @@ def do_execute( args )
|
|
554
610
|
rescue Interrupt => e
|
555
611
|
logger.info( "User Interrupt" )
|
556
612
|
return -1
|
557
|
-
rescue Exception => e
|
558
|
-
logger.error "#{mod.name}: #{e.message}"
|
559
|
-
logger.verbose e.backtrace.join("\n")
|
560
|
-
isready = false
|
561
613
|
end
|
562
614
|
end
|
563
615
|
|
@@ -576,15 +628,6 @@ def do_execute( args )
|
|
576
628
|
|
577
629
|
modules.each_with_index do |mod, index|
|
578
630
|
|
579
|
-
if not @resume_from.nil?
|
580
|
-
if mod.name == @resume_from.name
|
581
|
-
@resume_from = nil
|
582
|
-
else
|
583
|
-
logger.info "Skipping module #{mod.name} (#{index+1}/#{modules.size})"
|
584
|
-
next
|
585
|
-
end
|
586
|
-
end
|
587
|
-
|
588
631
|
begin
|
589
632
|
|
590
633
|
logger.info ""
|
@@ -597,11 +640,13 @@ def do_execute( args )
|
|
597
640
|
logger.verbose e.backtrace.join("\n")
|
598
641
|
@failed_modules << mod.name
|
599
642
|
rc = -1
|
643
|
+
break if @stop_on_error
|
600
644
|
rescue Exception => e
|
601
645
|
logger.error "#{e.class}:#{e.message}"
|
602
646
|
logger.verbose e.backtrace.join("\n")
|
603
647
|
@failed_modules << mod.name
|
604
648
|
rc = -1
|
649
|
+
break if @stop_on_error
|
605
650
|
ensure
|
606
651
|
logger.info "#### Module #{mod.name} finished"
|
607
652
|
end
|
@@ -63,7 +63,11 @@ def applicable?
|
|
63
63
|
|
64
64
|
def is_module_ready?( mod )
|
65
65
|
isready = true
|
66
|
-
@
|
66
|
+
if @from_scratch and not mod.build_system_required.out_of_source
|
67
|
+
logger.warn "#{mod.name}: is compiled in source. Skipping --from-scratch!"
|
68
|
+
end
|
69
|
+
@update && isready &= mod.ready_for_fetch
|
70
|
+
@update && isready &= mod.ready_for_rebase
|
67
71
|
if !@update and (@build or @install or @configure)
|
68
72
|
if !mod.checkedout?
|
69
73
|
logger.warn "#{mod.name}: is not checked out. Skipping (add -u for checkout)"
|
@@ -75,7 +79,8 @@ def is_module_ready?( mod )
|
|
75
79
|
|
76
80
|
def prepare_module( mod )
|
77
81
|
isready = true
|
78
|
-
@update && isready &= mod.
|
82
|
+
@update && isready &= mod.prepare_for_fetch
|
83
|
+
@update && isready &= mod.prepare_for_rebase
|
79
84
|
return isready
|
80
85
|
end # prepare_module
|
81
86
|
|
@@ -60,8 +60,12 @@ def is_module_ready?( mod )
|
|
60
60
|
|
61
61
|
def do_execute_module( mod )
|
62
62
|
if mod.checkedout?
|
63
|
-
|
64
|
-
|
63
|
+
|
64
|
+
# clean/from-scratch
|
65
|
+
if @from_scratch
|
66
|
+
remove_build_directory( mod )
|
67
|
+
elsif @clean
|
68
|
+
clean( mod )
|
65
69
|
end
|
66
70
|
|
67
71
|
if @rmcache and !@from_scratch
|
@@ -33,7 +33,7 @@ def initialize_options
|
|
33
33
|
|
34
34
|
def is_module_ready?( mod )
|
35
35
|
isready = true
|
36
|
-
isready &= mod.
|
36
|
+
isready &= mod.ready_for_fetch
|
37
37
|
if !mod.vcs.fetching_supported?
|
38
38
|
logger.warn "#{mod.name}: fetching not supported by #{mod.vcs.name} -> implicit rebase."
|
39
39
|
end
|
@@ -78,16 +78,16 @@ def show_command_history
|
|
78
78
|
end
|
79
79
|
|
80
80
|
def show_module_history( modname )
|
81
|
-
mod =
|
81
|
+
mod = complete_module( modname )
|
82
82
|
if mod.nil?
|
83
83
|
return usage( "Unknown module #{modname}" )
|
84
84
|
end
|
85
85
|
|
86
|
-
BuildTool::History::CommandLog.last_by_module(
|
86
|
+
BuildTool::History::CommandLog.last_by_module( mod.name, @lines || 3 ).reverse.each do |cmd|
|
87
87
|
show_command( cmd )
|
88
88
|
|
89
89
|
last_module=""
|
90
|
-
cmd.module_logs_dataset.filter( :module =>
|
90
|
+
cmd.module_logs_dataset.filter( :module => mod.name ).each do |e|
|
91
91
|
if e.module != last_module
|
92
92
|
say blue { "\t#{e.module}" }
|
93
93
|
last_module = e.module
|
@@ -32,20 +32,23 @@ def initialize_options
|
|
32
32
|
def is_module_ready?( mod )
|
33
33
|
isready = true
|
34
34
|
if !mod.checkedout?
|
35
|
-
logger.
|
36
|
-
|
37
|
-
|
38
|
-
|
35
|
+
logger.info "#{mod.name}: Skipping: Not checked out."
|
36
|
+
else
|
37
|
+
isready &= mod.ready_for_rebase
|
38
|
+
if !mod.vcs.fetching_supported?
|
39
|
+
logger.info "#{mod.name}: Skipping: Rebasing not support by #{vcs.name}"
|
40
|
+
end
|
39
41
|
end
|
40
42
|
return isready
|
41
43
|
end
|
42
44
|
|
43
45
|
|
44
46
|
def do_execute_module( mod )
|
45
|
-
if mod.checkedout?
|
47
|
+
if mod.checkedout? and mod.vcs.fetching_supported?
|
48
|
+
logger.info "Skipping: Rebasing not support by #{vcs.name}"
|
46
49
|
rebase( mod )
|
47
50
|
else
|
48
|
-
logger.info "Not checked out.
|
51
|
+
logger.info "Skipping: Not checked out."
|
49
52
|
end
|
50
53
|
end
|
51
54
|
|