autobuild 1.21.0 → 1.22.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/lint.yml +25 -0
  3. data/.github/workflows/test.yml +30 -0
  4. data/.rubocop.yml +14 -7
  5. data/autobuild.gemspec +1 -1
  6. data/bin/autobuild +1 -1
  7. data/lib/autobuild/build_logfile.rb +1 -2
  8. data/lib/autobuild/config.rb +5 -5
  9. data/lib/autobuild/environment.rb +28 -45
  10. data/lib/autobuild/exceptions.rb +11 -5
  11. data/lib/autobuild/import/archive.rb +31 -22
  12. data/lib/autobuild/import/cvs.rb +6 -6
  13. data/lib/autobuild/import/darcs.rb +4 -4
  14. data/lib/autobuild/import/git-lfs.rb +4 -4
  15. data/lib/autobuild/import/git.rb +139 -66
  16. data/lib/autobuild/import/hg.rb +7 -7
  17. data/lib/autobuild/import/svn.rb +15 -9
  18. data/lib/autobuild/importer.rb +33 -37
  19. data/lib/autobuild/mail_reporter.rb +5 -2
  20. data/lib/autobuild/package.rb +14 -12
  21. data/lib/autobuild/packages/autotools.rb +3 -8
  22. data/lib/autobuild/packages/cmake.rb +11 -8
  23. data/lib/autobuild/packages/dummy.rb +0 -4
  24. data/lib/autobuild/packages/gnumake.rb +1 -1
  25. data/lib/autobuild/packages/orogen.rb +11 -4
  26. data/lib/autobuild/packages/pkgconfig.rb +2 -2
  27. data/lib/autobuild/packages/python.rb +1 -2
  28. data/lib/autobuild/packages/ruby.rb +5 -5
  29. data/lib/autobuild/parallel.rb +7 -16
  30. data/lib/autobuild/pkgconfig.rb +1 -0
  31. data/lib/autobuild/progress_display.rb +5 -9
  32. data/lib/autobuild/rake_task_extension.rb +6 -0
  33. data/lib/autobuild/reporting.rb +7 -7
  34. data/lib/autobuild/subcommand.rb +24 -23
  35. data/lib/autobuild/timestamps.rb +3 -3
  36. data/lib/autobuild/utility.rb +3 -3
  37. data/lib/autobuild/version.rb +1 -1
  38. data/lib/autobuild.rb +0 -3
  39. metadata +5 -4
  40. data/.travis.yml +0 -21
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ab39a53575bd73cfcf5468577e0a331dcb0ffac4cd3a44a56d6485b0185d8d9c
4
- data.tar.gz: 5612683a6a53e89787892fc54bb0f1b2e7f98251b1204d1986b115afd57bd536
3
+ metadata.gz: 4bf4fb952c18b27c30e09e50c005f4e07e475c4d0c21c2cac3c81e4e62dc41a0
4
+ data.tar.gz: dbc32874e7cdf92e6dff9b18718a8922c6d602abe45701ee4dda17fccd04e684
5
5
  SHA512:
6
- metadata.gz: 278baf14e748956b8f45e65e13b5156b875559d36ac2a973afa0a82de1840e7faa02d6f4bb5179c2d4c811048e69673d916c70d757b625d7586a4bc192653893
7
- data.tar.gz: 65ad33b5793db30fd126101e1bb36e933265cc0727845c97e866295e4248b3de9b5f0b93e07dc6046adf4f791085687fb568c633e426f6b648d8991bd0ee22f2
6
+ metadata.gz: 0d9408d8aa15779a19ceaae45feafb53cea942aef147becce39835abebf873717c0f9d4d9ed04f7a47052e31120b4c80ec1b480c002ceb4d40458bd0881f1bde
7
+ data.tar.gz: 8e84128190fcd911790ff20803d1965f955762affa1979bee79188dcff64a8799c4f4267d86985842008103a835004d7921794717c141e65fc97f6c8d46c638d
@@ -0,0 +1,25 @@
1
+ name: Rubocop
2
+
3
+ on: [pull_request]
4
+
5
+ jobs:
6
+ test:
7
+ runs-on: ubuntu-latest
8
+
9
+ strategy:
10
+ matrix:
11
+ ruby-version: ["2.7", "2.6", "2.5"]
12
+
13
+ steps:
14
+ - uses: actions/checkout@v2
15
+ - name: Set up Ruby ${{ matrix.ruby-version }}
16
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
17
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
18
+ # uses: ruby/setup-ruby@v1
19
+ uses: ruby/setup-ruby@v1
20
+ with:
21
+ ruby-version: ${{ matrix.ruby-version }}
22
+ - name: Install dependencies
23
+ run: bundle install
24
+ - name: Run rubocop
25
+ run: bundle exec rubocop
@@ -0,0 +1,30 @@
1
+ name: Unit Tests
2
+
3
+ on: [pull_request]
4
+
5
+ jobs:
6
+ test:
7
+ runs-on: ubuntu-latest
8
+
9
+ strategy:
10
+ matrix:
11
+ ruby-version: ["2.7", "2.6", "2.5"]
12
+
13
+ steps:
14
+ - uses: actions/checkout@v2
15
+ - name: Set up Ruby ${{ matrix.ruby-version }}
16
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
17
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
18
+ # uses: ruby/setup-ruby@v1
19
+ uses: ruby/setup-ruby@v1
20
+ with:
21
+ ruby-version: ${{ matrix.ruby-version }}
22
+ - name: Install dependencies
23
+ run: bundle install
24
+ - name: Run tests
25
+ run: bundle exec rake test
26
+ env:
27
+ GIT_AUTHOR_NAME: autobuild CI Git Identity
28
+ GIT_AUTHOR_EMAIL: autobuild@github.actions
29
+ GIT_COMMITTER_NAME: autobuild CI Git Identity
30
+ GIT_COMMITTER_EMAIL: autobuild@github.actions
data/.rubocop.yml CHANGED
@@ -2,7 +2,7 @@ inherit_gem:
2
2
  rubocop-rock: defaults.yml
3
3
 
4
4
  AllCops:
5
- TargetRubyVersion: "2.3"
5
+ TargetRubyVersion: "2.5"
6
6
  Exclude:
7
7
  - lib/autobuild/packages/genom.rb
8
8
  - vendor/**/*
@@ -17,9 +17,6 @@ Style/TrivialAccessors:
17
17
  Naming/PredicateName:
18
18
  Enabled: false
19
19
 
20
- Lint/SplatKeywordArguments:
21
- Enabled: false
22
-
23
20
  Style/FrozenStringLiteralComment:
24
21
  Enabled: false
25
22
 
@@ -33,7 +30,7 @@ Naming/FileName:
33
30
 
34
31
 
35
32
 
36
- Layout/AlignParameters:
33
+ Layout/ParameterAlignment:
37
34
  Enabled: false
38
35
 
39
36
  Layout/DotPosition:
@@ -42,7 +39,7 @@ Layout/DotPosition:
42
39
  Layout/FirstParameterIndentation:
43
40
  Enabled: false
44
41
 
45
- Layout/IndentAssignment:
42
+ Layout/AssignmentIndentation:
46
43
  Enabled: false
47
44
 
48
45
  Layout/IndentationWidth:
@@ -96,7 +93,7 @@ Style/PerlBackrefs:
96
93
  Style/StringLiterals:
97
94
  Enabled: false
98
95
 
99
- Layout/IndentHeredoc:
96
+ Layout/HeredocIndentation:
100
97
  Enabled: false
101
98
 
102
99
  Metrics/LineLength:
@@ -104,4 +101,14 @@ Metrics/LineLength:
104
101
  Exclude:
105
102
  - test/**/*
106
103
 
104
+ Style/StringConcatenation:
105
+ Enabled: false
106
+
107
+ Style/StderrPuts:
108
+ Enabled: false
109
+
110
+ Style/GlobalStdStream:
111
+ Enabled: false
107
112
 
113
+ Style/OptionalBooleanParameter:
114
+ Enabled: false
data/autobuild.gemspec CHANGED
@@ -5,7 +5,7 @@ require 'autobuild/version'
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "autobuild"
7
7
  s.version = Autobuild::VERSION
8
- s.required_ruby_version = '>= 2.3.0'
8
+ s.required_ruby_version = '>= 2.5.0'
9
9
  s.authors = ["Sylvain Joyeux"]
10
10
  s.email = "sylvain.joyeux@m4x.org"
11
11
  s.summary = "Library to handle build systems and import mechanisms"
data/bin/autobuild CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  begin
4
4
  require 'daemons'
5
- rescue LoadError # rubocop:disable Lint/HandleExceptions
5
+ rescue LoadError # rubocop:disable Lint/SuppressedException
6
6
  end
7
7
 
8
8
  require 'autobuild'
@@ -6,8 +6,7 @@ module Autobuild
6
6
  class BuildLogfile
7
7
  Entry = Struct.new :package, :phase, :start_time, :duration
8
8
 
9
- attr_reader :by_package
10
- attr_reader :by_phase
9
+ attr_reader :by_package, :by_phase
11
10
 
12
11
  def initialize(entries = Array.new)
13
12
  @entries = entries.dup
@@ -198,7 +198,7 @@ module Autobuild
198
198
  opts.separator ""
199
199
  opts.separator "General behaviour"
200
200
  opts.on('--nice NICE', Integer,
201
- 'nice the subprocesses to the given value') do |v|
201
+ 'nice the subprocesses to the given value') do |v|
202
202
  Autobuild.nice = v
203
203
  end
204
204
  opts.on("-h", "--help", "Show this message") do
@@ -253,7 +253,7 @@ module Autobuild
253
253
  opts.separator ""
254
254
  opts.separator "Mail reports"
255
255
  opts.on("--mail-from EMAIL", String,
256
- "From: field of the sent mails") do |from_email|
256
+ "From: field of the sent mails") do |from_email|
257
257
  mail[:from] = from_email
258
258
  end
259
259
  opts.on("--mail-to EMAILS", String, "comma-separated list of emails "\
@@ -262,7 +262,7 @@ module Autobuild
262
262
  mail[:to] += emails.split(',')
263
263
  end
264
264
  opts.on("--mail-subject SUBJECT", String,
265
- "Subject: field of the sent mails") do |subject_email|
265
+ "Subject: field of the sent mails") do |subject_email|
266
266
  mail[:subject] = subject_email
267
267
  end
268
268
  opts.on("--mail-smtp HOSTNAME", String, "address of the mail server "\
@@ -301,7 +301,7 @@ module Autobuild
301
301
 
302
302
  def self.apply(packages, buildname = "autobuild", phases = [], options = Hash.new)
303
303
  options = Kernel.validate_options options,
304
- parallel: Autobuild.parallel_build_level
304
+ parallel: Autobuild.parallel_build_level
305
305
 
306
306
  if Autobuild.mail[:to]
307
307
  if !Autobuild::HAS_RMAIL
@@ -361,7 +361,7 @@ module Autobuild
361
361
  yield(task.package, phase) if package_tasks[task.name]
362
362
  end
363
363
  else
364
- proc { }
364
+ proc {}
365
365
  end
366
366
 
367
367
  invoker.invoke_parallel([Rake::Task["#{buildname}-#{phase}"]],
@@ -89,10 +89,7 @@ module Autobuild
89
89
  # path separator (File::PATH_SEPARATOR)
90
90
  attr_reader :environment
91
91
 
92
- attr_reader :inherited_variables
93
-
94
- attr_reader :system_env
95
- attr_reader :original_env
92
+ attr_reader :inherited_variables, :system_env, :original_env, :target_arch
96
93
 
97
94
  # The set of environment variables that are known to hold paths on the
98
95
  # filesystem
@@ -162,7 +159,8 @@ module Autobuild
162
159
  inherited_environment.delete(name)
163
160
  init_from_env(name)
164
161
  else
165
- environment.keys.each do |env_key|
162
+ keys = environment.keys # get keys first to avoid delete-while-iterating
163
+ keys.each do |env_key|
166
164
  reset(env_key)
167
165
  end
168
166
  end
@@ -180,7 +178,8 @@ module Autobuild
180
178
  environment[name] = nil
181
179
  inherited_environment[name] = nil
182
180
  else
183
- environment.keys.each do |env_key|
181
+ keys = environment.keys # get keys first to avoid delete-while-iterating
182
+ keys.each do |env_key|
184
183
  clear(env_key)
185
184
  end
186
185
  end
@@ -228,7 +227,9 @@ module Autobuild
228
227
  # @see inherit? inherit
229
228
  def inherit=(value)
230
229
  @inherit = value
231
- inherited_environment.keys.each do |env_name|
230
+ # get keys first to avoid modify-while-iterating
231
+ keys = inherited_environment.keys
232
+ keys.each do |env_name|
232
233
  init_from_env(env_name)
233
234
  end
234
235
  end
@@ -328,7 +329,7 @@ module Autobuild
328
329
  end
329
330
  end
330
331
  options = Kernel.validate_options options,
331
- inheritance_mode: :expand
332
+ inheritance_mode: :expand
332
333
  inheritance_mode = options[:inheritance_mode]
333
334
 
334
335
  if !include?(name)
@@ -511,8 +512,8 @@ module Autobuild
511
512
  end
512
513
  export.update.each do |name, (with_inheritance, without_inheritance)|
513
514
  io.puts format(SHELL_CONDITIONAL_SET_COMMAND, name,
514
- with_inheritance.join(File::PATH_SEPARATOR),
515
- without_inheritance.join(File::PATH_SEPARATOR))
515
+ with_inheritance.join(File::PATH_SEPARATOR),
516
+ without_inheritance.join(File::PATH_SEPARATOR))
516
517
  io.puts format(SHELL_EXPORT_COMMAND, name)
517
518
  end
518
519
  source_after(shell: shell).each do |path|
@@ -555,9 +556,8 @@ module Autobuild
555
556
  # DEPRECATED: use add_path instead
556
557
  def self.pathvar(path, varname)
557
558
  if File.directory?(path)
558
- if block_given?
559
- return unless yield(path)
560
- end
559
+ return if block_given? && !yield(path)
560
+
561
561
  add_path(varname, path)
562
562
  end
563
563
  end
@@ -614,8 +614,6 @@ module Autobuild
614
614
  @arch_size, @arch_names = nil
615
615
  end
616
616
 
617
- attr_reader :target_arch
618
-
619
617
  def arch_names
620
618
  return @arch_names if @arch_names
621
619
 
@@ -635,38 +633,24 @@ module Autobuild
635
633
  add_prefix(newprefix, includes)
636
634
  end
637
635
 
638
- # rubocop:disable Metrics/LineLength
639
- PKGCONFIG_INFO = [
640
- %r{Scanning directory (?:#\d+ )?'(.*/)((?:lib|lib64|share)/.*)'$},
641
- %r{Cannot open directory (?:#\d+ )?'.*/((?:lib|lib64|share)/.*)' in package search path:.*}
642
- ].freeze
643
- # rubocop:enable Metrics/LineLength
636
+ PKGCONFIG_PATH_RX = %r{.*/((?:lib|lib64|share)/.*)}.freeze
644
637
 
645
638
  # Returns the system-wide search path that is embedded in pkg-config
646
639
  def default_pkgconfig_search_suffixes
647
- found_path_rx = PKGCONFIG_INFO[0]
648
- nonexistent_path_rx = PKGCONFIG_INFO[1]
649
-
650
- unless @default_pkgconfig_search_suffixes
651
- pkg_config = Autobuild.tool("pkg-config")
652
- output = `LANG=C PKG_CONFIG_PATH= #{pkg_config} --debug 2>&1`.split("\n")
653
- found_paths = output.grep(found_path_rx).
654
- map { |l| l.gsub(found_path_rx, '\2') }.
655
- to_set
656
- not_found = output.grep(nonexistent_path_rx).
657
- map { |l| l.gsub(nonexistent_path_rx, '\1') }.
658
- to_set
659
- @default_pkgconfig_search_suffixes = found_paths | not_found
660
- end
661
- @default_pkgconfig_search_suffixes
640
+ @default_pkgconfig_search_suffixes ||=
641
+ `LANG=C #{Autobuild.tool("pkg-config")} --variable pc_path pkg-config`
642
+ .strip
643
+ .split(":")
644
+ .grep(PKGCONFIG_PATH_RX)
645
+ .map { |l| l.gsub(PKGCONFIG_PATH_RX, '\1') }
646
+ .to_set
662
647
  end
663
648
 
664
649
  # Updates the environment when a new prefix has been added
665
650
  def add_prefix(newprefix, includes = nil)
666
- if !includes || includes.include?('PATH')
667
- if File.directory?("#{newprefix}/bin")
668
- add_path('PATH', "#{newprefix}/bin")
669
- end
651
+ if (!includes || includes.include?('PATH')) &&
652
+ File.directory?("#{newprefix}/bin")
653
+ add_path('PATH', "#{newprefix}/bin")
670
654
  end
671
655
 
672
656
  if !includes || includes.include?('PKG_CONFIG_PATH')
@@ -717,7 +701,7 @@ module Autobuild
717
701
  begin
718
702
  stat = File.stat(full)
719
703
  return full if stat.file? && stat.executable?
720
- rescue ::Exception # rubocop:disable Lint/HandleExceptions
704
+ rescue ::Exception # rubocop:disable Lint/SuppressedException
721
705
  end
722
706
  end
723
707
  nil
@@ -743,7 +727,7 @@ module Autobuild
743
727
  def prepare
744
728
  # Set up some important autobuild parameters
745
729
  inherit 'PATH', 'PKG_CONFIG_PATH', 'RUBYLIB', \
746
- LIBRARY_PATH, 'CMAKE_PREFIX_PATH', 'PYTHONPATH'
730
+ LIBRARY_PATH, 'CMAKE_PREFIX_PATH', 'PYTHONPATH'
747
731
  end
748
732
 
749
733
  # Method called to filter the environment variables before they are set,
@@ -868,9 +852,8 @@ module Autobuild
868
852
  # @deprecated use {Env#add_path} on {.env} instead
869
853
  def self.pathvar(path, varname)
870
854
  if File.directory?(path)
871
- if block_given?
872
- return unless yield(path)
873
- end
855
+ return if block_given? && !yield(path)
856
+
874
857
  env.add_path(varname, path)
875
858
  end
876
859
  end
@@ -24,6 +24,7 @@ module Autobuild
24
24
  @target = target
25
25
  @phase = phase
26
26
  @retry = options[:retry]
27
+ super()
27
28
  end
28
29
 
29
30
  alias exception_message to_s
@@ -52,10 +53,11 @@ module Autobuild
52
53
  class ConfigException < PhaseException
53
54
  def initialize(target = nil, phase = nil, options = Hash.new)
54
55
  options, other_options = Kernel.filter_options options,
55
- retry: false
56
+ retry: false
56
57
  super(target, phase, options.merge(other_options))
57
58
  end
58
59
  end
60
+
59
61
  ## An error occured in a package
60
62
  class PackageException < PhaseException
61
63
  def mail?
@@ -64,7 +66,7 @@ module Autobuild
64
66
 
65
67
  def initialize(target = nil, phase = nil, options = Hash.new)
66
68
  options, other_options = Kernel.filter_options options,
67
- retry: false
69
+ retry: false
68
70
  super(target, phase, options.merge(other_options))
69
71
  end
70
72
  end
@@ -76,6 +78,7 @@ module Autobuild
76
78
 
77
79
  # The subcommand is not found
78
80
  class CommandNotFound < PhaseException; end
81
+
79
82
  # An error occured while running a subcommand
80
83
  class SubcommandFailed < PhaseException
81
84
  def mail?
@@ -84,8 +87,10 @@ module Autobuild
84
87
 
85
88
  attr_writer :retry
86
89
  attr_reader :command, :logfile, :status, :output
90
+
87
91
  def initialize(*args)
88
- if args.size == 1
92
+ case args.size
93
+ when 1
89
94
  sc = args[0]
90
95
  target = sc.target
91
96
  command = sc.command
@@ -93,7 +98,7 @@ module Autobuild
93
98
  status = sc.status
94
99
  output = sc.output
95
100
  @orig_message = sc.exception_message
96
- elsif args.size == 4 || args.size == 5
101
+ when 4, 5
97
102
  target, command, logfile, status, output = *args
98
103
  else
99
104
  raise ArgumentError, "wrong number of arguments, should be 1 or 4..5"
@@ -140,13 +145,14 @@ module Autobuild
140
145
 
141
146
  # The exception type that is used to report multiple errors that occured
142
147
  # when ignore_errors is set
143
- class CompositeException < Autobuild::Exception
148
+ class CompositeException < PhaseException
144
149
  # The array of exception objects representing all the errors that
145
150
  # occured during the build
146
151
  attr_reader :original_errors
147
152
 
148
153
  def initialize(original_errors)
149
154
  @original_errors = original_errors
155
+ super()
150
156
  end
151
157
 
152
158
  def mail?
@@ -106,6 +106,7 @@ module Autobuild
106
106
  @auto_update = (ENV['AUTOBUILD_ARCHIVE_AUTOUPDATE'] == '1')
107
107
 
108
108
  attr_writer :update_cached_file
109
+
109
110
  def update_cached_file?
110
111
  @update_cached_file
111
112
  end
@@ -118,15 +119,16 @@ module Autobuild
118
119
 
119
120
  Net::HTTP.start(
120
121
  uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http|
121
-
122
122
  http.request(request) do |resp|
123
123
  case resp
124
124
  when Net::HTTPNotModified
125
125
  return false
126
126
  when Net::HTTPSuccess
127
- if current_time && (last_modified = resp['last-modified'])
128
- return false if current_time >= Time.rfc2822(last_modified)
127
+ if current_time && (last_modified = resp['last-modified']) &&
128
+ (current_time >= Time.rfc2822(last_modified))
129
+ return false
129
130
  end
131
+
130
132
  if (length = resp['Content-Length'])
131
133
  length = Integer(length)
132
134
  expected_size = "/#{Autobuild.human_readable_size(length)}"
@@ -158,11 +160,12 @@ module Autobuild
158
160
  end
159
161
 
160
162
  return download_http(package, URI(redirect_uri), filename,
161
- user: user, password: password, current_time: current_time)
163
+ user: user, password: password,
164
+ current_time: current_time)
162
165
  else
163
166
  raise PackageException.new(package, 'import'),
164
- "failed download of #{package.name} from #{uri}: "\
165
- "#{resp.class}"
167
+ "failed download of #{package.name} from #{uri}: "\
168
+ "#{resp.class}"
166
169
  end
167
170
  end
168
171
  end
@@ -204,19 +207,19 @@ module Autobuild
204
207
  end
205
208
 
206
209
  if mtime && size
207
- return size != cached_size || mtime > cached_mtime
210
+ size != cached_size || mtime > cached_mtime
208
211
  elsif mtime
209
212
  package.warn "%s: archive size is not available for #{@url}, "\
210
213
  "relying on modification time"
211
- return mtime > cached_mtime
214
+ mtime > cached_mtime
212
215
  elsif size
213
216
  package.warn "%s: archive modification time "\
214
217
  "is not available for #{@url}, relying on size"
215
- return size != cached_size
218
+ size != cached_size
216
219
  else
217
220
  package.warn "%s: neither the archive size nor its modification time "\
218
221
  "are available for #{@url}, will always update"
219
- return true
222
+ true
220
223
  end
221
224
  end
222
225
 
@@ -231,8 +234,8 @@ module Autobuild
231
234
  end
232
235
 
233
236
  updated = download_http(package, @url, "#{cachefile}.partial",
234
- user: @user, password: @password,
235
- current_time: cached_mtime)
237
+ user: @user, password: @password,
238
+ current_time: cached_mtime)
236
239
  return false unless updated
237
240
  elsif Autobuild.bsd?
238
241
  return false unless update_needed?(package)
@@ -250,8 +253,8 @@ module Autobuild
250
253
  additional_options << "--tries" << retries
251
254
  end
252
255
  package.run(:import, Autobuild.tool('wget'), '-q', '-P', cachedir,
253
- *additional_options, @url, '-O', "#{cachefile}.partial",
254
- retry: true)
256
+ *additional_options, @url, '-O', "#{cachefile}.partial",
257
+ retry: true)
255
258
  end
256
259
  rescue Exception
257
260
  FileUtils.rm_f "#{cachefile}.partial"
@@ -264,13 +267,15 @@ module Autobuild
264
267
  # Updates the downloaded file in cache only if it is needed
265
268
  #
266
269
  # @return [Boolean] true if a new file was downloaded, false otherwise
267
- # @raises ConfigException if a expected digest was given in the source.yml file and it doesn't match
270
+ # @raises ConfigException if a expected digest was given in the
271
+ # source.yml file and it doesn't match
268
272
  def update_cache(package)
269
273
  updated = download_from_url(package)
270
274
  @cachefile_digest = read_cachefile_digest
271
275
 
272
276
  if @expected_digest && @expected_digest != @cachefile_digest
273
- raise ConfigException, "The archive #{@url.to_s} does not match the digest provided"
277
+ raise ConfigException,
278
+ "The archive #{@url} does not match the digest provided"
274
279
  end
275
280
 
276
281
  updated
@@ -279,11 +284,11 @@ module Autobuild
279
284
  def read_cachefile_digest
280
285
  Digest::SHA1.hexdigest File.read(cachefile)
281
286
  end
282
-
287
+
283
288
  # Fingerprint for archive importer, we are using
284
289
  # its digest whether is calculated or expected
285
290
  # @raises ConfigException if no digest is present
286
- def vcs_fingerprint(package)
291
+ def vcs_fingerprint(_package)
287
292
  if @cachefile_digest
288
293
  @cachefile_digest
289
294
  elsif File.file?(cachefile)
@@ -291,7 +296,9 @@ module Autobuild
291
296
  elsif @expected_digest
292
297
  @expected_digest
293
298
  else
294
- raise ConfigException, "There is no digest for archive #{@url.to_s}, make sure cache directories are configured correctly"
299
+ raise ConfigException,
300
+ "There is no digest for archive #{@url}, make sure "\
301
+ "cache directories are configured correctly"
295
302
  end
296
303
  end
297
304
 
@@ -378,9 +385,11 @@ module Autobuild
378
385
  # [:mode] The unpack mode: one of Zip, Bzip, Gzip or Plain, this is
379
386
  # usually automatically inferred from the filename
380
387
  def initialize(url, options = Hash.new)
381
- sourceopts, options = Kernel.filter_options options,
388
+ sourceopts, options = Kernel.filter_options(
389
+ options,
382
390
  :source_id, :repository_id, :filename, :mode, :update_cached_file,
383
391
  :user, :password, :expected_digest
392
+ )
384
393
  super(options)
385
394
 
386
395
  @filename = nil
@@ -452,7 +461,7 @@ module Autobuild
452
461
  end
453
462
 
454
463
  if needs_update || archive_changed?(package)
455
- return checkout(package, allow_interactive: options[:allow_interactive])
464
+ checkout(package, allow_interactive: options[:allow_interactive])
456
465
  else
457
466
  false
458
467
  end
@@ -477,7 +486,7 @@ module Autobuild
477
486
 
478
487
  def checkout(package, options = Hash.new) # :nodoc:
479
488
  options = Kernel.validate_options options,
480
- allow_interactive: true
489
+ allow_interactive: true
481
490
 
482
491
  update_cache(package)
483
492