test-apt-get-install-virtual-pkgs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #!/bin/sh
  2. set -e
  3. TESTDIR="$(readlink -f "$(dirname "$0")")"
  4. . "$TESTDIR/framework"
  5. setupenvironment
  6. configarchitecture 'amd64' 'i386'
  7. insertpackage 'unstable' 'foo' 'amd64' '1' 'Provides: foo-prv'
  8. insertpackage 'unstable' 'baz1' 'amd64' '1' 'Provides: foo-prv1'
  9. insertpackage 'unstable' 'foo1' 'amd64' '1' 'Provides: foo-prv1'
  10. insertpackage 'unstable' 'baz2' 'amd64' '1' 'Provides: foo-prv2'
  11. insertpackage 'unstable' 'foo2' 'amd64' '2' 'Provides: foo-prv2:amd64'
  12. insertpackage 'unstable' 'baz3' 'amd64' '1' 'Provides: foo-prv3'
  13. insertpackage 'unstable' 'foo3' 'i386' '2' 'Provides: foo-prv3:amd64'
  14. insertpackage 'unstable' 'baz4' 'amd64' '1' 'Provides: foo-prv4:amd64'
  15. insertpackage 'unstable' 'foo4' 'i386' '2' 'Provides: foo-prv4:amd64'
  16. insertpackage 'experimental' 'baz5' 'amd64' '1' 'Provides: foo-prv5:amd64'
  17. insertpackage 'experimental' 'foo5' 'i386' '2' 'Provides: foo-prv5:amd64'
  18. setupaptarchive
  19. testsuccessequal "Reading package lists...
  20. Building dependency tree...
  21. Note, selecting 'foo' instead of 'foo-prv'
  22. The following NEW packages will be installed:
  23. foo
  24. 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
  25. Inst foo (1 unstable [amd64])
  26. Conf foo (1 unstable [amd64])" aptget install foo-prv -s
  27. testvirtuals() {
  28. testfailureequal "Reading package lists...
  29. Building dependency tree...
  30. Package $1 is a virtual package provided by:
  31. $3
  32. $2
  33. You should explicitly select one to install.
  34. E: Package '$1' has no installation candidate" aptget install $1 -s
  35. }
  36. testvirtuals 'foo-prv1' 'baz1 1' 'foo1 1'
  37. testvirtuals 'foo-prv2' 'baz2 1' 'foo2 2'
  38. testvirtuals 'foo-prv3' 'baz3 1' 'foo3:i386 2'
  39. testvirtuals 'foo-prv4' 'baz4 1' 'foo4:i386 2'
  40. testvirtuals 'foo-prv5' 'baz5 1' 'foo5:i386 2'
  41. echo 'Package: *
  42. Pin: release a=experimental
  43. Pin-Priority: -1' > rootdir/etc/apt/preferences.d/experimental.pref
  44. testfailureequal "Reading package lists...
  45. Building dependency tree...
  46. Package foo-prv5 is a virtual package provided by:
  47. foo5:i386 2 [Not candidate version]
  48. baz5 1 [Not candidate version]
  49. E: Package 'foo-prv5' has no installation candidate" aptget install foo-prv5 -s