autobuild 1.20.0 → 1.23.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 +7 -6
- 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 +126 -58
- data/lib/autobuild/exceptions.rb +13 -6
- data/lib/autobuild/import/archive.rb +33 -23
- 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 +155 -73
- data/lib/autobuild/import/hg.rb +7 -7
- data/lib/autobuild/import/svn.rb +17 -10
- data/lib/autobuild/importer.rb +37 -39
- data/lib/autobuild/mail_reporter.rb +5 -2
- data/lib/autobuild/package.rb +28 -15
- data/lib/autobuild/packages/autotools.rb +6 -10
- data/lib/autobuild/packages/cmake.rb +13 -9
- 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 +19 -8
- data/lib/autobuild/packages/ruby.rb +5 -5
- data/lib/autobuild/parallel.rb +9 -17
- data/lib/autobuild/pkgconfig.rb +1 -0
- data/lib/autobuild/progress_display.rb +67 -43
- data/lib/autobuild/rake_task_extension.rb +6 -0
- data/lib/autobuild/reporting.rb +15 -9
- data/lib/autobuild/subcommand.rb +30 -26
- data/lib/autobuild/test_utility.rb +6 -3
- data/lib/autobuild/timestamps.rb +3 -3
- data/lib/autobuild/utility.rb +22 -4
- data/lib/autobuild/version.rb +1 -1
- data/lib/autobuild.rb +0 -3
- metadata +28 -26
- data/.travis.yml +0 -19
@@ -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
|
|
@@ -520,7 +529,8 @@ module Autobuild
|
|
520
529
|
|
521
530
|
if mode == Zip
|
522
531
|
main_dir = if @options[:no_subdirectory] then package.srcdir
|
523
|
-
else
|
532
|
+
else
|
533
|
+
base_dir
|
524
534
|
end
|
525
535
|
|
526
536
|
FileUtils.mkdir_p base_dir
|
data/lib/autobuild/import/cvs.rb
CHANGED
@@ -10,7 +10,7 @@ module Autobuild
|
|
10
10
|
# Autobuild.programs['cvs'] = 'my_cvs_tool'
|
11
11
|
def initialize(root_name, options = {})
|
12
12
|
cvsopts, common = Kernel.filter_options options,
|
13
|
-
|
13
|
+
module: nil, cvsup: '-dP', cvsco: '-P'
|
14
14
|
@root = root_name
|
15
15
|
@module = cvsopts[:module]
|
16
16
|
raise ArgumentError, "no module given" unless @module
|
@@ -41,7 +41,7 @@ module Autobuild
|
|
41
41
|
|
42
42
|
unless File.exist?("#{package.srcdir}/CVS/Root")
|
43
43
|
raise ConfigException.new(package, 'import'),
|
44
|
-
|
44
|
+
"#{package.srcdir} is not a CVS working copy"
|
45
45
|
end
|
46
46
|
|
47
47
|
root = File.open("#{package.srcdir}/CVS/Root", &:read).chomp
|
@@ -56,8 +56,8 @@ module Autobuild
|
|
56
56
|
|
57
57
|
if root != expected_root || mod != @module
|
58
58
|
raise ConfigException.new(package, 'import'),
|
59
|
-
|
60
|
-
|
59
|
+
"checkout in #{package.srcdir} is from #{root}:#{mod}, "\
|
60
|
+
"was expecting #{expected_root}:#{@module}"
|
61
61
|
end
|
62
62
|
package.run(:import, Autobuild.tool(:cvs), 'up', *@options_up,
|
63
63
|
retry: true, working_directory: package.importdir)
|
@@ -72,8 +72,8 @@ module Autobuild
|
|
72
72
|
|
73
73
|
FileUtils.mkdir_p(head) unless File.directory?(head)
|
74
74
|
package.run(:import, Autobuild.tool(:cvs), '-d', cvsroot, 'co',
|
75
|
-
|
76
|
-
|
75
|
+
'-d', tail, *@options_co, modulename,
|
76
|
+
retry: true, working_directory: head)
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
@@ -28,12 +28,12 @@ module Autobuild
|
|
28
28
|
end
|
29
29
|
unless File.directory?(File.join(package.srcdir, '_darcs'))
|
30
30
|
raise ConfigException.new(package, 'import'),
|
31
|
-
|
31
|
+
"#{package.srcdir} is not a Darcs repository"
|
32
32
|
end
|
33
33
|
|
34
34
|
package.run(:import, @program, 'pull', '--all',
|
35
|
-
|
36
|
-
|
35
|
+
"--repodir=#{package.srcdir}", '--set-scripts-executable',
|
36
|
+
@source, *@pull, retry: true)
|
37
37
|
true # no easy to know if package was updated, keep previous behavior
|
38
38
|
end
|
39
39
|
|
@@ -42,7 +42,7 @@ module Autobuild
|
|
42
42
|
FileUtils.mkdir_p(basedir) unless File.directory?(basedir)
|
43
43
|
|
44
44
|
package.run(:import, @program, 'get', '--set-scripts-executable',
|
45
|
-
|
45
|
+
@source, package.srcdir, *@get, retry: true)
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
@@ -10,26 +10,26 @@ module Autobuild
|
|
10
10
|
if includes.empty?
|
11
11
|
begin
|
12
12
|
importer.run_git_bare(package, 'config', '--local',
|
13
|
-
|
13
|
+
'--unset', 'lfs.fetchinclude')
|
14
14
|
rescue SubcommandFailed => e
|
15
15
|
raise if e.status != 5
|
16
16
|
end
|
17
17
|
else
|
18
18
|
importer.run_git_bare(package, 'config', '--local',
|
19
|
-
|
19
|
+
'lfs.fetchinclude', includes)
|
20
20
|
end
|
21
21
|
|
22
22
|
excludes = importer.options.fetch(:lfs_exclude, '')
|
23
23
|
if excludes.empty?
|
24
24
|
begin
|
25
25
|
importer.run_git_bare(package, 'config', '--local',
|
26
|
-
|
26
|
+
'--unset', 'lfs.fetchexclude')
|
27
27
|
rescue SubcommandFailed => e
|
28
28
|
raise if e.status != 5
|
29
29
|
end
|
30
30
|
else
|
31
31
|
importer.run_git_bare(package, 'config', '--local',
|
32
|
-
|
32
|
+
'lfs.fetchexclude', excludes)
|
33
33
|
end
|
34
34
|
|
35
35
|
if importer.options[:lfs] != false
|