autobuild 1.21.0 → 1.22.0
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.
- checksums.yaml +4 -4
- data/.github/workflows/lint.yml +25 -0
- data/.github/workflows/test.yml +30 -0
- data/.rubocop.yml +14 -7
- data/autobuild.gemspec +1 -1
- data/bin/autobuild +1 -1
- data/lib/autobuild/build_logfile.rb +1 -2
- data/lib/autobuild/config.rb +5 -5
- data/lib/autobuild/environment.rb +28 -45
- data/lib/autobuild/exceptions.rb +11 -5
- data/lib/autobuild/import/archive.rb +31 -22
- data/lib/autobuild/import/cvs.rb +6 -6
- data/lib/autobuild/import/darcs.rb +4 -4
- data/lib/autobuild/import/git-lfs.rb +4 -4
- data/lib/autobuild/import/git.rb +139 -66
- data/lib/autobuild/import/hg.rb +7 -7
- data/lib/autobuild/import/svn.rb +15 -9
- data/lib/autobuild/importer.rb +33 -37
- data/lib/autobuild/mail_reporter.rb +5 -2
- data/lib/autobuild/package.rb +14 -12
- data/lib/autobuild/packages/autotools.rb +3 -8
- data/lib/autobuild/packages/cmake.rb +11 -8
- data/lib/autobuild/packages/dummy.rb +0 -4
- data/lib/autobuild/packages/gnumake.rb +1 -1
- data/lib/autobuild/packages/orogen.rb +11 -4
- data/lib/autobuild/packages/pkgconfig.rb +2 -2
- data/lib/autobuild/packages/python.rb +1 -2
- data/lib/autobuild/packages/ruby.rb +5 -5
- data/lib/autobuild/parallel.rb +7 -16
- data/lib/autobuild/pkgconfig.rb +1 -0
- data/lib/autobuild/progress_display.rb +5 -9
- data/lib/autobuild/rake_task_extension.rb +6 -0
- data/lib/autobuild/reporting.rb +7 -7
- data/lib/autobuild/subcommand.rb +24 -23
- data/lib/autobuild/timestamps.rb +3 -3
- data/lib/autobuild/utility.rb +3 -3
- data/lib/autobuild/version.rb +1 -1
- data/lib/autobuild.rb +0 -3
- metadata +5 -4
- data/.travis.yml +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4bf4fb952c18b27c30e09e50c005f4e07e475c4d0c21c2cac3c81e4e62dc41a0
|
4
|
+
data.tar.gz: dbc32874e7cdf92e6dff9b18718a8922c6d602abe45701ee4dda17fccd04e684
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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/
|
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/
|
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/
|
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.
|
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
data/lib/autobuild/config.rb
CHANGED
@@ -198,7 +198,7 @@ module Autobuild
|
|
198
198
|
opts.separator ""
|
199
199
|
opts.separator "General behaviour"
|
200
200
|
opts.on('--nice NICE', Integer,
|
201
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
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
|
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
|
-
|
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
|
-
|
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
|
-
|
515
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
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
|
-
|
668
|
-
|
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/
|
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
|
-
|
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
|
-
|
873
|
-
end
|
855
|
+
return if block_given? && !yield(path)
|
856
|
+
|
874
857
|
env.add_path(varname, path)
|
875
858
|
end
|
876
859
|
end
|
data/lib/autobuild/exceptions.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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 <
|
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
|
-
|
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
|
-
|
163
|
+
user: user, password: password,
|
164
|
+
current_time: current_time)
|
162
165
|
else
|
163
166
|
raise PackageException.new(package, 'import'),
|
164
|
-
|
165
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
235
|
-
|
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
|
-
|
254
|
-
|
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
|
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,
|
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(
|
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,
|
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
|
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
|
-
|
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
|
-
|
489
|
+
allow_interactive: true
|
481
490
|
|
482
491
|
update_cache(package)
|
483
492
|
|