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