autoproj 1.8.2.b14 → 1.8.2.b15

Sign up to get free protection for your applications and to get access to all the features.
@@ -286,6 +286,31 @@ fi
286
286
  end
287
287
  end
288
288
 
289
+ # Package manager interface for systems that use yum
290
+ class YumManager < ShellScriptManager
291
+ def initialize
292
+ super(['yum'], true,
293
+ "yum install '%s'",
294
+ "yum install -y '%s'")
295
+ end
296
+
297
+ def filter_uptodate_packages(packages)
298
+ result = `LANG=C rpm -q '#{packages.join("' '")}'`
299
+ if $?.exitstatus != 0
300
+ Autoproj.warn "cannot run rpm -q #{packages.join(", ")}. I am assuming that no packages are already installed"
301
+ return packages
302
+ else
303
+ result = []
304
+ result.split("\n").each_with_index do |line, index|
305
+ if line =~ /is not installed/
306
+ result << packages[index]
307
+ end
308
+ end
309
+ result
310
+ end
311
+ end
312
+ end
313
+
289
314
  # Package manager interface for systems that use APT and dpkg for
290
315
  # package management
291
316
  class AptDpkgManager < ShellScriptManager
@@ -574,11 +599,13 @@ fi
574
599
  PACKAGE_HANDLERS = [PackageManagers::AptDpkgManager,
575
600
  PackageManagers::GemManager,
576
601
  PackageManagers::EmergeManager,
577
- PackageManagers::PacmanManager]
602
+ PackageManagers::PacmanManager,
603
+ PackageManagers::YumManager]
578
604
  OS_PACKAGE_HANDLERS = {
579
605
  'debian' => 'apt-dpkg',
580
606
  'gentoo' => 'emerge',
581
- 'arch' => 'pacman'
607
+ 'arch' => 'pacman',
608
+ 'fedora' => 'yum'
582
609
  }
583
610
 
584
611
  # The information contained in the OSdeps files, as a hash
@@ -784,6 +811,11 @@ fi
784
811
  versions = codenames + ["unstable", "sid"]
785
812
  end
786
813
  [['debian'], versions]
814
+ elsif File.exists?('/etc/fedora-release')
815
+ release_string = File.read('/etc/fedora-release').strip
816
+ release_string =~ /Fedora release (\d+)/
817
+ version = $1
818
+ [['fedora'], [version]]
787
819
  elsif File.exists?('/etc/gentoo-release')
788
820
  release_string = File.read('/etc/gentoo-release').strip
789
821
  release_string =~ /^.*([^\s]+)$/
@@ -948,6 +980,7 @@ fi
948
980
  #
949
981
  def partition_osdep_entry(osdep_name, dep_def, handler_names, excluded, *keys)
950
982
  keys, *additional_keys = *keys
983
+ keys ||= []
951
984
  found = false
952
985
  nonexistent = false
953
986
  result = []
@@ -979,7 +1012,7 @@ fi
979
1012
  end
980
1013
  result.concat(rec_result)
981
1014
  end
982
- elsif keys
1015
+ else
983
1016
  if names.respond_to?(:to_str) # names could be an array already
984
1017
  names = names.split(',')
985
1018
  end
@@ -187,6 +187,31 @@ fi
187
187
  end
188
188
  end
189
189
 
190
+ # Package manager interface for systems that use yum
191
+ class YumManager < ShellScriptManager
192
+ def initialize
193
+ super(['yum'], true,
194
+ "yum install '%s'",
195
+ "yum install -y '%s'")
196
+ end
197
+
198
+ def filter_uptodate_packages(packages)
199
+ result = `LANG=C rpm -q '#{packages.join("' '")}'`
200
+ if $?.exitstatus != 0
201
+ Autoproj.warn "cannot run rpm -q #{packages.join(", ")}. I am assuming that no packages are already installed"
202
+ return packages
203
+ else
204
+ result = []
205
+ result.split("\n").each_with_index do |line, index|
206
+ if line =~ /is not installed/
207
+ result << packages[index]
208
+ end
209
+ end
210
+ result
211
+ end
212
+ end
213
+ end
214
+
190
215
  # Package manager interface for systems that use APT and dpkg for
191
216
  # package management
192
217
  class AptDpkgManager < ShellScriptManager
@@ -475,11 +500,13 @@ fi
475
500
  PACKAGE_HANDLERS = [PackageManagers::AptDpkgManager,
476
501
  PackageManagers::GemManager,
477
502
  PackageManagers::EmergeManager,
478
- PackageManagers::PacmanManager]
503
+ PackageManagers::PacmanManager,
504
+ PackageManagers::YumManager]
479
505
  OS_PACKAGE_HANDLERS = {
480
506
  'debian' => 'apt-dpkg',
481
507
  'gentoo' => 'emerge',
482
- 'arch' => 'pacman'
508
+ 'arch' => 'pacman',
509
+ 'fedora' => 'yum'
483
510
  }
484
511
 
485
512
  # The information contained in the OSdeps files, as a hash
@@ -685,6 +712,11 @@ fi
685
712
  versions = codenames + ["unstable", "sid"]
686
713
  end
687
714
  [['debian'], versions]
715
+ elsif File.exists?('/etc/fedora-release')
716
+ release_string = File.read('/etc/fedora-release').strip
717
+ release_string =~ /Fedora release (\d+)/
718
+ version = $1
719
+ [['fedora'], [version]]
688
720
  elsif File.exists?('/etc/gentoo-release')
689
721
  release_string = File.read('/etc/gentoo-release').strip
690
722
  release_string =~ /^.*([^\s]+)$/
@@ -849,6 +881,7 @@ fi
849
881
  #
850
882
  def partition_osdep_entry(osdep_name, dep_def, handler_names, excluded, *keys)
851
883
  keys, *additional_keys = *keys
884
+ keys ||= []
852
885
  found = false
853
886
  nonexistent = false
854
887
  result = []
@@ -880,7 +913,7 @@ fi
880
913
  end
881
914
  result.concat(rec_result)
882
915
  end
883
- elsif keys
916
+ else
884
917
  if names.respond_to?(:to_str) # names could be an array already
885
918
  names = names.split(',')
886
919
  end
@@ -1,3 +1,3 @@
1
1
  module Autoproj
2
- VERSION = "1.8.2.b14"
2
+ VERSION = "1.8.2.b15"
3
3
  end
@@ -342,6 +342,20 @@ class TC_OSDependencies < Test::Unit::TestCase
342
342
  assert_equal expected, osdeps.resolve_package('pkg')
343
343
  end
344
344
 
345
+ def test_resolve_mixed_os_and_osindep_dependencies
346
+ data = { 'pkg' =>
347
+ { 'test' => { 'default' => ['ospkg', 'gem' => 'gempkg'] }
348
+ }
349
+ }
350
+
351
+ osdeps = create_osdep(data)
352
+ expected = [
353
+ [osdeps.os_package_handler, FOUND_PACKAGES, ['ospkg']],
354
+ [osdeps.package_handlers['gem'], FOUND_PACKAGES, ['gempkg']]
355
+ ].to_set
356
+ assert_equal expected, osdeps.resolve_package('pkg').to_set
357
+ end
358
+
345
359
  def test_availability_of
346
360
  osdeps = flexmock(OSDependencies.new)
347
361
  osdeps.should_receive(:resolve_package).with('pkg0').once.and_return(
@@ -426,7 +440,7 @@ class TC_OSDependencies < Test::Unit::TestCase
426
440
  osdeps.should_receive(:resolve_package).with('pkg0').once.and_return(nil)
427
441
  osdeps.should_receive(:resolve_package).with('pkg1').never
428
442
  osdeps.should_receive(:resolve_package).with('pkg2').never
429
- assert_raises(ConfigError) { osdeps.resolve_os_dependencies(['pkg0', 'pkg1', 'pkg2']) }
443
+ assert_raises(Autoproj::OSDependencies::MissingOSDep) { osdeps.resolve_os_dependencies(['pkg0', 'pkg1', 'pkg2']) }
430
444
 
431
445
  osdeps.should_receive(:resolve_package).with('pkg0').once.and_return(
432
446
  [[osdeps.os_package_handler, FOUND_PACKAGES, ['pkg0']]])
@@ -437,13 +451,13 @@ class TC_OSDependencies < Test::Unit::TestCase
437
451
  expected =
438
452
  [[osdeps.os_package_handler, ['pkg0']],
439
453
  [osdeps.package_handlers['gem'], ['gempkg1', 'gempkg2']]]
440
- assert_raises(ConfigError) { osdeps.resolve_os_dependencies(['pkg0', 'pkg1', 'pkg2']) }
454
+ assert_raises(Autoproj::OSDependencies::MissingOSDep) { osdeps.resolve_os_dependencies(['pkg0', 'pkg1', 'pkg2']) }
441
455
 
442
456
  osdeps.should_receive(:resolve_package).with('pkg0').once.and_return(
443
457
  [[osdeps.os_package_handler, FOUND_NONEXISTENT, ['pkg0']]])
444
458
  osdeps.should_receive(:resolve_package).with('pkg1').never
445
459
  osdeps.should_receive(:resolve_package).with('pkg2').never
446
- assert_raises(ConfigError) { osdeps.resolve_os_dependencies(['pkg0', 'pkg1', 'pkg2']) }
460
+ assert_raises(Autoproj::OSDependencies::MissingOSDep) { osdeps.resolve_os_dependencies(['pkg0', 'pkg1', 'pkg2']) }
447
461
 
448
462
  osdeps.should_receive(:resolve_package).with('pkg0').once.and_return(
449
463
  [[osdeps.os_package_handler, FOUND_PACKAGES, ['pkg0']]])
@@ -451,7 +465,7 @@ class TC_OSDependencies < Test::Unit::TestCase
451
465
  [[osdeps.os_package_handler, FOUND_PACKAGES, ['pkg1']],
452
466
  [osdeps.package_handlers['gem'], FOUND_NONEXISTENT, ['gempkg1']]])
453
467
  osdeps.should_receive(:resolve_package).with('pkg2').never
454
- assert_raises(ConfigError) { osdeps.resolve_os_dependencies(['pkg0', 'pkg1', 'pkg2']) }
468
+ assert_raises(Autoproj::OSDependencies::MissingOSDep) { osdeps.resolve_os_dependencies(['pkg0', 'pkg1', 'pkg2']) }
455
469
  end
456
470
 
457
471
  def test_install
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.2.b14
4
+ version: 1.8.2.b15
5
5
  prerelease: 6
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-10-08 00:00:00.000000000 Z
12
+ date: 2012-10-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: autobuild
16
- requirement: &10131280 !ruby/object:Gem::Requirement
16
+ requirement: &9121940 !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: *10131280
24
+ version_requirements: *9121940
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: utilrb
27
- requirement: &10130560 !ruby/object:Gem::Requirement
27
+ requirement: &9120560 !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: *10130560
35
+ version_requirements: *9120560
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: highline
38
- requirement: &10129760 !ruby/object:Gem::Requirement
38
+ requirement: &9119700 !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: *10129760
46
+ version_requirements: *9119700
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rdoc
49
- requirement: &10128640 !ruby/object:Gem::Requirement
49
+ requirement: &9118900 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,18 +54,18 @@ dependencies:
54
54
  version: '3.10'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *10128640
57
+ version_requirements: *9118900
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: hoe
60
- requirement: &10114260 !ruby/object:Gem::Requirement
60
+ requirement: &9118180 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
64
64
  - !ruby/object:Gem::Version
65
- version: '3.0'
65
+ version: '3.1'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *10114260
68
+ version_requirements: *9118180
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.