test-apt-get-upgrade 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. #!/bin/sh
  2. set -e
  3. TESTDIR="$(readlink -f "$(dirname "$0")")"
  4. . "$TESTDIR/framework"
  5. setupenvironment
  6. configarchitecture "i386"
  7. # simple case
  8. insertpackage 'stable,installed' 'upgrade-simple' 'all' '1.0'
  9. insertpackage 'unstable' 'upgrade-simple' 'all' '2.0'
  10. # upgrade with a new dependency
  11. insertpackage 'stable,installed' 'upgrade-with-new-dep' 'all' '1.0'
  12. insertpackage 'unstable' 'upgrade-with-new-dep' 'all' '2.0' 'Depends: new-dep'
  13. insertpackage 'stable' 'new-dep' 'all' '1.0'
  14. # upgrade with conflict and a new pkg with higher priority than conflict
  15. insertpackage 'stable,installed' 'upgrade-with-conflict' 'all' '1.0'
  16. insertpackage 'unstable' 'upgrade-with-conflict' 'all' '2.0' 'Conflicts: conflicting-dep' 'standard'
  17. insertpackage 'stable,installed' 'conflicting-dep' 'all' '1.0'
  18. # upgrade with conflict and a new pkg with higher priority than conflict
  19. insertpackage 'stable,installed' 'init' 'all' '1'
  20. insertpackage 'unstable' 'init' 'all' '2' 'Pre-Depends: systemd | sysvinit'
  21. insertpackage 'unstable' 'systemd' 'all' '2' 'Conflicts: conflicting-dep'
  22. insertpackage 'unstable' 'sysvinit' 'all' '2'
  23. setupaptarchive
  24. # Test if normal upgrade works as expected
  25. UPGRADE='Reading package lists...
  26. Building dependency tree...
  27. Calculating upgrade...
  28. The following packages have been kept back:
  29. init upgrade-with-conflict upgrade-with-new-dep
  30. The following packages will be upgraded:
  31. upgrade-simple
  32. 1 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
  33. Inst upgrade-simple [1.0] (2.0 unstable [all])
  34. Conf upgrade-simple (2.0 unstable [all])'
  35. testsuccessequal "$UPGRADE" aptget upgrade -s
  36. testsuccessequal "$UPGRADE" apt upgrade -s --without-new-pkgs
  37. # Test if apt-get upgrade --with-new-pkgs works
  38. UPGRADENEW='Reading package lists...
  39. Building dependency tree...
  40. Calculating upgrade...
  41. The following NEW packages will be installed:
  42. new-dep
  43. The following packages have been kept back:
  44. init upgrade-with-conflict
  45. The following packages will be upgraded:
  46. upgrade-simple upgrade-with-new-dep
  47. 2 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
  48. Inst new-dep (1.0 stable [all])
  49. Inst upgrade-simple [1.0] (2.0 unstable [all])
  50. Inst upgrade-with-new-dep [1.0] (2.0 unstable [all])
  51. Conf new-dep (1.0 stable [all])
  52. Conf upgrade-simple (2.0 unstable [all])
  53. Conf upgrade-with-new-dep (2.0 unstable [all])'
  54. testsuccessequal "$UPGRADENEW" aptget upgrade -s --with-new-pkgs
  55. testsuccessequal "$UPGRADENEW" apt upgrade -s
  56. # Test if apt-get dist-upgrade works
  57. testsuccessequal 'Reading package lists...
  58. Building dependency tree...
  59. Calculating upgrade...
  60. The following packages will be REMOVED:
  61. conflicting-dep
  62. The following NEW packages will be installed:
  63. new-dep systemd
  64. The following packages will be upgraded:
  65. init upgrade-simple upgrade-with-conflict upgrade-with-new-dep
  66. 4 upgraded, 2 newly installed, 1 to remove and 0 not upgraded.
  67. Remv conflicting-dep [1.0]
  68. Inst systemd (2 unstable [all])
  69. Conf systemd (2 unstable [all])
  70. Inst init [1] (2 unstable [all])
  71. Inst upgrade-with-conflict [1.0] (2.0 unstable [all])
  72. Inst new-dep (1.0 stable [all])
  73. Inst upgrade-simple [1.0] (2.0 unstable [all])
  74. Inst upgrade-with-new-dep [1.0] (2.0 unstable [all])
  75. Conf init (2 unstable [all])
  76. Conf upgrade-with-conflict (2.0 unstable [all])
  77. Conf new-dep (1.0 stable [all])
  78. Conf upgrade-simple (2.0 unstable [all])
  79. Conf upgrade-with-new-dep (2.0 unstable [all])' aptget -s dist-upgrade
  80. msgmsg 'make systemd a non-choice in the or-group and try again'
  81. echo 'Package: systemd
  82. Pin: release unstable
  83. Pin-Priority: -1' > rootdir/etc/apt/preferences.d/nosystemd.pref
  84. testsuccessequal "$UPGRADE" aptget upgrade -s
  85. testsuccessequal "$UPGRADE" apt upgrade -s --without-new-pkgs
  86. UPGRADENEW='Reading package lists...
  87. Building dependency tree...
  88. Calculating upgrade...
  89. The following NEW packages will be installed:
  90. new-dep sysvinit
  91. The following packages have been kept back:
  92. upgrade-with-conflict
  93. The following packages will be upgraded:
  94. init upgrade-simple upgrade-with-new-dep
  95. 3 upgraded, 2 newly installed, 0 to remove and 1 not upgraded.
  96. Inst sysvinit (2 unstable [all])
  97. Conf sysvinit (2 unstable [all])
  98. Inst init [1] (2 unstable [all])
  99. Inst new-dep (1.0 stable [all])
  100. Inst upgrade-simple [1.0] (2.0 unstable [all])
  101. Inst upgrade-with-new-dep [1.0] (2.0 unstable [all])
  102. Conf init (2 unstable [all])
  103. Conf new-dep (1.0 stable [all])
  104. Conf upgrade-simple (2.0 unstable [all])
  105. Conf upgrade-with-new-dep (2.0 unstable [all])'
  106. testsuccessequal "$UPGRADENEW" aptget upgrade -s --with-new-pkgs
  107. testsuccessequal "$UPGRADENEW" apt upgrade -s
  108. testsuccessequal 'Reading package lists...
  109. Building dependency tree...
  110. Calculating upgrade...
  111. The following packages will be REMOVED:
  112. conflicting-dep
  113. The following NEW packages will be installed:
  114. new-dep sysvinit
  115. The following packages will be upgraded:
  116. init upgrade-simple upgrade-with-conflict upgrade-with-new-dep
  117. 4 upgraded, 2 newly installed, 1 to remove and 0 not upgraded.
  118. Remv conflicting-dep [1.0]
  119. Inst sysvinit (2 unstable [all])
  120. Conf sysvinit (2 unstable [all])
  121. Inst init [1] (2 unstable [all])
  122. Inst upgrade-with-conflict [1.0] (2.0 unstable [all])
  123. Inst new-dep (1.0 stable [all])
  124. Inst upgrade-simple [1.0] (2.0 unstable [all])
  125. Inst upgrade-with-new-dep [1.0] (2.0 unstable [all])
  126. Conf init (2 unstable [all])
  127. Conf upgrade-with-conflict (2.0 unstable [all])
  128. Conf new-dep (1.0 stable [all])
  129. Conf upgrade-simple (2.0 unstable [all])
  130. Conf upgrade-with-new-dep (2.0 unstable [all])' aptget -s dist-upgrade