test-allow 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #!/bin/sh
  2. #
  3. # Test for --allow-remove-essential and friends replacing --force-yes
  4. #
  5. set -e
  6. TESTDIR="$(readlink -f "$(dirname $0)")"
  7. . "$TESTDIR/framework"
  8. setupenvironment
  9. configarchitecture 'amd64'
  10. insertpackage 'unstable' 'downgrade' 'all' '1'
  11. insertinstalledpackage 'downgrade' 'all' '2'
  12. insertpackage 'unstable' 'hold' 'all' '2'
  13. insertinstalledpackage 'hold' 'all' '1'
  14. insertinstalledpackage 'essential' 'all' '1' 'Essential: yes'
  15. setupaptarchive
  16. testsuccess aptmark hold hold
  17. # Test --allow-remove--essential
  18. testfailureequal 'Reading package lists...
  19. Building dependency tree...
  20. The following packages will be REMOVED:
  21. essential
  22. WARNING: The following essential packages will be removed.
  23. This should NOT be done unless you know exactly what you are doing!
  24. essential
  25. 0 upgraded, 0 newly installed, 1 to remove and 1 not upgraded.
  26. E: Essential packages were removed and -y was used without --allow-remove-essential.' aptget remove essential -y -s
  27. testsuccessequal 'Reading package lists...
  28. Building dependency tree...
  29. The following packages will be REMOVED:
  30. essential
  31. WARNING: The following essential packages will be removed.
  32. This should NOT be done unless you know exactly what you are doing!
  33. essential
  34. 0 upgraded, 0 newly installed, 1 to remove and 1 not upgraded.
  35. Remv essential [1]' aptget remove essential -y --allow-remove-essential -s
  36. # Test --allow-change-held-packages (should not influence dist-upgrade, but an install)
  37. testsuccessequal 'Reading package lists...
  38. Building dependency tree...
  39. Calculating upgrade...
  40. The following packages have been kept back:
  41. hold
  42. 0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.' aptget dist-upgrade --allow-change-held-packages -s
  43. testfailureequal 'Reading package lists...
  44. Building dependency tree...
  45. The following held packages will be changed:
  46. hold
  47. The following packages will be upgraded:
  48. hold
  49. 1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
  50. E: Held packages were changed and -y was used without --allow-change-held-packages.' aptget install hold -y -s
  51. testfailureequal 'Reading package lists...
  52. Building dependency tree...
  53. The following held packages will be changed:
  54. hold
  55. The following packages will be upgraded:
  56. hold
  57. 1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
  58. E: Held packages were changed and -y was used without --allow-change-held-packages.' aptget install hold -y -s
  59. testsuccessequal 'Reading package lists...
  60. Building dependency tree...
  61. The following held packages will be changed:
  62. hold
  63. The following packages will be upgraded:
  64. hold
  65. 1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
  66. Inst hold [1] (2 unstable [all])
  67. Conf hold (2 unstable [all])' aptget install hold -y -s --allow-change-held-packages
  68. # Test --allow-downgrades
  69. testfailureequal 'Reading package lists...
  70. Building dependency tree...
  71. The following packages will be DOWNGRADED:
  72. downgrade
  73. 0 upgraded, 0 newly installed, 1 downgraded, 0 to remove and 1 not upgraded.
  74. E: Packages were downgraded and -y was used without --allow-downgrades.' aptget install downgrade=1 -y -s
  75. testsuccessequal 'Reading package lists...
  76. Building dependency tree...
  77. The following packages will be DOWNGRADED:
  78. downgrade
  79. 0 upgraded, 0 newly installed, 1 downgraded, 0 to remove and 1 not upgraded.
  80. Inst downgrade [2] (1 unstable [all])
  81. Conf downgrade (1 unstable [all])' aptget install downgrade=1 --allow-downgrades -y -s