autoproj 1.8.4 → 1.8.5

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ = Version 1.8.5
2
+ * osdeps: the apt-dpkg was interpreting removed-but-not-purged as installed.
3
+ Fix.
4
+ * osdeps: fix autoproj osdeps --show
5
+
1
6
  = Version 1.8.4
2
7
  * fix wrong order for application of overrides.rb (was: most specific to more
3
8
  general).
@@ -322,7 +322,10 @@ fi
322
322
  # Package manager interface for systems that use APT and dpkg for
323
323
  # package management
324
324
  class AptDpkgManager < ShellScriptManager
325
- def initialize
325
+ attr_accessor :status_file
326
+
327
+ def initialize(status_file = "/var/lib/dpkg/status")
328
+ @status_file = status_file
326
329
  super(['apt-dpkg'], true,
327
330
  "apt-get install '%s'",
328
331
  "export DEBIAN_FRONTEND=noninteractive; apt-get install -y '%s'")
@@ -333,7 +336,8 @@ fi
333
336
  def installed?(package_name)
334
337
  if !@installed_packages
335
338
  @installed_packages = Set.new
336
- dpkg_status = File.readlines('/var/lib/dpkg/status')
339
+ dpkg_status = File.readlines(status_file)
340
+ dpkg_status << ""
337
341
 
338
342
  current_packages = []
339
343
  is_installed = false
@@ -344,9 +348,9 @@ fi
344
348
  current_packages.each do |pkg|
345
349
  @installed_packages << pkg
346
350
  end
347
- current_packages.clear
348
351
  is_installed = false
349
352
  end
353
+ current_packages.clear
350
354
  elsif line =~ /Package: (.*)$/
351
355
  current_packages << $1
352
356
  elsif line =~ /Provides: (.*)$/
@@ -1664,26 +1664,17 @@ export PATH=$GEM_HOME/bin:$PATH
1664
1664
  next
1665
1665
  end
1666
1666
 
1667
- osdeps, gems = Autoproj.osdeps.
1668
- partition_packages(pkg_osdeps)
1669
-
1670
- puts " #{pkg_name}:"
1671
- if !gems.empty?
1672
- puts " RubyGem packages: #{gems.to_a.sort.join(", ")}"
1673
- end
1674
-
1675
- # If we are on a supported OS, convert the osdeps name to plain
1676
- # package name
1677
- if Autoproj::OSDependencies.supported_operating_system?
1678
- pkg_osdeps = Autoproj.osdeps.
1679
- resolve_os_dependencies(osdeps)
1680
-
1681
- if !pkg_osdeps.empty?
1682
- puts " OS packages: #{pkg_osdeps.to_a.sort.join(", ")}"
1683
- end
1684
- else
1685
- if !os_packages.empty?
1686
- puts " OS dependencies: #{os_packages.to_a.sort.join(", ")}"
1667
+ packages = Autoproj.osdeps.resolve_os_dependencies(pkg_osdeps)
1668
+ puts pkg_name
1669
+ packages.each do |handler, packages|
1670
+ puts " #{handler.name}: #{packages.sort.join(", ")}"
1671
+ needs_update = handler.filter_uptodate_packages(packages)
1672
+ if needs_update.to_set != packages.to_set
1673
+ if needs_update.empty?
1674
+ puts " all packages are up to date"
1675
+ else
1676
+ puts " needs updating: #{needs_update.sort.join(", ")}"
1677
+ end
1687
1678
  end
1688
1679
  end
1689
1680
  end
@@ -1660,9 +1660,12 @@ module Autoproj
1660
1660
  result
1661
1661
  end
1662
1662
 
1663
- # Resolves all the source-based dependencies of this package (excluding
1664
- # the OS dependencies). The result is returned as a set of package
1665
- # names.
1663
+ # Resolves all the source package dependencies for given packages
1664
+ #
1665
+ # @param [Set<String>] the set of package names of which we want to
1666
+ # discover the dependencies
1667
+ # @return [Set<String>] the set of all package names that the packages designed
1668
+ # by root_names depend on
1666
1669
  def resolve_packages_dependencies(*root_names)
1667
1670
  result = Set.new
1668
1671
  queue = root_names.dup
@@ -223,7 +223,10 @@ fi
223
223
  # Package manager interface for systems that use APT and dpkg for
224
224
  # package management
225
225
  class AptDpkgManager < ShellScriptManager
226
- def initialize
226
+ attr_accessor :status_file
227
+
228
+ def initialize(status_file = "/var/lib/dpkg/status")
229
+ @status_file = status_file
227
230
  super(['apt-dpkg'], true,
228
231
  "apt-get install '%s'",
229
232
  "export DEBIAN_FRONTEND=noninteractive; apt-get install -y '%s'")
@@ -234,7 +237,8 @@ fi
234
237
  def installed?(package_name)
235
238
  if !@installed_packages
236
239
  @installed_packages = Set.new
237
- dpkg_status = File.readlines('/var/lib/dpkg/status')
240
+ dpkg_status = File.readlines(status_file)
241
+ dpkg_status << ""
238
242
 
239
243
  current_packages = []
240
244
  is_installed = false
@@ -245,9 +249,9 @@ fi
245
249
  current_packages.each do |pkg|
246
250
  @installed_packages << pkg
247
251
  end
248
- current_packages.clear
249
252
  is_installed = false
250
253
  end
254
+ current_packages.clear
251
255
  elsif line =~ /Package: (.*)$/
252
256
  current_packages << $1
253
257
  elsif line =~ /Provides: (.*)$/
@@ -1,3 +1,3 @@
1
1
  module Autoproj
2
- VERSION = "1.8.4"
2
+ VERSION = "1.8.5"
3
3
  end
@@ -0,0 +1,32 @@
1
+ $LOAD_PATH.unshift File.expand_path('../lib', File.dirname(__FILE__))
2
+ require 'test/unit'
3
+ require 'autoproj'
4
+ require 'flexmock/test_unit'
5
+
6
+ class TC_OSDependencies_AptDpkgManager < Test::Unit::TestCase
7
+ def test_status_file_parsing
8
+ file = File.expand_path("apt-dpkg-status", File.dirname(__FILE__))
9
+ mng = Autoproj::PackageManagers::AptDpkgManager.new(file)
10
+ assert mng.installed?('installed-package')
11
+ assert !mng.installed?('noninstalled-package')
12
+ end
13
+
14
+ def test_status_file_parsing_last_entry_installed
15
+ file = File.expand_path("apt-dpkg-status.installed-last", File.dirname(__FILE__))
16
+ mng = Autoproj::PackageManagers::AptDpkgManager.new(file)
17
+ assert mng.installed?('installed-package')
18
+ end
19
+
20
+ def test_status_file_parsing_last_entry_not_installed
21
+ file = File.expand_path("apt-dpkg-status.noninstalled-last", File.dirname(__FILE__))
22
+ mng = Autoproj::PackageManagers::AptDpkgManager.new(file)
23
+ assert !mng.installed?('noninstalled-package')
24
+ end
25
+
26
+ def test_status_file_parsing_not_there_means_not_installed
27
+ file = File.expand_path("apt-dpkg-status.noninstalled-last", File.dirname(__FILE__))
28
+ mng = Autoproj::PackageManagers::AptDpkgManager.new(file)
29
+ assert !mng.installed?('non-existent-package')
30
+ end
31
+ end
32
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autoproj
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.4
4
+ version: 1.8.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-24 00:00:00.000000000 Z
12
+ date: 2012-11-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: autobuild
16
- requirement: &8808800 !ruby/object:Gem::Requirement
16
+ requirement: &4950240 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.6.0.rc1
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *8808800
24
+ version_requirements: *4950240
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: utilrb
27
- requirement: &8807920 !ruby/object:Gem::Requirement
27
+ requirement: &4949280 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.6.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *8807920
35
+ version_requirements: *4949280
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: highline
38
- requirement: &8806520 !ruby/object:Gem::Requirement
38
+ requirement: &4948160 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.5.0
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *8806520
46
+ version_requirements: *4948160
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rdoc
49
- requirement: &8805840 !ruby/object:Gem::Requirement
49
+ requirement: &4947120 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '3.10'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *8805840
57
+ version_requirements: *4947120
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: hoe
60
- requirement: &8804940 !ruby/object:Gem::Requirement
60
+ requirement: &4946340 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '3.3'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *8804940
68
+ version_requirements: *4946340
69
69
  description: autoproj is a manager for sets of software packages. It allows the user
70
70
  to import and build packages from source, still using the underlying distribution's
71
71
  native package manager for software that is available on it.
@@ -139,6 +139,7 @@ files:
139
139
  - test/test_manifest.rb
140
140
  - test/test_os_dependencies.rb
141
141
  - test/test_package_manifest.rb
142
+ - test/package_managers/test_apt_dpkg_manager.rb
142
143
  - .gemtest
143
144
  homepage: http://rock-robotics.org/documentation/autoproj
144
145
  licenses: []
@@ -171,4 +172,5 @@ test_files:
171
172
  - test/test_package_manifest.rb
172
173
  - test/test_os_dependencies.rb
173
174
  - test/test_debian.rb
175
+ - test/package_managers/test_apt_dpkg_manager.rb
174
176
  - test/package_managers/test_gem.rb