autobuild 1.10.0.b1 → 1.10.0.b2
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/lib/autobuild/environment.rb +19 -2
- data/lib/autobuild/exceptions.rb +7 -0
- data/lib/autobuild/import/archive.rb +15 -8
- data/lib/autobuild/import/cvs.rb +1 -1
- data/lib/autobuild/import/darcs.rb +1 -1
- data/lib/autobuild/import/git.rb +6 -4
- data/lib/autobuild/import/hg.rb +1 -1
- data/lib/autobuild/import/svn.rb +1 -1
- data/lib/autobuild/importer.rb +12 -4
- data/lib/autobuild/parallel.rb +2 -1
- data/lib/autobuild/reporting.rb +7 -1
- data/lib/autobuild/version.rb +1 -1
- data/test/import/test_tar.rb +19 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67c87629da5179c5b58f195daf8679f53bfc4054
|
4
|
+
data.tar.gz: af790ea0bf7210db55344839c79455b650d1e915
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 504fec6fac6c095d815d7541ba6828dc55a62032ae8bfeea548e8c23ae3f29bb4dd2f945a80720fc8110ab0d3e3c2695e26fc3dd05729f94bf102c630cfd73ab
|
7
|
+
data.tar.gz: 20292807e5da7f402da75132e4ed808e1b89f05eda485b371b7b03c1156827d6886dc4cd31be4a6da46b079c01e7db941b5b74fe5f2ad2a67d37eecbff83bfde
|
@@ -531,6 +531,24 @@ module Autobuild
|
|
531
531
|
add_prefix(newprefix, includes)
|
532
532
|
end
|
533
533
|
|
534
|
+
# Returns the system-wide search path that is embedded in pkg-config
|
535
|
+
def default_pkgconfig_search_suffixes
|
536
|
+
found_path_rx = /Scanning directory '(.*\/)((?:lib|lib64|share)\/.*)'$/
|
537
|
+
nonexistent_path_rx = /Cannot open directory '.*\/((?:lib|lib64|share)\/.*)' in package search path:.*/
|
538
|
+
|
539
|
+
if !@default_pkgconfig_search_suffixes
|
540
|
+
output = `LANG=C PKG_CONFIG_PATH= #{Autobuild.tool("pkg-config")} --debug 2>&1`.split("\n")
|
541
|
+
found_paths = output.grep(found_path_rx).
|
542
|
+
map { |l| l.gsub(found_path_rx, '\2') }.
|
543
|
+
to_set
|
544
|
+
not_found = output.grep(nonexistent_path_rx).
|
545
|
+
map { |l| l.gsub(nonexistent_path_rx, '\1') }.
|
546
|
+
to_set
|
547
|
+
@default_pkgconfig_search_suffixes = found_paths | not_found
|
548
|
+
end
|
549
|
+
return @default_pkgconfig_search_suffixes
|
550
|
+
end
|
551
|
+
|
534
552
|
# Updates the environment when a new prefix has been added
|
535
553
|
def add_prefix(newprefix, includes = nil)
|
536
554
|
if !includes || includes.include?('PATH')
|
@@ -540,8 +558,7 @@ module Autobuild
|
|
540
558
|
end
|
541
559
|
|
542
560
|
if !includes || includes.include?('PKG_CONFIG_PATH')
|
543
|
-
|
544
|
-
each_env_search_path(newprefix, pkg_config_search) do |path|
|
561
|
+
each_env_search_path(newprefix, default_pkgconfig_search_suffixes) do |path|
|
545
562
|
add_path('PKG_CONFIG_PATH', path)
|
546
563
|
end
|
547
564
|
end
|
data/lib/autobuild/exceptions.rb
CHANGED
@@ -117,5 +117,12 @@ module Autobuild
|
|
117
117
|
msg
|
118
118
|
end
|
119
119
|
end
|
120
|
+
|
121
|
+
# Exception raised in contexts where user interaction is forbidden but
|
122
|
+
# required by the import/build process
|
123
|
+
#
|
124
|
+
# This is for instance used during package import if the importer has to ask
|
125
|
+
# the user a question and allow_interactive is false
|
126
|
+
class InteractionRequired < RuntimeError; end
|
120
127
|
end
|
121
128
|
|
@@ -288,7 +288,7 @@ module Autobuild
|
|
288
288
|
# also used to infer the mode
|
289
289
|
# [:mode] The unpack mode: one of Zip, Bzip, Gzip or Plain, this is
|
290
290
|
# usually automatically inferred from the filename
|
291
|
-
def initialize(url, options)
|
291
|
+
def initialize(url, options = Hash.new)
|
292
292
|
sourceopts, options = Kernel.filter_options options,
|
293
293
|
:source_id, :repository_id, :filename, :mode
|
294
294
|
super(options)
|
@@ -304,13 +304,13 @@ module Autobuild
|
|
304
304
|
|
305
305
|
# Changes the URL from which we should pick the archive
|
306
306
|
def relocate(url, options = Hash.new)
|
307
|
-
parsed_url = URI.parse(url)
|
307
|
+
parsed_url = URI.parse(url).normalize
|
308
308
|
@url = parsed_url
|
309
309
|
if !VALID_URI_SCHEMES.include?(@url.scheme)
|
310
310
|
raise ConfigException, "invalid URL #{@url} (local files must be prefixed with file://)"
|
311
311
|
end
|
312
|
-
@repository_id = options[:repository_id] || parsed_url
|
313
|
-
@source_id = options[:source_id] || parsed_url
|
312
|
+
@repository_id = options[:repository_id] || parsed_url.to_s
|
313
|
+
@source_id = options[:source_id] || parsed_url.to_s
|
314
314
|
|
315
315
|
@filename = options[:filename] || @filename || File.basename(url).gsub(/\?.*/, '')
|
316
316
|
|
@@ -334,7 +334,7 @@ module Autobuild
|
|
334
334
|
end
|
335
335
|
|
336
336
|
if needs_update || archive_changed?(package)
|
337
|
-
checkout(package)
|
337
|
+
checkout(package, allow_interactive: options[:allow_interactive])
|
338
338
|
end
|
339
339
|
rescue OpenURI::HTTPError
|
340
340
|
raise Autobuild::Exception.new(package.name, :import)
|
@@ -357,7 +357,10 @@ module Autobuild
|
|
357
357
|
checkout_digest != cachefile_digest
|
358
358
|
end
|
359
359
|
|
360
|
-
def checkout(package) # :nodoc:
|
360
|
+
def checkout(package, options = Hash.new) # :nodoc:
|
361
|
+
options = Kernel.validate_options options,
|
362
|
+
allow_interactive: true
|
363
|
+
|
361
364
|
update_cache(package)
|
362
365
|
|
363
366
|
# Check whether the archive file changed, and if that is the case
|
@@ -365,7 +368,7 @@ module Autobuild
|
|
365
368
|
if File.file?(checkout_digest_stamp(package)) && archive_changed?(package)
|
366
369
|
if ArchiveImporter.auto_update?
|
367
370
|
response = 'yes'
|
368
|
-
|
371
|
+
elsif options[:allow_interactive]
|
369
372
|
package.progress_done
|
370
373
|
package.message "The archive #{@url.to_s} is different from the one currently checked out at #{package.srcdir}", :bold
|
371
374
|
package.message "I will have to delete the current folder to go on with the update"
|
@@ -375,6 +378,8 @@ module Autobuild
|
|
375
378
|
q.default = 'yes'
|
376
379
|
q.case = :downcase
|
377
380
|
end
|
381
|
+
else
|
382
|
+
raise Autobuild::InteractionRequired, "importing #{package.name} would have required user interaction and allow_interactive is false"
|
378
383
|
end
|
379
384
|
|
380
385
|
if response == "no"
|
@@ -428,7 +433,9 @@ module Autobuild
|
|
428
433
|
rescue OpenURI::HTTPError
|
429
434
|
raise Autobuild::PackageException.new(package.name, :import)
|
430
435
|
rescue SubcommandFailed
|
431
|
-
|
436
|
+
if cachefile != url.path
|
437
|
+
FileUtils.rm_f cachefile
|
438
|
+
end
|
432
439
|
raise
|
433
440
|
end
|
434
441
|
end
|
data/lib/autobuild/import/cvs.rb
CHANGED
@@ -36,7 +36,7 @@ module Autobuild
|
|
36
36
|
'pull', '--all', "--repodir=#{package.srcdir}", '--set-scripts-executable', @source, *@pull, retry: true)
|
37
37
|
end
|
38
38
|
|
39
|
-
def checkout(package) # :nodoc:
|
39
|
+
def checkout(package, options = Hash.new) # :nodoc:
|
40
40
|
basedir = File.dirname(package.srcdir)
|
41
41
|
unless File.directory?(basedir)
|
42
42
|
FileUtils.mkdir_p(basedir)
|
data/lib/autobuild/import/git.rb
CHANGED
@@ -652,7 +652,9 @@ module Autobuild
|
|
652
652
|
# @param [String] fetch_commit the state of the remote branch. This is
|
653
653
|
# used to avoid losing commits if HEAD is not included in
|
654
654
|
# target_commit
|
655
|
-
|
655
|
+
# @option options [Boolean] force (false) bypasses checks that verify
|
656
|
+
# that some commits won't be lost by resetting
|
657
|
+
def reset_head_to_commit(package, target_commit, fetch_commit, options = Hash.new)
|
656
658
|
current_head = rev_parse(package, 'HEAD')
|
657
659
|
head_to_target = merge_status(package, target_commit, current_head)
|
658
660
|
status_to_target = head_to_target.status
|
@@ -661,7 +663,7 @@ module Autobuild
|
|
661
663
|
return
|
662
664
|
elsif status_to_target == Status::SIMPLE_UPDATE
|
663
665
|
run_git(package, 'merge', target_commit)
|
664
|
-
|
666
|
+
elsif !options[:force]
|
665
667
|
# Check whether the current HEAD is present on the remote
|
666
668
|
# repository. We'll refuse resetting if there are uncommitted
|
667
669
|
# changes
|
@@ -745,7 +747,7 @@ module Autobuild
|
|
745
747
|
|
746
748
|
fetch_commit ||= current_remote_commit(package, options[:only_local])
|
747
749
|
if options[:reset]
|
748
|
-
reset_head_to_commit(package, target_commit, fetch_commit)
|
750
|
+
reset_head_to_commit(package, target_commit, fetch_commit, force: (options[:reset] == :force))
|
749
751
|
else
|
750
752
|
merge_if_simple(package, target_commit)
|
751
753
|
end
|
@@ -774,7 +776,7 @@ module Autobuild
|
|
774
776
|
nil
|
775
777
|
end
|
776
778
|
|
777
|
-
def checkout(package)
|
779
|
+
def checkout(package, options = Hash.new)
|
778
780
|
base_dir = File.expand_path('..', package.importdir)
|
779
781
|
if !File.directory?(base_dir)
|
780
782
|
FileUtils.mkdir_p base_dir
|
data/lib/autobuild/import/hg.rb
CHANGED
@@ -59,7 +59,7 @@ module Autobuild
|
|
59
59
|
package.run(:import, Autobuild.tool('hg'), 'update', branch, working_directory: package.importdir)
|
60
60
|
end
|
61
61
|
|
62
|
-
def checkout(package)
|
62
|
+
def checkout(package, options = Hash.new)
|
63
63
|
base_dir = File.expand_path('..', package.importdir)
|
64
64
|
if !File.directory?(base_dir)
|
65
65
|
FileUtils.mkdir_p base_dir
|
data/lib/autobuild/import/svn.rb
CHANGED
@@ -212,7 +212,7 @@ module Autobuild
|
|
212
212
|
run_svn(package, 'up', "--non-interactive", *options_up)
|
213
213
|
end
|
214
214
|
|
215
|
-
def checkout(package) # :nodoc:
|
215
|
+
def checkout(package, options = Hash.new) # :nodoc:
|
216
216
|
run_svn(package, 'co', "--non-interactive", *@options_co, svnroot, package.importdir,
|
217
217
|
working_directory: nil)
|
218
218
|
end
|
data/lib/autobuild/importer.rb
CHANGED
@@ -72,6 +72,7 @@ class Importer
|
|
72
72
|
@options = options.dup
|
73
73
|
@options[:retry_count] = Integer(@options[:retry_count] || 0)
|
74
74
|
@repository_id = options[:repository_id] || "#{self.class.name}:#{object_id}"
|
75
|
+
@interactive = options[:interactive]
|
75
76
|
@source_id = options[:source_id] || @repository_id
|
76
77
|
end
|
77
78
|
|
@@ -82,6 +83,7 @@ class Importer
|
|
82
83
|
# two git importers that point to the same repository but different branches
|
83
84
|
# would have the same repository_id but different source_id
|
84
85
|
#
|
86
|
+
# @return [String]
|
85
87
|
# @see source_id
|
86
88
|
attr_reader :repository_id
|
87
89
|
|
@@ -92,9 +94,14 @@ class Importer
|
|
92
94
|
# point to the same repository but different branches would have the same
|
93
95
|
# repository_id but different source_id
|
94
96
|
#
|
97
|
+
# @return [String]
|
95
98
|
# @see repository_id
|
96
99
|
attr_reader :source_id
|
97
100
|
|
101
|
+
# Whether this importer will need interaction with the user, for instance to
|
102
|
+
# give credentials
|
103
|
+
def interactive?; !!@interactive end
|
104
|
+
|
98
105
|
# The number of times update / checkout should be retried before giving up.
|
99
106
|
# The default is 0 (do not retry)
|
100
107
|
#
|
@@ -204,11 +211,11 @@ class Importer
|
|
204
211
|
fallback(e, package, :import, package)
|
205
212
|
end
|
206
213
|
|
207
|
-
def perform_checkout(package)
|
214
|
+
def perform_checkout(package, options = Hash.new)
|
208
215
|
package.progress_start "checking out %s", :done_message => 'checked out %s' do
|
209
216
|
retry_count = 0
|
210
217
|
begin
|
211
|
-
checkout(package)
|
218
|
+
checkout(package, options)
|
212
219
|
rescue Interrupt
|
213
220
|
raise
|
214
221
|
rescue ::Exception => original_error
|
@@ -268,7 +275,8 @@ class Importer
|
|
268
275
|
only_local: false,
|
269
276
|
reset: false,
|
270
277
|
checkout_only: false,
|
271
|
-
ignore_errors: false
|
278
|
+
ignore_errors: false,
|
279
|
+
allow_interactive: true
|
272
280
|
ignore_errors = options.delete(:ignore_errors)
|
273
281
|
|
274
282
|
importdir = package.importdir
|
@@ -288,7 +296,7 @@ class Importer
|
|
288
296
|
raise ConfigException.new(package, 'import'), "#{importdir} exists but is not a directory"
|
289
297
|
else
|
290
298
|
package.isolate_errors(mark_as_failed: true, ignore_errors: ignore_errors) do
|
291
|
-
perform_checkout(package)
|
299
|
+
perform_checkout(package, allow_interactive: options[:allow_interactive])
|
292
300
|
end
|
293
301
|
end
|
294
302
|
end
|
data/lib/autobuild/parallel.rb
CHANGED
@@ -229,6 +229,7 @@ module Autobuild
|
|
229
229
|
end
|
230
230
|
|
231
231
|
def resolve_cycle(tasks)
|
232
|
+
cycle = tasks.dup
|
232
233
|
chain = []
|
233
234
|
next_task = tasks.first
|
234
235
|
while true
|
@@ -244,7 +245,7 @@ module Autobuild
|
|
244
245
|
end
|
245
246
|
end
|
246
247
|
if !next_task
|
247
|
-
raise "something fishy while resolving a cycle in #{
|
248
|
+
raise "something fishy while resolving a cycle in #{cycle.map(&:name).join(", ")}. Some of these packages might have added new dependencies during the task resolution, which is forbidden"
|
248
249
|
end
|
249
250
|
end
|
250
251
|
chain
|
data/lib/autobuild/reporting.rb
CHANGED
data/lib/autobuild/version.rb
CHANGED
data/test/import/test_tar.rb
CHANGED
@@ -25,6 +25,25 @@ class TC_TarImporter < Minitest::Test
|
|
25
25
|
assert_equal(TarImporter::Bzip, TarImporter.filename_to_mode('tarfile.tar.bz2'))
|
26
26
|
end
|
27
27
|
|
28
|
+
def test_it_sets_the_repository_id_to_the_normalized_URL
|
29
|
+
importer = TarImporter.new "FILE://test/file"
|
30
|
+
assert_equal "file://test/file", importer.repository_id.to_str
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_it_sets_the_source_id_to_the_normalized_URL
|
34
|
+
importer = TarImporter.new "FILE://test/file"
|
35
|
+
assert_equal "file://test/file", importer.source_id.to_str
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_it_does_not_delete_a_locally_specified_archive_on_error
|
39
|
+
dummy_tar = File.join(@datadir, "dummy.tar")
|
40
|
+
FileUtils.touch dummy_tar
|
41
|
+
importer = TarImporter.new "file://#{dummy_tar}"
|
42
|
+
pkg = Package.new 'tarimport'
|
43
|
+
assert_raises(Autobuild::SubcommandFailed) { importer.checkout(pkg) }
|
44
|
+
assert File.file?(dummy_tar)
|
45
|
+
end
|
46
|
+
|
28
47
|
def test_tar_valid_url
|
29
48
|
assert_raises(ConfigException) {
|
30
49
|
TarImporter.new 'ccc://localhost/files/tarimport.tar.gz', :cachedir => @cachedir
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: autobuild
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.10.0.
|
4
|
+
version: 1.10.0.b2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sylvain Joyeux
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|