autoproj 2.0.0.rc30 → 2.0.0.rc31

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 11d96335f45757f964e4ab98d32c1a6a79ef8e5a
4
- data.tar.gz: d391811655bfcedcebb48ab380417ab88ef71752
3
+ metadata.gz: 6f768ab32070ccf5661b6ef7e0713598cc32a2da
4
+ data.tar.gz: 6b9bc19bb4c653887479bdcafc512a7a8a308c19
5
5
  SHA512:
6
- metadata.gz: d95c7ac9bd5637e8fcf4319b233bc194f5c596a61a7bc759969c9753edca2f5e3aa6130be5c513e48c53ac123eee29589fc2ca637ce4b4663da9aeeb0f8918ac
7
- data.tar.gz: ac3ed377140d0715f658bfd81097e2dbc4cabb5c568bcc6b317bf15d197d81ea6040a7e91d2ab0fee16f07295bda0891cce1a5780cc489dc6b9d39ab00f6344b
6
+ metadata.gz: e0b7cb9352271cf11c4fb9f3d945fdafe5f8211dee6edb15c2320dfe7da6bf10c9a18e73ab77be7f1ce7e01979d8172a491738422819989a2a5f2df502e595bd
7
+ data.tar.gz: 3b59fac581a9e8ca86e342bd5799e49b381a6790fef9eb351258c39a653586a282fa54af79e25e6977dfcdc6a490981253ecf672108e91c2fc2bdea153799e60
@@ -394,7 +394,16 @@ def definition_file(package_name)
394
394
  end
395
395
  end
396
396
 
397
+ # @deprecated use {#find_package_definition} instead
397
398
  def find_package(name)
399
+ find_package_definition(name)
400
+ end
401
+
402
+ # The autoproj description of a package by its name
403
+ #
404
+ # @param [String,#name] name the package name
405
+ # @return [PackageDefinition,nil]
406
+ def find_package_definition(name)
398
407
  if name.respond_to?(:name)
399
408
  name = name.name
400
409
  end
@@ -402,16 +411,17 @@ def find_package(name)
402
411
  packages[name.to_str]
403
412
  end
404
413
 
414
+ # The autobuild description of a package by its name
415
+ #
416
+ # @param [String,#name] name the package name
417
+ # @return [Autobuild::Package,nil]
405
418
  def find_autobuild_package(name)
406
- if name.respond_to?(:name)
407
- name = name.name
408
- end
409
-
410
- if pkg = packages[name.to_str]
419
+ if pkg = find_package(name)
411
420
  pkg.autobuild
412
421
  end
413
422
  end
414
423
 
424
+ # @deprecated use {#find_package} instead
415
425
  def package(name)
416
426
  find_package(name)
417
427
  end
@@ -427,9 +437,7 @@ def each_package(&block)
427
437
  #
428
438
  # @yieldparam [PackageDefinition] pkg
429
439
  def each_package_definition(&block)
430
- if !block_given?
431
- return enum_for(:each_package_definition)
432
- end
440
+ return enum_for(__method__) if !block_given?
433
441
  packages.each_value(&block)
434
442
  end
435
443
 
@@ -438,7 +446,7 @@ def each_package_definition(&block)
438
446
  # @yieldparam [Autobuild::Package] pkg
439
447
  def each_autobuild_package
440
448
  return enum_for(__method__) if !block_given?
441
- packages.each_value { |pkg| yield(pkg.autobuild) }
449
+ each_package_definition { |pkg| yield(pkg.autobuild) }
442
450
  end
443
451
 
444
452
  # @deprecated use Ops::Tools.create_autobuild_package or include
@@ -320,15 +320,20 @@ def install(osdep_packages, install_only: false, **options)
320
320
 
321
321
  setup_package_managers(**options)
322
322
 
323
+ managers = package_managers.dup
323
324
  packages = os_package_resolver.resolve_os_packages(osdep_packages)
324
325
  packages = packages.map do |handler_name, list|
325
- if manager = package_managers[handler_name]
326
+ if manager = managers.delete(handler_name)
326
327
  [manager, list]
327
328
  else
328
329
  raise ArgumentError, "no package manager called #{handler_name} found"
329
330
  end
330
331
  end
331
332
 
333
+ managers.each_value do |pkg_manager|
334
+ packages << [pkg_manager, []]
335
+ end
336
+
332
337
  # Install OS packages first, as the other package handlers might
333
338
  # depend on OS packages
334
339
  os_packages, other_packages = packages.partition do |handler, list|
@@ -337,7 +342,7 @@ def install(osdep_packages, install_only: false, **options)
337
342
  [os_packages, other_packages].each do |packages|
338
343
  packages.each do |handler, list|
339
344
  list = list.to_set - installed_resolved_packages[handler]
340
- next if list.empty?
345
+ next if list.empty? && !handler.call_while_empty?
341
346
 
342
347
  handler.install(
343
348
  list.to_a,
@@ -9,8 +9,8 @@ def initialize(ws, status_file = "/var/lib/dpkg/status")
9
9
  @status_file = status_file
10
10
  @installed_packages = nil
11
11
  super(ws, true,
12
- "apt-get install '%s'",
13
- "export DEBIAN_FRONTEND=noninteractive; apt-get install -y '%s'")
12
+ %w{apt-get install},
13
+ %w{DEBIAN_FRONTEND=noninteractive apt-get install -y})
14
14
  end
15
15
 
16
16
  # On a dpkg-enabled system, checks if the provided package is installed
@@ -24,6 +24,11 @@ def self.with_prerelease(*value)
24
24
  end
25
25
  end
26
26
 
27
+ def initialize(ws)
28
+ super
29
+ self.call_while_empty = true
30
+ end
31
+
27
32
  # Filters all paths that come from other autoproj installations out
28
33
  # of GEM_PATH
29
34
  def initialize_environment
@@ -5,8 +5,8 @@ module PackageManagers
5
5
  class EmergeManager < ShellScriptManager
6
6
  def initialize(ws)
7
7
  super(ws, true,
8
- "emerge '%s'",
9
- "emerge --noreplace '%s'")
8
+ %w{emerge},
9
+ %w{emerge --noreplace})
10
10
  end
11
11
  end
12
12
  end
@@ -5,8 +5,8 @@ module PackageManagers
5
5
  class HomebrewManager < ShellScriptManager
6
6
  def initialize(ws)
7
7
  super(ws, true,
8
- "brew install '%s'",
9
- "brew install '%s'",
8
+ %w{brew install},
9
+ %w{brew install},
10
10
  false)
11
11
  end
12
12
 
@@ -16,6 +16,9 @@ def enabled?; !!@enabled end
16
16
  attr_writer :silent
17
17
  def silent?; !!@silent end
18
18
 
19
+ attr_writer :call_while_empty
20
+ def call_while_empty?; !!@call_while_empty end
21
+
19
22
  # Create a package manager registered with various names
20
23
  #
21
24
  # @param [Array<String>] names the package manager names. It MUST be
@@ -25,6 +28,7 @@ def initialize(ws)
25
28
  @ws = ws
26
29
  @enabled = true
27
30
  @silent = true
31
+ @call_while_empty = false
28
32
  end
29
33
 
30
34
  # The primary name for this package manager
@@ -5,8 +5,8 @@ module PackageManagers
5
5
  class PacmanManager < ShellScriptManager
6
6
  def initialize(ws)
7
7
  super(ws, true,
8
- "pacman -Sy --needed '%s'",
9
- "pacman -Sy --needed --noconfirm '%s'")
8
+ %w{pacman -Sy --needed},
9
+ %w{pacman -Sy --needed --noconfirm})
10
10
  end
11
11
  end
12
12
  end
@@ -5,8 +5,8 @@ module PackageManagers
5
5
  class PkgManager < ShellScriptManager
6
6
  def initialize(ws)
7
7
  super(ws, true,
8
- "pkg install -y '%s'",
9
- "pkg install -y '%s'")
8
+ %w{pkg install -y},
9
+ %w{pkg install -y})
10
10
  end
11
11
  end
12
12
  end
@@ -5,8 +5,8 @@ module PackageManagers
5
5
  class PortManager < ShellScriptManager
6
6
  def initialize(ws)
7
7
  super(ws, true,
8
- "port install '%s'",
9
- "port install '%s'")
8
+ %w{port install},
9
+ %w{port install})
10
10
  end
11
11
  end
12
12
  end
@@ -3,7 +3,7 @@ module PackageManagers
3
3
  # Base class for all package managers that simply require the call of a
4
4
  # shell script to install packages (e.g. yum, apt, ...)
5
5
  class ShellScriptManager < Manager
6
- def self.execute(script, with_locking, with_root)
6
+ def self.execute(command_line, with_locking, with_root)
7
7
  if with_locking
8
8
  File.open('/tmp/autoproj_osdeps_lock', 'w') do |lock_io|
9
9
  begin
@@ -11,30 +11,20 @@ def self.execute(script, with_locking, with_root)
11
11
  Autoproj.message " waiting for other autoproj instances to finish their osdeps installation"
12
12
  sleep 5
13
13
  end
14
- return execute(script, false,with_root)
14
+ return execute(command_line, false, with_root)
15
15
  ensure
16
16
  lock_io.flock(File::LOCK_UN)
17
17
  end
18
18
  end
19
19
  end
20
20
 
21
- sudo = Autobuild.tool_in_path('sudo')
22
- Tempfile.open('osdeps_sh') do |io|
23
- io.puts "#! /bin/bash"
24
- io.puts GAIN_ROOT_ACCESS % [sudo] if with_root
25
- io.write script
26
- io.flush
27
- Autobuild::Subprocess.run 'autoproj', 'osdeps', '/bin/bash', io.path
21
+ if with_root
22
+ sudo = Autobuild.tool_in_path('sudo')
23
+ command_line = [sudo, *command_line]
28
24
  end
29
- end
30
-
31
- GAIN_ROOT_ACCESS = <<-EOSCRIPT
32
- # Gain root access using sudo
33
- if test `id -u` != "0"; then
34
- exec %s /bin/bash $0 "$@"
35
25
 
36
- fi
37
- EOSCRIPT
26
+ Autobuild::Subprocess.run 'autoproj', 'osdeps', *command_line
27
+ end
38
28
 
39
29
  # Overrides the {#needs_locking?} flag
40
30
  attr_writer :needs_locking
@@ -110,7 +100,7 @@ def initialize(ws, needs_locking, user_install_cmd, auto_install_cmd,needs_root=
110
100
  # {#user_install_cmd]
111
101
  def generate_user_os_script(os_packages, user_install_cmd: self.user_install_cmd)
112
102
  if user_install_cmd
113
- (user_install_cmd % [os_packages.join("' '")])
103
+ user_install_cmd.join(" ") + " " + os_packages.join("' '")
114
104
  else generate_auto_os_script(os_packages)
115
105
  end
116
106
  end
@@ -125,7 +115,7 @@ def generate_user_os_script(os_packages, user_install_cmd: self.user_install_cmd
125
115
  # If given, it overrides the default value stored in
126
116
  # {#auto_install_cmd]
127
117
  def generate_auto_os_script(os_packages, auto_install_cmd: self.auto_install_cmd)
128
- (auto_install_cmd % [os_packages.join("' '")])
118
+ auto_install_cmd.join(" ") + " " + os_packages.join("' '")
129
119
  end
130
120
 
131
121
  # Handles interaction with the user
@@ -197,7 +187,8 @@ def install(packages, filter_uptodate_packages: false, install_only: false,
197
187
  Autoproj.message "Generating installation script for non-ruby OS dependencies"
198
188
  Autoproj.message shell_script
199
189
  end
200
- ShellScriptManager.execute(shell_script, needs_locking?,needs_root?)
190
+
191
+ ShellScriptManager.execute([*auto_install_cmd, *packages], needs_locking?, needs_root?)
201
192
  return true
202
193
  end
203
194
  false
@@ -4,8 +4,8 @@ module PackageManagers
4
4
  class YumManager < ShellScriptManager
5
5
  def initialize(ws)
6
6
  super(ws, true,
7
- "yum install '%s'",
8
- "yum install -y '%s'")
7
+ %w{yum install},
8
+ %w{yum install -y})
9
9
  end
10
10
 
11
11
  def filter_uptodate_packages(packages)
@@ -4,8 +4,8 @@ module PackageManagers
4
4
  class ZypperManager < ShellScriptManager
5
5
  def initialize(ws)
6
6
  super(ws, true,
7
- "zypper install '%s'",
8
- "zypper -n install '%s'")
7
+ %w{zypper install},
8
+ %w{zypper -n install})
9
9
  end
10
10
 
11
11
  def filter_uptodate_packages(packages)
@@ -1,3 +1,3 @@
1
1
  module Autoproj
2
- VERSION = "2.0.0.rc30"
2
+ VERSION = "2.0.0.rc31"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autoproj
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.rc30
4
+ version: 2.0.0.rc31
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvain Joyeux
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-20 00:00:00.000000000 Z
11
+ date: 2016-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: autobuild