autobuild 1.17.0 → 1.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +107 -0
  3. data/Gemfile +2 -1
  4. data/Rakefile +1 -4
  5. data/autobuild.gemspec +14 -11
  6. data/bin/autobuild +4 -3
  7. data/lib/autobuild.rb +4 -5
  8. data/lib/autobuild/build_logfile.rb +6 -4
  9. data/lib/autobuild/config.rb +90 -40
  10. data/lib/autobuild/configurable.rb +30 -18
  11. data/lib/autobuild/environment.rb +126 -120
  12. data/lib/autobuild/exceptions.rb +48 -31
  13. data/lib/autobuild/import/archive.rb +134 -82
  14. data/lib/autobuild/import/cvs.rb +28 -24
  15. data/lib/autobuild/import/darcs.rb +13 -16
  16. data/lib/autobuild/import/git-lfs.rb +37 -30
  17. data/lib/autobuild/import/git.rb +231 -179
  18. data/lib/autobuild/import/hg.rb +23 -18
  19. data/lib/autobuild/import/svn.rb +48 -29
  20. data/lib/autobuild/importer.rb +530 -499
  21. data/lib/autobuild/mail_reporter.rb +77 -77
  22. data/lib/autobuild/package.rb +171 -101
  23. data/lib/autobuild/packages/autotools.rb +47 -42
  24. data/lib/autobuild/packages/cmake.rb +71 -65
  25. data/lib/autobuild/packages/dummy.rb +9 -8
  26. data/lib/autobuild/packages/genom.rb +1 -1
  27. data/lib/autobuild/packages/gnumake.rb +19 -13
  28. data/lib/autobuild/packages/import.rb +2 -6
  29. data/lib/autobuild/packages/orogen.rb +32 -31
  30. data/lib/autobuild/packages/pkgconfig.rb +2 -2
  31. data/lib/autobuild/packages/python.rb +7 -2
  32. data/lib/autobuild/packages/ruby.rb +22 -17
  33. data/lib/autobuild/parallel.rb +35 -39
  34. data/lib/autobuild/pkgconfig.rb +25 -13
  35. data/lib/autobuild/progress_display.rb +23 -23
  36. data/lib/autobuild/rake_task_extension.rb +6 -6
  37. data/lib/autobuild/reporting.rb +38 -26
  38. data/lib/autobuild/subcommand.rb +72 -65
  39. data/lib/autobuild/test.rb +8 -7
  40. data/lib/autobuild/test_utility.rb +10 -9
  41. data/lib/autobuild/timestamps.rb +28 -23
  42. data/lib/autobuild/tools.rb +17 -16
  43. data/lib/autobuild/utility.rb +16 -18
  44. data/lib/autobuild/version.rb +1 -1
  45. metadata +39 -38
@@ -44,7 +44,7 @@ def setup
44
44
  @temp_dirs = Array.new
45
45
 
46
46
  @tempdir = make_tmpdir
47
- FileUtils.mkdir_p(@tempdir, :mode => 0700)
47
+ FileUtils.mkdir_p(@tempdir, mode: 0o700)
48
48
  Autobuild.logdir = "#{tempdir}/log"
49
49
  FileUtils.mkdir_p Autobuild.logdir
50
50
  Autobuild.silent = true
@@ -75,20 +75,21 @@ def data_dir
75
75
  attr_reader :tempdir
76
76
 
77
77
  def build_config(bind, template)
78
- eval "basedir = '#{self.tempdir}'", bind
79
- ryml = File.open(File.join(data_dir, "#{template}.ryml")) { |f| f.readlines }.join('')
78
+ bind.local_variable_set(:basedir, tempdir.to_s)
79
+ ryml = File.open(File.join(data_dir, "#{template}.ryml"), &:readlines)
80
+ .join('')
80
81
  result = ERB.new(ryml).result(bind)
81
82
 
82
83
  yml = File.join(tempdir, "#{template}.yml")
83
84
  File.open(yml, 'w+') { |f| f.write(result) }
84
-
85
- return yml
85
+
86
+ yml
86
87
  end
87
88
 
88
89
  def untar(file)
89
90
  file = File.expand_path(file, data_dir)
90
- dir = self.tempdir
91
- Dir.chdir(dir) do
91
+ dir = tempdir
92
+ Dir.chdir(dir) do
92
93
  system("tar xf #{file}")
93
94
  end
94
95
 
@@ -29,16 +29,14 @@ def coverage_enabled?
29
29
  end
30
30
 
31
31
  def coverage_available?
32
- !!@coverage_source_dir
32
+ @coverage_source_dir
33
33
  end
34
34
 
35
35
  # Controls whether code coverage should be measured
36
36
  #
37
37
  # @param [Boolean,nil] flag enable or disable code coverage. If set to
38
38
  # nil, will use the default from {TestUtility.coverage?}
39
- def coverage_enabled=(flag)
40
- @coverage_enabled = flag
41
- end
39
+ attr_writer :coverage_enabled
42
40
 
43
41
  # Where the code coverage will be generated
44
42
  #
@@ -85,21 +83,24 @@ def install
85
83
  if !coverage_enabled?
86
84
  return
87
85
  elsif !coverage_available?
88
- package.warn "%s: #coverage_source_dir not set on #test_utility, skipping installation of the code coverage results"
86
+ package.warn "%s: #coverage_source_dir not set on #test_utility, "\
87
+ "skipping installation of the code coverage results"
89
88
  end
90
89
 
91
90
  coverage_target_dir = self.coverage_target_dir
92
91
  coverage_source_dir = self.coverage_source_dir
93
92
  if "#{coverage_source_dir}/".start_with?("#{source_dir}/")
94
- raise ArgumentError, "#coverage_source_dir cannot be a subdirectory of #source_dir in #{package.name}"
93
+ raise ArgumentError, "#coverage_source_dir cannot be a subdirectory "\
94
+ "of #source_dir in #{package.name}"
95
95
  elsif target_dir == coverage_target_dir
96
- raise ArgumentError, "#coverage_target_dir cannot be the same than of #target_dir in #{package.name}"
96
+ raise ArgumentError, "#coverage_target_dir cannot be the same than of "\
97
+ "#target_dir in #{package.name}"
97
98
  end
98
99
 
99
100
  FileUtils.mkdir_p File.dirname(coverage_target_dir)
100
101
  FileUtils.cp_r coverage_source_dir, coverage_target_dir
101
- package.message "%s: copied test coverage results for #{package.name} from #{coverage_source_dir} to #{coverage_target_dir}"
102
+ package.message "%s: copied test coverage results for #{package.name} from "\
103
+ "#{coverage_source_dir} to #{coverage_target_dir}"
102
104
  end
103
105
  end
104
106
  end
105
-
@@ -1,5 +1,5 @@
1
1
  module Autobuild
2
- STAMPFILE = "autobuild-stamp"
2
+ STAMPFILE = "autobuild-stamp".freeze
3
3
 
4
4
  class << self
5
5
  # The set of global ignores for SourceTreeTask
@@ -15,17 +15,18 @@ class << self
15
15
  # The matching paths will not be considered when looking if a source tree
16
16
  # has been updated or not.
17
17
  def self.ignore(path)
18
- if path.kind_of?(Regexp)
19
- ignored_files << path
20
- else
21
- ignored_files << Regexp.new("^#{Regexp.quote(path)}")
22
- end
18
+ ignored_files <<
19
+ if path.kind_of?(Regexp)
20
+ path
21
+ else
22
+ Regexp.new("^#{Regexp.quote(path)}")
23
+ end
23
24
  end
24
25
 
25
26
  def self.tree_timestamp(path, *exclude)
26
27
  # Exclude autobuild timestamps
27
- exclude << (/#{Regexp.quote(STAMPFILE)}$/)
28
- exclude << (/\.autobuild-patches$/)
28
+ exclude << /#{Regexp.quote(STAMPFILE)}$/
29
+ exclude << /\.autobuild-patches$/
29
30
 
30
31
  Autobuild.message "getting tree timestamp for #{path}" if Autobuild.debug
31
32
  latest = Time.at(0)
@@ -33,13 +34,15 @@ def self.tree_timestamp(path, *exclude)
33
34
 
34
35
  Find.find(path) do |p|
35
36
  Find.prune if File.basename(p) =~ /^\./
36
- exclude.each do |pattern|
37
+ exclude.each do |pattern|
37
38
  if pattern === p
38
- Autobuild.message " excluding #{p} because of #{pattern}" if Autobuild.debug
39
+ if Autobuild.debug
40
+ Autobuild.message " excluding #{p} because of #{pattern}"
41
+ end
39
42
  Find.prune
40
43
  end
41
44
  end
42
- next if !File.file?(p)
45
+ next unless File.file?(p)
43
46
 
44
47
  p_time = File.mtime(p)
45
48
  if latest < p_time
@@ -49,7 +52,7 @@ def self.tree_timestamp(path, *exclude)
49
52
  end
50
53
 
51
54
  Autobuild.message " newest file: #{latest_file} at #{latest}" if Autobuild.debug
52
- return latest_file, latest
55
+ [latest_file, latest]
53
56
  end
54
57
 
55
58
  class SourceTreeTask < Rake::Task
@@ -62,26 +65,28 @@ def initialize(*args, &block)
62
65
  @exclude = Autobuild.ignored_files.dup
63
66
  super
64
67
  end
65
-
68
+
66
69
  def timestamp
67
- if @newest_time
68
- return @newest_time
69
- end
70
+ return @newest_time if @newest_time
70
71
 
71
72
  @newest_file, @newest_time =
72
- Autobuild.tree_timestamp(name, %r#(?:^|/)(?:CVS|_darcs|\.svn)$#, *@exclude)
73
+ Autobuild.tree_timestamp(name,
74
+ %r{(?:^|/)(?:CVS|_darcs|\.svn)$}, *@exclude)
73
75
  @newest_time
74
76
  end
75
77
  end
76
78
  def self.source_tree(path, &block)
77
79
  task = SourceTreeTask.define_task(path)
78
- block.call(task) unless !block
80
+ block&.call(task)
79
81
  task
80
82
  end
81
-
83
+
82
84
  def self.get_stamp(stampfile)
83
- return Time.at(0) if !File.exist?(stampfile)
84
- return File.mtime(stampfile)
85
+ if File.exist?(stampfile)
86
+ File.mtime(stampfile)
87
+ else
88
+ Time.at(0)
89
+ end
85
90
  end
86
91
 
87
92
  def self.hires_modification_time?
@@ -103,9 +108,10 @@ def self.touch_stamp(stampfile)
103
108
  elsif !File.exist?(dir)
104
109
  FileUtils.mkdir_p dir
105
110
  end
111
+
106
112
  FileUtils.touch(stampfile)
107
113
 
108
- if !hires_modification_time?
114
+ unless hires_modification_time?
109
115
  # File modification times on most Unix filesystems have a granularity of
110
116
  # one second, so we (unfortunately) have to sleep 1s to make sure that
111
117
  # time comparisons will work as expected.
@@ -113,4 +119,3 @@ def self.touch_stamp(stampfile)
113
119
  end
114
120
  end
115
121
  end
116
-
@@ -2,7 +2,7 @@ module Autobuild
2
2
  class << self
3
3
  # Configure the programs used by different packages
4
4
  attr_reader :programs
5
- # A cache of entries in programs to their resolved full path
5
+ # A cache of entries in programs to their resolved full path
6
6
  #
7
7
  # @return [{String=>[String,String,String]}] the triplet (full path,
8
8
  # tool name, value of ENV['PATH']). The last two values are used to
@@ -13,7 +13,7 @@ class << self
13
13
 
14
14
  # Get a given program, using its name as default value. For
15
15
  # instance
16
- # tool('automake')
16
+ # tool('automake')
17
17
  # will return 'automake' unless the autobuild script defined
18
18
  # another automake program in Autobuild.programs by doing
19
19
  # Autobuild.programs['automake'] = 'automake1.9'
@@ -30,29 +30,30 @@ def find_in_path(file, envvar = 'PATH')
30
30
  def tool_in_path(name, env: self.env)
31
31
  path, path_name, path_env = programs_in_path[name]
32
32
  current = tool(name)
33
- env_PATH = env.resolved_env['PATH']
34
- if (path_env != env_PATH) || (path_name != current)
33
+ env_path = env.resolved_env['PATH']
34
+ if (path_env != env_path) || (path_name != current)
35
35
  # Delete the current entry given that it is invalid
36
36
  programs_in_path.delete(name)
37
- if current[0, 1] == "/"
38
- # This is already a full path
39
- path = current
40
- else
41
- path = env.find_executable_in_path(current)
37
+ path =
38
+ if current[0, 1] == "/"
39
+ # This is already a full path
40
+ current
41
+ else
42
+ env.find_executable_in_path(current)
43
+ end
44
+
45
+ unless path
46
+ raise ArgumentError, "tool #{name}, set to #{current}, "\
47
+ "can not be found in PATH=#{env_path}"
42
48
  end
43
49
 
44
- if !path
45
- raise ArgumentError, "tool #{name}, set to #{current}, can not be found in PATH=#{env_PATH}"
46
- end
47
-
48
- programs_in_path[name] = [path, current, env_PATH]
50
+ programs_in_path[name] = [path, current, env_path]
49
51
  end
50
52
 
51
- return path
53
+ path
52
54
  end
53
55
  end
54
56
 
55
57
  @programs = Hash.new
56
58
  @programs_in_path = Hash.new
57
59
  end
58
-
@@ -28,7 +28,7 @@ def initialize(name, package, install_on_error: false)
28
28
  @source_ref_dir = nil
29
29
  @source_dir = nil
30
30
  @target_dir = nil
31
- @install_on_error = !!install_on_error
31
+ @install_on_error = install_on_error
32
32
  end
33
33
 
34
34
  # Directory in which the utility will generate some files The
@@ -43,9 +43,7 @@ def initialize(name, package, install_on_error: false)
43
43
  # Absolute path to where this utulity should output its results. Returns nil if
44
44
  # {source_dir} has not been set.
45
45
  def source_dir
46
- if @source_dir
47
- File.expand_path(@source_dir, source_ref_dir || package.srcdir)
48
- end
46
+ File.expand_path(@source_dir, source_ref_dir || package.srcdir) if @source_dir
49
47
  end
50
48
 
51
49
  # Directory in which the utility would install some files.
@@ -62,7 +60,9 @@ def source_dir
62
60
  # @return [String,nil]
63
61
  def target_dir
64
62
  if @target_dir
65
- File.expand_path(@target_dir, File.expand_path(Autobuild.send("#{name}_prefix") || name, package.prefix))
63
+ utility_prefix = Autobuild.send("#{name}_prefix") || name
64
+ File.expand_path(@target_dir,
65
+ File.expand_path(utility_prefix, package.prefix))
66
66
  else
67
67
  File.join(package.logdir, "#{name}-results", package.name)
68
68
  end
@@ -79,6 +79,7 @@ def target_dir
79
79
  # @return [Rake::Task]
80
80
  def task(&block)
81
81
  return if @task
82
+
82
83
  @task = package.task task_name do
83
84
  # This flag allows to disable this utility's task
84
85
  # once {task} has been called
@@ -92,7 +93,7 @@ def task(&block)
92
93
  end
93
94
  end
94
95
 
95
- package.task name => task_name
96
+ package.task name => task_name
96
97
  @task
97
98
  end
98
99
 
@@ -101,16 +102,11 @@ def call_task_block
101
102
 
102
103
  # Allow the user to install manually in the task
103
104
  # block
104
- if !@installed && target_dir
105
- install
106
- end
107
-
105
+ install if !@installed && target_dir
108
106
  rescue Interrupt
109
107
  raise
110
108
  rescue ::Exception => e
111
- if install_on_error? && !@installed && target_dir
112
- install
113
- end
109
+ install if install_on_error? && !@installed && target_dir
114
110
 
115
111
  if Autobuild.send("pass_#{name}_errors")
116
112
  raise
@@ -154,8 +150,10 @@ def enabled?
154
150
  attr_writer :enabled
155
151
 
156
152
  def install
157
- if !File.directory?(source_dir)
158
- raise "#{source_dir} was expected to be a directory, but it is not. Check the package's #{name} generation. The generated #{name} products should be in #{source_dir}"
153
+ unless File.directory?(source_dir)
154
+ raise "#{source_dir} was expected to be a directory, but it is not. "\
155
+ "Check the package's #{name} generation. "\
156
+ "The generated #{name} products should be in #{source_dir}"
159
157
  end
160
158
 
161
159
  target_dir = self.target_dir
@@ -163,7 +161,8 @@ def install
163
161
  FileUtils.rm_rf target_dir
164
162
  FileUtils.mkdir_p File.dirname(target_dir)
165
163
  FileUtils.cp_r source_dir, target_dir
166
- Autoproj.message " copied #{name} results for #{package.name} from #{source_dir} to #{target_dir}"
164
+ Autoproj.message " copied #{name} results for #{package.name} "\
165
+ "from #{source_dir} to #{target_dir}"
167
166
 
168
167
  @installed = true
169
168
  end
@@ -188,8 +187,7 @@ def task_name
188
187
  #
189
188
  # @return [Boolean]
190
189
  def has_task?
191
- !!Rake.application.lookup(task_name)
190
+ Rake.application.lookup(task_name)
192
191
  end
193
192
  end
194
193
  end
195
-
@@ -1,3 +1,3 @@
1
1
  module Autobuild
2
- VERSION = "1.17.0" unless defined? Autobuild::VERSION
2
+ VERSION = "1.18.0".freeze unless defined? Autobuild::VERSION
3
3
  end
metadata CHANGED
@@ -1,83 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autobuild
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.17.0
4
+ version: 1.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvain Joyeux
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-18 00:00:00.000000000 Z
11
+ date: 2019-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rake
14
+ name: pastel
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '12.0'
19
+ version: 0.7.0
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 12.3.0
22
+ version: 0.7.0
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: '12.0'
29
+ version: 0.7.0
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 12.3.0
32
+ version: 0.7.0
33
33
  - !ruby/object:Gem::Dependency
34
- name: utilrb
34
+ name: rake
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '3.0'
39
+ version: '12.0'
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
- version: '3.0'
42
+ version: 12.3.0
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - "~>"
48
48
  - !ruby/object:Gem::Version
49
- version: '3.0'
49
+ version: '12.0'
50
50
  - - ">="
51
51
  - !ruby/object:Gem::Version
52
- version: '3.0'
52
+ version: 12.3.0
53
53
  - !ruby/object:Gem::Dependency
54
- name: tty-prompt
54
+ name: tty-cursor
55
55
  requirement: !ruby/object:Gem::Requirement
56
56
  requirements:
57
57
  - - "~>"
58
58
  - !ruby/object:Gem::Version
59
- version: 0.15.0
59
+ version: 0.5.0
60
60
  type: :runtime
61
61
  prerelease: false
62
62
  version_requirements: !ruby/object:Gem::Requirement
63
63
  requirements:
64
64
  - - "~>"
65
65
  - !ruby/object:Gem::Version
66
- version: 0.15.0
66
+ version: 0.5.0
67
67
  - !ruby/object:Gem::Dependency
68
- name: tty-cursor
68
+ name: tty-prompt
69
69
  requirement: !ruby/object:Gem::Requirement
70
70
  requirements:
71
71
  - - "~>"
72
72
  - !ruby/object:Gem::Version
73
- version: 0.5.0
73
+ version: 0.15.0
74
74
  type: :runtime
75
75
  prerelease: false
76
76
  version_requirements: !ruby/object:Gem::Requirement
77
77
  requirements:
78
78
  - - "~>"
79
79
  - !ruby/object:Gem::Version
80
- version: 0.5.0
80
+ version: 0.15.0
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: tty-screen
83
83
  requirement: !ruby/object:Gem::Requirement
@@ -93,25 +93,39 @@ dependencies:
93
93
  - !ruby/object:Gem::Version
94
94
  version: 0.6.4
95
95
  - !ruby/object:Gem::Dependency
96
- name: pastel
96
+ name: utilrb
97
97
  requirement: !ruby/object:Gem::Requirement
98
98
  requirements:
99
99
  - - "~>"
100
100
  - !ruby/object:Gem::Version
101
- version: 0.7.0
101
+ version: '3.0'
102
102
  - - ">="
103
103
  - !ruby/object:Gem::Version
104
- version: 0.7.0
104
+ version: '3.0'
105
105
  type: :runtime
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
109
109
  - - "~>"
110
110
  - !ruby/object:Gem::Version
111
- version: 0.7.0
111
+ version: '3.0'
112
112
  - - ">="
113
113
  - !ruby/object:Gem::Version
114
- version: 0.7.0
114
+ version: '3.0'
115
+ - !ruby/object:Gem::Dependency
116
+ name: fakefs
117
+ requirement: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ version: '0'
122
+ type: :development
123
+ prerelease: false
124
+ version_requirements: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - ">="
127
+ - !ruby/object:Gem::Version
128
+ version: '0'
115
129
  - !ruby/object:Gem::Dependency
116
130
  name: flexmock
117
131
  requirement: !ruby/object:Gem::Requirement
@@ -152,20 +166,6 @@ dependencies:
152
166
  - - ">="
153
167
  - !ruby/object:Gem::Version
154
168
  version: '5.0'
155
- - !ruby/object:Gem::Dependency
156
- name: fakefs
157
- requirement: !ruby/object:Gem::Requirement
158
- requirements:
159
- - - ">="
160
- - !ruby/object:Gem::Version
161
- version: '0'
162
- type: :development
163
- prerelease: false
164
- version_requirements: !ruby/object:Gem::Requirement
165
- requirements:
166
- - - ">="
167
- - !ruby/object:Gem::Version
168
- version: '0'
169
169
  - !ruby/object:Gem::Dependency
170
170
  name: simplecov
171
171
  requirement: !ruby/object:Gem::Requirement
@@ -191,6 +191,7 @@ extra_rdoc_files: []
191
191
  files:
192
192
  - ".gitattributes"
193
193
  - ".gitignore"
194
+ - ".rubocop.yml"
194
195
  - ".travis.yml"
195
196
  - Changes.txt
196
197
  - Gemfile
@@ -252,7 +253,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
252
253
  requirements:
253
254
  - - ">="
254
255
  - !ruby/object:Gem::Version
255
- version: 1.9.3
256
+ version: 2.3.0
256
257
  required_rubygems_version: !ruby/object:Gem::Requirement
257
258
  requirements:
258
259
  - - ">="