autobuild 1.7.4.rc2 → 1.7.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +1 -0
- data/lib/autobuild/build_logfile.rb +58 -0
- data/lib/autobuild/import/git.rb +2 -2
- data/lib/autobuild/import/svn.rb +18 -3
- data/lib/autobuild/packages/cmake.rb +25 -20
- data/lib/autobuild/parallel.rb +42 -24
- data/lib/autobuild/version.rb +1 -1
- metadata +93 -103
data/Manifest.txt
CHANGED
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'time'
|
2
|
+
|
3
|
+
module Autobuild
|
4
|
+
# Parse and manipulate the information stored in a build log file (usually
|
5
|
+
# in prefix/log/stats.log)
|
6
|
+
class BuildLogfile
|
7
|
+
Entry = Struct.new :package, :phase, :start_time, :duration
|
8
|
+
|
9
|
+
attr_reader :by_package
|
10
|
+
attr_reader :by_phase
|
11
|
+
|
12
|
+
def initialize(entries = Array.new)
|
13
|
+
@entries = entries.dup
|
14
|
+
@by_package = Hash.new
|
15
|
+
entries.each do |e|
|
16
|
+
package = (by_package[e.package] ||= Hash.new(0))
|
17
|
+
package[e.phase] += e.duration
|
18
|
+
end
|
19
|
+
|
20
|
+
@by_phase = Hash.new
|
21
|
+
entries.each do |e|
|
22
|
+
package = (by_phase[e.phase] ||= Hash.new(0))
|
23
|
+
package[e.package] += e.duration
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def diff(other)
|
28
|
+
result = []
|
29
|
+
by_package.each do |pkg_name, phases|
|
30
|
+
other_phases = other.by_package[pkg_name]
|
31
|
+
next if !other_phases
|
32
|
+
phases.each do |phase, duration|
|
33
|
+
next if !other_phases.has_key?(phase)
|
34
|
+
other_duration = other_phases[phase]
|
35
|
+
result << Entry.new(pkg_name, phase, nil, other_duration - duration)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
BuildLogfile.new(result)
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.parse(file)
|
42
|
+
entries = File.readlines(file).map do |line|
|
43
|
+
line = line.strip
|
44
|
+
next if line.empty?
|
45
|
+
|
46
|
+
cols = line.split(/\s+/)
|
47
|
+
date, time = cols.shift, cols.shift
|
48
|
+
start_time = Time.parse("#{date} #{time}")
|
49
|
+
duration = Float(cols.pop)
|
50
|
+
phase = cols.pop
|
51
|
+
package = cols.join(" ")
|
52
|
+
Entry.new(package, phase, start_time, duration)
|
53
|
+
end
|
54
|
+
new(entries)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
data/lib/autobuild/import/git.rb
CHANGED
@@ -9,7 +9,7 @@ module Autobuild
|
|
9
9
|
# and branch. +source+ is [repository, branch]
|
10
10
|
#
|
11
11
|
# This importer uses the 'git' tool to perform the
|
12
|
-
# import. It defaults to '
|
12
|
+
# import. It defaults to 'git' and can be configured by
|
13
13
|
# doing
|
14
14
|
# Autobuild.programs['git'] = 'my_git_tool'
|
15
15
|
def initialize(repository, branch = nil, options = {})
|
@@ -469,7 +469,7 @@ module Autobuild
|
|
469
469
|
end
|
470
470
|
|
471
471
|
# Creates a git importer which gets the source for the given repository and branch
|
472
|
-
# URL +source+.
|
472
|
+
# URL +source+.
|
473
473
|
def self.git(repository, branch = nil, options = {})
|
474
474
|
Git.new(repository, branch, options)
|
475
475
|
end
|
data/lib/autobuild/import/svn.rb
CHANGED
@@ -36,9 +36,24 @@ module Autobuild
|
|
36
36
|
private
|
37
37
|
|
38
38
|
def update(package) # :nodoc:
|
39
|
-
Dir.chdir(package.importdir)
|
39
|
+
Dir.chdir(package.importdir) do
|
40
40
|
old_lang, ENV['LC_ALL'] = ENV['LC_ALL'], 'C'
|
41
|
-
|
41
|
+
svninfo = []
|
42
|
+
begin
|
43
|
+
Subprocess.run(package, :import, @program, 'info') do |line|
|
44
|
+
svninfo << line
|
45
|
+
end
|
46
|
+
rescue SubcommandFailed => e
|
47
|
+
if svninfo.find { |l| l =~ /svn upgrade/ }
|
48
|
+
# Try svn upgrade and info again
|
49
|
+
Subprocess.run(package, :import, @program, 'upgrade')
|
50
|
+
svninfo.clear
|
51
|
+
Subprocess.run(package, :import, @program, 'info') do |line|
|
52
|
+
svninfo << line
|
53
|
+
end
|
54
|
+
else raise
|
55
|
+
end
|
56
|
+
end
|
42
57
|
ENV['LC_ALL'] = old_lang
|
43
58
|
unless url = svninfo.grep(/^URL: /).first
|
44
59
|
if svninfo.grep(/is not a working copy/).empty?
|
@@ -53,7 +68,7 @@ module Autobuild
|
|
53
68
|
raise ConfigException.new(package, 'import'), "current checkout found at #{package.importdir} is from #{source}, was expecting #{@source}"
|
54
69
|
end
|
55
70
|
Subprocess.run(package, :import, @program, 'up', "--non-interactive", *@options_up)
|
56
|
-
|
71
|
+
end
|
57
72
|
end
|
58
73
|
|
59
74
|
def checkout(package) # :nodoc:
|
@@ -348,35 +348,40 @@ module Autobuild
|
|
348
348
|
# Do the build in builddir
|
349
349
|
def build
|
350
350
|
in_dir(builddir) do
|
351
|
-
progress_start "building %s"
|
351
|
+
progress_start "building %s" do
|
352
352
|
if always_reconfigure || !File.file?('Makefile')
|
353
353
|
Subprocess.run(self, 'build', Autobuild.tool(:cmake), '.')
|
354
354
|
end
|
355
355
|
|
356
|
+
current_message = String.new
|
357
|
+
warning_count = 0
|
356
358
|
Autobuild.make_subcommand(self, 'build') do |line|
|
357
|
-
|
359
|
+
needs_display = false
|
360
|
+
if line =~ /\[\s*(\d+)%\]/
|
358
361
|
progress "building %s (#{Integer($1)}%)"
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
if show_make_messages?
|
363
|
-
warning = String.new
|
364
|
-
Autobuild.make_subcommand(self, 'build') do |line|
|
365
|
-
iswarning = false
|
366
|
-
if line =~ /\[\s*(\d+)%\]/
|
367
|
-
progress "building %s (#{Integer($1)}%)"
|
368
|
-
elsif (line =~
|
369
|
-
/^(Linking)|^(Scanning)|^(Building)|^(Built)/) == nil
|
370
|
-
warning += line
|
371
|
-
iswarning = true
|
362
|
+
elsif line !~ /^(?:Linking|Scanning|Building|Built)/
|
363
|
+
if line =~ /warning/
|
364
|
+
warning_count += 1
|
372
365
|
end
|
373
|
-
if
|
374
|
-
|
375
|
-
|
376
|
-
end
|
377
|
-
warning = ""
|
366
|
+
if show_make_messages?
|
367
|
+
current_message += line
|
368
|
+
needs_display = true
|
378
369
|
end
|
379
370
|
end
|
371
|
+
if !needs_display && !current_message.empty?
|
372
|
+
current_message.split("\n").each do |l|
|
373
|
+
message "%s: #{l}", :magenta
|
374
|
+
end
|
375
|
+
current_message.clear
|
376
|
+
end
|
377
|
+
end
|
378
|
+
current_message.split("\n").each do |l|
|
379
|
+
message "%s: #{l}", :magenta
|
380
|
+
end
|
381
|
+
if warning_count > 0
|
382
|
+
progress_done "built %s (#{warning_count} warnings)"
|
383
|
+
else
|
384
|
+
progress_done "built %s"
|
380
385
|
end
|
381
386
|
end
|
382
387
|
end
|
data/lib/autobuild/parallel.rb
CHANGED
@@ -42,10 +42,17 @@ module Autobuild
|
|
42
42
|
available_workers << w
|
43
43
|
if error
|
44
44
|
if available_workers.size != workers.size
|
45
|
-
|
45
|
+
if finished_task.respond_to?(:package) && finished_task.package
|
46
|
+
Autobuild.error "got an error processing #{finished_task.package.name}, waiting for pending jobs to end"
|
47
|
+
else
|
48
|
+
Autobuild.error "got an error doing parallel processing, waiting for pending jobs to end"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
begin
|
52
|
+
finish_pending_work
|
53
|
+
ensure
|
54
|
+
raise error
|
46
55
|
end
|
47
|
-
finish_pending_work
|
48
|
-
raise error
|
49
56
|
end
|
50
57
|
|
51
58
|
state.process_finished_task(finished_task)
|
@@ -67,29 +74,25 @@ module Autobuild
|
|
67
74
|
attr_reader :started_packages
|
68
75
|
attr_reader :active_packages
|
69
76
|
attr_reader :queue
|
77
|
+
attr_reader :priorities
|
70
78
|
|
71
79
|
def initialize(reverse_dependencies, initial_queue = Array.new)
|
72
80
|
@reverse_dependencies = reverse_dependencies
|
73
81
|
@processed = Set.new
|
74
82
|
@active_packages = Set.new
|
75
|
-
@
|
76
|
-
@
|
83
|
+
@priorities = Hash.new
|
84
|
+
@started_packages = Hash.new
|
85
|
+
@queue = Hash.new
|
86
|
+
initial_queue.each do |t|
|
87
|
+
queue[t] = 1
|
88
|
+
end
|
77
89
|
end
|
78
90
|
|
79
91
|
def find_task
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
if !active_packages.include?(task.package)
|
84
|
-
if started_packages.include?(task.package)
|
85
|
-
return task
|
86
|
-
end
|
87
|
-
possible_task ||= task
|
88
|
-
end
|
89
|
-
else possible_task ||= task
|
90
|
-
end
|
92
|
+
if task = queue.sort_by { |t, p| p }.first
|
93
|
+
priorities[task.first] = task.last
|
94
|
+
task.first
|
91
95
|
end
|
92
|
-
possible_task
|
93
96
|
end
|
94
97
|
|
95
98
|
def pop
|
@@ -99,9 +102,9 @@ module Autobuild
|
|
99
102
|
end
|
100
103
|
|
101
104
|
def mark_as_active(pending_task)
|
102
|
-
if pending_task.respond_to?(:package)
|
105
|
+
if pending_task.respond_to?(:package) && !pending_task.kind_of?(Autobuild::SourceTreeTask)
|
103
106
|
active_packages << pending_task.package
|
104
|
-
started_packages
|
107
|
+
started_packages[pending_task.package] ||= -started_packages.size
|
105
108
|
end
|
106
109
|
end
|
107
110
|
|
@@ -111,11 +114,18 @@ module Autobuild
|
|
111
114
|
end
|
112
115
|
processed << task
|
113
116
|
reverse_dependencies[task].each do |candidate|
|
114
|
-
if candidate.prerequisite_tasks.all? { |t| processed.include?(t) }
|
115
|
-
|
117
|
+
if !processed.include?(candidate) && candidate.prerequisite_tasks.all? { |t| processed.include?(t) }
|
118
|
+
if candidate.respond_to?(:package)
|
119
|
+
queue[candidate] = started_packages[candidate.package] || priorities[task]
|
120
|
+
else queue[candidate] = priorities[task]
|
121
|
+
end
|
116
122
|
end
|
117
123
|
end
|
118
124
|
end
|
125
|
+
|
126
|
+
def trivial_task?(task)
|
127
|
+
(task.kind_of?(Autobuild::SourceTreeTask) || task.kind_of?(Rake::FileTask)) && task.actions.empty?
|
128
|
+
end
|
119
129
|
end
|
120
130
|
|
121
131
|
# Invokes the provided tasks. Unlike the rake code, this is a toplevel
|
@@ -155,7 +165,11 @@ module Autobuild
|
|
155
165
|
end
|
156
166
|
end
|
157
167
|
|
158
|
-
if
|
168
|
+
if state.trivial_task?(pending_task)
|
169
|
+
Worker.execute_task(pending_task)
|
170
|
+
state.process_finished_task(pending_task)
|
171
|
+
next
|
172
|
+
elsif pending_task.instance_variable_get(:@already_invoked) || !pending_task.needed?
|
159
173
|
state.process_finished_task(pending_task)
|
160
174
|
next
|
161
175
|
end
|
@@ -201,11 +215,15 @@ module Autobuild
|
|
201
215
|
end
|
202
216
|
end
|
203
217
|
|
204
|
-
def
|
205
|
-
@last_error = nil
|
218
|
+
def self.execute_task(task)
|
206
219
|
task_args = Rake::TaskArguments.new(task.arg_names, [])
|
207
220
|
task.instance_variable_set(:@already_invoked, true)
|
208
221
|
task.send(:execute, task_args)
|
222
|
+
end
|
223
|
+
|
224
|
+
def do_task(task)
|
225
|
+
@last_error = nil
|
226
|
+
Worker.execute_task(task)
|
209
227
|
@last_finished_task = task
|
210
228
|
rescue ::Exception => e
|
211
229
|
@last_finished_task = task
|
data/lib/autobuild/version.rb
CHANGED
metadata
CHANGED
@@ -1,111 +1,109 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: autobuild
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 7
|
9
|
-
- 4
|
10
|
-
- rc
|
11
|
-
- 2
|
12
|
-
version: 1.7.4.rc2
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.7.4
|
5
|
+
prerelease:
|
13
6
|
platform: ruby
|
14
|
-
authors:
|
7
|
+
authors:
|
15
8
|
- Sylvain Joyeux
|
16
9
|
autorequire:
|
17
10
|
bindir: bin
|
18
11
|
cert_chain: []
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2013-09-18 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
23
15
|
name: rake
|
24
|
-
|
25
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
26
17
|
none: false
|
27
|
-
requirements:
|
28
|
-
- -
|
29
|
-
- !ruby/object:Gem::Version
|
30
|
-
hash: 59
|
31
|
-
segments:
|
32
|
-
- 0
|
33
|
-
- 9
|
34
|
-
- 0
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
35
21
|
version: 0.9.0
|
36
22
|
type: :runtime
|
37
|
-
version_requirements: *id001
|
38
|
-
- !ruby/object:Gem::Dependency
|
39
|
-
name: utilrb
|
40
23
|
prerelease: false
|
41
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.9.0
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: utilrb
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
42
33
|
none: false
|
43
|
-
requirements:
|
44
|
-
- -
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
hash: 15
|
47
|
-
segments:
|
48
|
-
- 1
|
49
|
-
- 6
|
50
|
-
- 0
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
51
37
|
version: 1.6.0
|
52
38
|
type: :runtime
|
53
|
-
version_requirements: *id002
|
54
|
-
- !ruby/object:Gem::Dependency
|
55
|
-
name: highline
|
56
39
|
prerelease: false
|
57
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
41
|
none: false
|
59
|
-
requirements:
|
60
|
-
- -
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.6.0
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: highline
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
66
54
|
type: :runtime
|
67
|
-
version_requirements: *id003
|
68
|
-
- !ruby/object:Gem::Dependency
|
69
|
-
name: rdoc
|
70
55
|
prerelease: false
|
71
|
-
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rdoc
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
72
65
|
none: false
|
73
|
-
requirements:
|
66
|
+
requirements:
|
74
67
|
- - ~>
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
|
77
|
-
segments:
|
78
|
-
- 4
|
79
|
-
- 0
|
80
|
-
version: "4.0"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '4.0'
|
81
70
|
type: :development
|
82
|
-
version_requirements: *id004
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: hoe
|
85
71
|
prerelease: false
|
86
|
-
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '4.0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: hoe
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
87
81
|
none: false
|
88
|
-
requirements:
|
82
|
+
requirements:
|
89
83
|
- - ~>
|
90
|
-
- !ruby/object:Gem::Version
|
91
|
-
|
92
|
-
segments:
|
93
|
-
- 3
|
94
|
-
- 7
|
95
|
-
version: "3.7"
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '3.7'
|
96
86
|
type: :development
|
97
|
-
|
98
|
-
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '3.7'
|
94
|
+
description: Collection of classes to handle build systems (CMake, autotools, ...)
|
95
|
+
and import mechanisms (tarballs, CVS, SVN, git, ...). It also offers a Rake integration
|
96
|
+
to import and build such software packages. It is the backbone of the autoproj (http://rock-robotics.org/autoproj)
|
97
|
+
integrated software project management tool.
|
99
98
|
email: rock-dev@dfki.de
|
100
|
-
executables:
|
99
|
+
executables:
|
101
100
|
- autobuild
|
102
101
|
extensions: []
|
103
|
-
|
104
|
-
extra_rdoc_files:
|
102
|
+
extra_rdoc_files:
|
105
103
|
- Changes.txt
|
106
104
|
- Manifest.txt
|
107
105
|
- README.txt
|
108
|
-
files:
|
106
|
+
files:
|
109
107
|
- Changes.txt
|
110
108
|
- Manifest.txt
|
111
109
|
- README.txt
|
@@ -113,6 +111,7 @@ files:
|
|
113
111
|
- TODO
|
114
112
|
- bin/autobuild
|
115
113
|
- lib/autobuild.rb
|
114
|
+
- lib/autobuild/build_logfile.rb
|
116
115
|
- lib/autobuild/config.rb
|
117
116
|
- lib/autobuild/configurable.rb
|
118
117
|
- lib/autobuild/environment.rb
|
@@ -151,44 +150,35 @@ files:
|
|
151
150
|
- test/tools.rb
|
152
151
|
- .gemtest
|
153
152
|
homepage: http://rock-robotics.org/stable/documentation/autoproj
|
154
|
-
licenses:
|
153
|
+
licenses:
|
155
154
|
- MIT
|
156
155
|
post_install_message:
|
157
|
-
rdoc_options:
|
156
|
+
rdoc_options:
|
158
157
|
- --main
|
159
158
|
- README.txt
|
160
|
-
require_paths:
|
159
|
+
require_paths:
|
161
160
|
- lib
|
162
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
161
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
163
162
|
none: false
|
164
|
-
requirements:
|
165
|
-
- -
|
166
|
-
- !ruby/object:Gem::Version
|
167
|
-
|
168
|
-
|
169
|
-
- 0
|
170
|
-
version: "0"
|
171
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ! '>='
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
167
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
172
168
|
none: false
|
173
|
-
requirements:
|
174
|
-
- -
|
175
|
-
- !ruby/object:Gem::Version
|
176
|
-
|
177
|
-
segments:
|
178
|
-
- 1
|
179
|
-
- 3
|
180
|
-
- 1
|
181
|
-
version: 1.3.1
|
169
|
+
requirements:
|
170
|
+
- - ! '>='
|
171
|
+
- !ruby/object:Gem::Version
|
172
|
+
version: '0'
|
182
173
|
requirements: []
|
183
|
-
|
184
174
|
rubyforge_project: autobuild
|
185
|
-
rubygems_version: 1.8.
|
175
|
+
rubygems_version: 1.8.23
|
186
176
|
signing_key:
|
187
177
|
specification_version: 3
|
188
178
|
summary: Library to handle build systems and import mechanisms
|
189
|
-
test_files:
|
190
|
-
- test/
|
179
|
+
test_files:
|
180
|
+
- test/test_import_tar.rb
|
191
181
|
- test/test_subcommand.rb
|
182
|
+
- test/test_reporting.rb
|
192
183
|
- test/test_import_svn.rb
|
193
184
|
- test/test_import_cvs.rb
|
194
|
-
- test/test_import_tar.rb
|