autobuild 1.22.1 → 1.23.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 48e8645a039ab9b7fa950f3264bc9e15a53901a82c34fef9a32e008f123b275e
4
- data.tar.gz: e6cfbaba2cf060c25c8bced04d8577c20275d2aabbdc0aac123ed1b43a9df4a7
3
+ metadata.gz: 6431400922a5accc7c11c921745648a3a7fa65e92023bc700b26e6d975bd2d6a
4
+ data.tar.gz: bd29297ec7e7902e067a08ecb9ea4837a051be82b7db7c6ca40c207657d587bc
5
5
  SHA512:
6
- metadata.gz: 490828e178d20f24bc84d819cf9ac6fb3e6880cf5b9eb938fef540e18e8023008cd467d26fac61b46f531bb7abeadaa1822fd257437a7eb36d8c23ec8dc10906
7
- data.tar.gz: e7eb1e3bc9bfb1f59852766113cfdb981331c595a78c9ef2f7bc530a9cf3594a64f8775b498c27f9ac534296e12393011e172c79129d7abbca69cae7581f6525
6
+ metadata.gz: 726b002c5f1e6a51efe77397546762ce1aa50e546bddecaec4a379a69943646e414e6c0d7ae8a470d29be982a2a50541be800ae40d30a6206723185d1937e30a
7
+ data.tar.gz: 95088358f807bb6edfd52746e8c30ed85b52b05f2318c09be17fe05b45484f554205d48d280094dc378e322b26ae468a2b5ad72468c34b9b369e4d0aa085a5fa
@@ -29,37 +29,44 @@ module Autobuild
29
29
 
30
30
  SHELL_VAR_EXPANSION =
31
31
  if windows? then "%%%s%%".freeze
32
- else "$%s".freeze
32
+ else
33
+ "$%s".freeze
33
34
  end
34
35
  SHELL_SET_COMMAND =
35
36
  if windows? then "set %s=%s".freeze
36
- else "%s=\"%s\"".freeze
37
+ else
38
+ "%s=\"%s\"".freeze
37
39
  end
38
40
  SHELL_CONDITIONAL_SET_COMMAND =
39
41
  if windows? then "set %s=%s".freeze
40
- else "if test -z \"$%1$s\"; then\n %1$s=\"%3$s\"\n"\
42
+ else
43
+ "if test -z \"$%1$s\"; then\n %1$s=\"%3$s\"\n"\
41
44
  "else\n %1$s=\"%2$s\"\nfi".freeze
42
45
  end
43
46
  SHELL_UNSET_COMMAND = "unset %s".freeze
44
47
  SHELL_EXPORT_COMMAND =
45
48
  if windows? then "set %s".freeze
46
- else "export %s".freeze
49
+ else
50
+ "export %s".freeze
47
51
  end
48
52
  SHELL_SOURCE_SCRIPT =
49
53
  if windows? then "%s".freeze
50
- else '. "%s"'.freeze
54
+ else
55
+ '. "%s"'.freeze
51
56
  end
52
57
 
53
58
  LIBRARY_PATH =
54
59
  if macos? then 'DYLD_LIBRARY_PATH'.freeze
55
60
  elsif windows? then 'PATH'.freeze
56
- else 'LD_LIBRARY_PATH'.freeze
61
+ else
62
+ 'LD_LIBRARY_PATH'.freeze
57
63
  end
58
64
 
59
65
  LIBRARY_SUFFIX =
60
66
  if macos? then 'dylib'
61
67
  elsif windows? then 'dll'
62
- else 'so'
68
+ else
69
+ 'so'
63
70
  end
64
71
 
65
72
  ORIGINAL_ENV = Hash.new
@@ -211,7 +218,8 @@ module Autobuild
211
218
  if @inherit
212
219
  if name
213
220
  @inherited_variables.include?(name)
214
- else true
221
+ else
222
+ true
215
223
  end
216
224
  end
217
225
  end
@@ -245,7 +253,8 @@ module Autobuild
245
253
  flag =
246
254
  if !names.last.respond_to?(:to_str)
247
255
  names.pop
248
- else true
256
+ else
257
+ true
249
258
  end
250
259
 
251
260
  if flag
@@ -342,7 +351,8 @@ module Autobuild
342
351
  inherited_environment[name] || []
343
352
  elsif inheritance_mode == :keep && inherit?(name)
344
353
  ["$#{name}"]
345
- else []
354
+ else
355
+ []
346
356
  end
347
357
 
348
358
  value = []
@@ -439,7 +449,8 @@ module Autobuild
439
449
  if file
440
450
  @source_before << { file: file, shell: shell }
441
451
  source_before(shell: shell) # for backwards compatibility
442
- else @source_before.select { |pair| pair[:shell] == shell }
452
+ else
453
+ @source_before.select { |pair| pair[:shell] == shell }
443
454
  .map { |item| item[:file] }
444
455
  end
445
456
  end
@@ -457,7 +468,8 @@ module Autobuild
457
468
  if file
458
469
  @source_after << { file: file, shell: shell }
459
470
  source_after(shell: shell) # for backwards compatibility
460
- else @source_after.select { |pair| pair[:shell] == shell }
471
+ else
472
+ @source_after.select { |pair| pair[:shell] == shell }
461
473
  .map { |item| item[:file] }
462
474
  end
463
475
  end
@@ -542,7 +554,8 @@ module Autobuild
542
554
  with_inheritance = with_inheritance.map do |value|
543
555
  if value == variable_expansion
544
556
  base_env[name]
545
- else value
557
+ else
558
+ value
546
559
  end
547
560
  end
548
561
  result[name] = with_inheritance.join(File::PATH_SEPARATOR)
@@ -604,7 +617,8 @@ module Autobuild
604
617
  @arch_size ||=
605
618
  if RbConfig::CONFIG['host_cpu'] =~ /64/
606
619
  64
607
- else 32
620
+ else
621
+ 32
608
622
  end
609
623
  @arch_size
610
624
  end
@@ -633,12 +647,73 @@ module Autobuild
633
647
  add_prefix(newprefix, includes)
634
648
  end
635
649
 
650
+ def default_cmake_search_globs(prefix, *file_globs)
651
+ lib_globs = %w[lib]
652
+
653
+ case arch_size
654
+ when 32
655
+ lib_globs << "lib32"
656
+ lib_globs << "libx32"
657
+ when 64
658
+ lib_globs << "lib64"
659
+ end
660
+
661
+ unless arch_names.empty?
662
+ arch_names.each do |arch_name|
663
+ lib_globs << File.join("lib", arch_name)
664
+ end
665
+ end
666
+
667
+ lib_share_glob = "{#{lib_globs.join(',')},share}"
668
+ file_glob = "{#{file_globs.join(',')}}"
669
+
670
+ # Reference: https://cmake.org/cmake/help/latest/command/find_package.html
671
+ #
672
+ # <prefix>/ (W)
673
+ # <prefix>/(cmake|CMake)/ (W)
674
+ # <prefix>/<name>*/ (W)
675
+ # <prefix>/<name>*/(cmake|CMake)/ (W)
676
+ # <prefix>/(lib/<arch>|lib*|share)/cmake/<name>*/ (U)
677
+ # <prefix>/(lib/<arch>|lib*|share)/<name>*/ (U)
678
+ # <prefix>/(lib/<arch>|lib*|share)/<name>*/(cmake|CMake)/ (U)
679
+ # <prefix>/<name>*/(lib/<arch>|lib*|share)/cmake/<name>*/ (W/U)
680
+ # <prefix>/<name>*/(lib/<arch>|lib*|share)/<name>*/ (W/U)
681
+ # <prefix>/<name>*/(lib/<arch>|lib*|share)/<name>*/(cmake|CMake)/ (W/U)
682
+ [
683
+ File.join(prefix, file_glob),
684
+ File.join(prefix, "{cmake,CMake}", file_glob),
685
+ File.join(prefix, "*", file_glob),
686
+ File.join(prefix, "*", "{cmake/CMake}", file_glob),
687
+ File.join(prefix, lib_share_glob, "cmake", "*", file_glob),
688
+ File.join(prefix, lib_share_glob, "*", file_glob),
689
+ File.join(prefix, lib_share_glob, "*", "{cmake,CMake}", file_glob),
690
+ File.join(prefix, "*", lib_share_glob, "cmake", "*", file_glob),
691
+ File.join(prefix, "*", lib_share_glob, "*", file_glob),
692
+ File.join(prefix, "*", lib_share_glob, "*", "{cmake,CMake}", file_glob)
693
+ ]
694
+ end
695
+
696
+ def has_cmake_files?(prefix, *file_globs)
697
+ default_cmake_search_globs(prefix, *file_globs).each do |glob_path|
698
+ return true unless Dir[glob_path].empty?
699
+ end
700
+ false
701
+ end
702
+
636
703
  PKGCONFIG_PATH_RX = %r{.*/((?:lib|lib64|share)/.*)}.freeze
637
704
 
705
+ def pkgconfig_tool_path
706
+ @pkgconfig_tool_path ||= Autobuild.tool_in_path("pkg-config", env: self)
707
+ rescue ArgumentError
708
+ nil
709
+ end
710
+
638
711
  # Returns the system-wide search path that is embedded in pkg-config
639
712
  def default_pkgconfig_search_suffixes
713
+ return [] unless pkgconfig_tool_path
714
+
640
715
  @default_pkgconfig_search_suffixes ||=
641
- `LANG=C #{Autobuild.tool("pkg-config")} --variable pc_path pkg-config`
716
+ `LANG=C #{pkgconfig_tool_path} --variable pc_path pkg-config`
642
717
  .strip
643
718
  .split(":")
644
719
  .grep(PKGCONFIG_PATH_RX)
@@ -670,6 +745,16 @@ module Autobuild
670
745
  end
671
746
  end
672
747
 
748
+ cmake_pairs = []
749
+ cmake_pairs << ["CMAKE_PREFIX_PATH", ["*-config.cmake", "*Config.cmake"]]
750
+ cmake_pairs << ["CMAKE_MODULE_PATH", ["Find*.cmake"]]
751
+ cmake_pairs.each do |cmake_var, cmake_file_globs|
752
+ if !includes || includes.include?(cmake_var)
753
+ has_cmake = has_cmake_files?(newprefix, *cmake_file_globs)
754
+ add_path(cmake_var, newprefix) if has_cmake
755
+ end
756
+ end
757
+
673
758
  # Validate the new rubylib path
674
759
  if !includes || includes.include?('RUBYLIB')
675
760
  new_rubylib = "#{newprefix}/lib"
@@ -33,7 +33,8 @@ module Autobuild
33
33
  target_name =
34
34
  if target.respond_to?(:name)
35
35
  target.name
36
- else target.to_str
36
+ else
37
+ target.to_str
37
38
  end
38
39
 
39
40
  if target && phase
@@ -529,7 +529,8 @@ module Autobuild
529
529
 
530
530
  if mode == Zip
531
531
  main_dir = if @options[:no_subdirectory] then package.srcdir
532
- else base_dir
532
+ else
533
+ base_dir
533
534
  end
534
535
 
535
536
  FileUtils.mkdir_p base_dir
@@ -40,7 +40,8 @@ module Autobuild
40
40
  @default_alternates = cache_dirs.map do |path|
41
41
  File.join(File.expand_path(path), '%s')
42
42
  end
43
- else Array.new
43
+ else
44
+ Array.new
44
45
  end
45
46
  end
46
47
  end
@@ -764,7 +765,8 @@ module Autobuild
764
765
  rescue SubcommandFailed => e
765
766
  if e.status == 1
766
767
  false
767
- else raise
768
+ else
769
+ raise
768
770
  end
769
771
  end
770
772
 
@@ -775,7 +777,8 @@ module Autobuild
775
777
  rescue SubcommandFailed => e
776
778
  if e.status == 1
777
779
  false
778
- else raise
780
+ else
781
+ raise
779
782
  end
780
783
  end
781
784
 
@@ -1020,7 +1023,8 @@ module Autobuild
1020
1023
  File.readlines(alternates_path)
1021
1024
  .map(&:strip)
1022
1025
  .find_all { |l| !l.empty? }
1023
- else Array.new
1026
+ else
1027
+ Array.new
1024
1028
  end
1025
1029
 
1026
1030
  alternates = each_alternate_path(package).map do |path|
@@ -202,7 +202,8 @@ module Autobuild
202
202
  # Try svn upgrade and info again
203
203
  run_svn(package, 'upgrade', retry: false)
204
204
  svninfo = run_svn(package, 'info')
205
- else raise
205
+ else
206
+ raise
206
207
  end
207
208
  end
208
209
 
@@ -357,7 +357,8 @@ module Autobuild
357
357
  message = Autobuild.color('interrupted', :red)
358
358
  if last_error
359
359
  raise last_error
360
- else raise
360
+ else
361
+ raise
361
362
  end
362
363
  rescue ::Exception => e
363
364
  message = Autobuild.color('update failed', :red)
@@ -410,7 +411,8 @@ module Autobuild
410
411
  execute_post_hooks(package)
411
412
  rescue Interrupt
412
413
  if last_error then raise last_error
413
- else raise
414
+ else
415
+ raise
414
416
  end
415
417
  rescue ::Exception => e
416
418
  last_error = e
@@ -119,7 +119,8 @@ module Autobuild
119
119
  def update?
120
120
  if @update.nil?
121
121
  Autobuild.do_update
122
- else @update
122
+ else
123
+ @update
123
124
  end
124
125
  end
125
126
 
@@ -287,6 +288,11 @@ module Autobuild
287
288
  add_env_op EnvOp.new(:add_prefix, prefix, [includes])
288
289
  end
289
290
 
291
+ # Add a file to be sourced at the end of the generated env file
292
+ def env_source_after(file, shell: "sh")
293
+ add_env_op EnvOp.new(:source_after, file, shell: shell)
294
+ end
295
+
290
296
  # Hook called by autoproj to set up the default environment for this
291
297
  # package
292
298
  #
@@ -327,7 +333,11 @@ module Autobuild
327
333
  set[env_op.name] = [self, env_op.values]
328
334
  end
329
335
  end
330
- env.send(env_op.type, env_op.name, *env_op.values)
336
+ if env_op.type == :source_after
337
+ env.send(env_op.type, env_op.name, **env_op.values)
338
+ else
339
+ env.send(env_op.type, env_op.name, *env_op.values)
340
+ end
331
341
  ops << env_op
332
342
  end
333
343
  ops
@@ -492,7 +502,8 @@ module Autobuild
492
502
  suffix << token.gsub(/%s/, name)
493
503
  elsif suffix.empty?
494
504
  prefix << token
495
- else suffix << token
505
+ else
506
+ suffix << token
496
507
  end
497
508
  end
498
509
  if suffix.empty?
@@ -206,7 +206,8 @@ module Autobuild
206
206
  varname, = o.split("=").first
207
207
  if (current_flag = testflags.find { |fl| fl =~ /^#{varname}=/ })
208
208
  current_flag != o
209
- else false
209
+ else
210
+ false
210
211
  end
211
212
  end
212
213
  end
@@ -440,7 +440,8 @@ module Autobuild
440
440
  def show_make_messages?
441
441
  if !@show_make_messages.nil?
442
442
  @show_make_messages
443
- else CMake.show_make_messages?
443
+ else
444
+ CMake.show_make_messages?
444
445
  end
445
446
  end
446
447
 
@@ -27,12 +27,14 @@ module Autobuild
27
27
 
28
28
  def prepare_for_forced_build
29
29
  super
30
- FileUtils.rm_f configurestamp
31
30
  @forced = true
32
31
  end
33
32
 
34
33
  def generate_build_command
35
- command = ['python', 'setup.py', 'build']
34
+ command = %w[python setup.py]
35
+ command << "egg_info"
36
+ command << "--egg-base=#{builddir}"
37
+ command << "build"
36
38
  command << "--build-base=#{builddir}"
37
39
  command += buildflags.flatten
38
40
  command
@@ -42,25 +44,35 @@ module Autobuild
42
44
  command = generate_build_command
43
45
  command << 'install'
44
46
  command << "--prefix=#{prefix}"
47
+ command << "--record=#{builddir}/install.log"
48
+ command << "--single-version-externally-managed"
45
49
  command += installflags.flatten
46
50
  command
47
51
  end
48
52
 
49
- def python_path
53
+ def self.user_site(prefix)
54
+ return File.join(prefix, @user_site) if @user_site
55
+
50
56
  begin
51
- _, output, _, ret = Open3.popen3({ 'PYTHONUSERBASE' => prefix },
52
- 'python -m site --user-site')
57
+ env = Autobuild.env.resolved_env.merge({ 'PYTHONUSERBASE' => "/" })
58
+ _, output, _, ret = Open3.popen3(env, 'python -m site --user-site')
53
59
  rescue Exception => e
54
60
  raise "Unable to set PYTHONPATH: #{e.message}"
55
61
  end
56
62
 
57
63
  if ret.value.success?
58
- output.read.chomp
64
+ @user_site = Pathname.new(output.read.chomp)
65
+ .relative_path_from(Pathname.new("/"))
66
+ File.join(prefix, @user_site)
59
67
  else
60
68
  raise 'Unable to set PYTHONPATH: user site directory disabled?'
61
69
  end
62
70
  end
63
71
 
72
+ def python_path
73
+ self.class.user_site(prefix)
74
+ end
75
+
64
76
  # Do the build in builddir
65
77
  def build
66
78
  return unless install_mode?
@@ -88,7 +88,8 @@ module Autobuild
88
88
  if task.respond_to?(:package)
89
89
  started_packages[task.package] ||= -started_packages.size
90
90
  queue[task] = started_packages[task.package]
91
- else queue[task] = base_priority
91
+ else
92
+ queue[task] = base_priority
92
93
  end
93
94
  end
94
95
 
@@ -246,7 +246,8 @@ module Autobuild
246
246
  groups.last[1] = (current_group.first..group_end_index)
247
247
  groups << [prefix, [idx, other_idx]]
248
248
  grouping = true
249
- else break
249
+ else
250
+ break
250
251
  end
251
252
  end
252
253
  end
@@ -130,7 +130,8 @@ module Autobuild
130
130
  # :exit if debug is false, or :raise if it is true
131
131
  def self.default_report_on_package_failures
132
132
  if Autobuild.debug then :raise
133
- else :exit
133
+ else
134
+ :exit
134
135
  end
135
136
  end
136
137
 
@@ -163,7 +164,8 @@ module Autobuild
163
164
  raise interrupted_by if interrupted_by
164
165
 
165
166
  e = if errors.size == 1 then errors.first
166
- else CompositeException.new(errors)
167
+ else
168
+ CompositeException.new(errors)
167
169
  end
168
170
  raise e
169
171
  elsif %i[report_silent report].include?(on_package_failures)
@@ -251,7 +251,8 @@ module Autobuild::Subprocess # rubocop:disable Style/ClassAndModuleChildren
251
251
  end
252
252
  logdir = if target.respond_to?(:logdir)
253
253
  target.logdir
254
- else Autobuild.logdir
254
+ else
255
+ Autobuild.logdir
255
256
  end
256
257
 
257
258
  if target.respond_to?(:working_directory)
@@ -271,7 +272,8 @@ module Autobuild::Subprocess # rubocop:disable Style/ClassAndModuleChildren
271
272
 
272
273
  open_flag = if Autobuild.keep_oldlogs then 'a'
273
274
  elsif Autobuild.registered_logfile?(logname) then 'a'
274
- else 'w'
275
+ else
276
+ 'w'
275
277
  end
276
278
  open_flag << ":BINARY"
277
279
 
@@ -461,7 +463,8 @@ module Autobuild::Subprocess # rubocop:disable Style/ClassAndModuleChildren
461
463
  error = Autobuild::SubcommandFailed.new(target, command.join(" "),
462
464
  logname, e.status, subcommand_output)
463
465
  error.retry = if e.retry?.nil? then options[:retry]
464
- else e.retry?
466
+ else
467
+ e.retry?
465
468
  end
466
469
  error.phase = phase
467
470
  raise error, e.message
@@ -24,7 +24,8 @@ module Autobuild
24
24
  def coverage_enabled?
25
25
  if @coverage_enabled.nil?
26
26
  TestUtility.coverage_enabled?
27
- else @coverage_enabled
27
+ else
28
+ @coverage_enabled
28
29
  end
29
30
  end
30
31
 
@@ -53,7 +54,8 @@ module Autobuild
53
54
  if @coverage_source_dir
54
55
  relative = if package.respond_to?(:builddir)
55
56
  package.builddir
56
- else package.srcdir
57
+ else
58
+ package.srcdir
57
59
  end
58
60
  File.expand_path(@coverage_source_dir, relative)
59
61
  end
@@ -1,3 +1,3 @@
1
1
  module Autobuild
2
- VERSION = "1.22.1".freeze unless defined? Autobuild::VERSION
2
+ VERSION = "1.23.0".freeze unless defined? Autobuild::VERSION
3
3
  end
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.22.1
4
+ version: 1.23.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: 2021-09-09 00:00:00.000000000 Z
11
+ date: 2022-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -277,7 +277,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
277
277
  - !ruby/object:Gem::Version
278
278
  version: '0'
279
279
  requirements: []
280
- rubygems_version: 3.1.2
280
+ rubygems_version: 3.1.6
281
281
  signing_key:
282
282
  specification_version: 4
283
283
  summary: Library to handle build systems and import mechanisms