]> git.saurik.com Git - apt.git/blame - test/integration/test-disappearing-packages
correct cross & disappear progress detection
[apt.git] / test / integration / test-disappearing-packages
CommitLineData
75954ae2
DK
1#!/bin/sh
2set -e
3
63c71412
DK
4TESTDIR="$(readlink -f "$(dirname "$0")")"
5. "$TESTDIR/framework"
75954ae2 6setupenvironment
dabe9e24 7configarchitecture 'amd64' 'i386'
75954ae2 8
dabe9e24 9buildsimplenativepackage 'old-pkg' 'amd64' '1' 'stable'
75954ae2 10
dabe9e24 11setupsimplenativepackage 'new-pkg' 'amd64' '2' 'unstable' 'Provides: old-pkg
75954ae2 12Replaces: old-pkg
dabe9e24
DK
13Conflicts: old-pkg (<< 2)'
14BUILDDIR='incoming/new-pkg-2'
63c71412
DK
15echo '/usr/share/doc/new-pkg /usr/share/doc/old-pkg' > "${BUILDDIR}/debian/new-pkg.links"
16buildpackage "$BUILDDIR" 'unstable' 'main'
75954ae2
DK
17rm -rf "$BUILDDIR"
18
dabe9e24
DK
19setupsimplenativepackage 'old-pkg' 'all' '2' 'unstable' 'Depends: new-pkg'
20BUILDDIR='incoming/old-pkg-2'
63c71412 21echo '/usr/share/doc/new-pkg /usr/share/doc/old-pkg' > "${BUILDDIR}/debian/old-pkg.links"
75954ae2
DK
22echo "
23override_dh_link:
24 rm -rf debian/old-pkg/usr/share/doc/old-pkg/
63c71412
DK
25 dh_link" >> "${BUILDDIR}/debian/rules"
26buildpackage "$BUILDDIR" 'unstable' 'main'
75954ae2
DK
27rm -rf "$BUILDDIR"
28
dabe9e24
DK
29setupsimplenativepackage 'super-new-pkg' 'i386' '3' 'experimental' 'Provides: new-pkg
30Replaces: new-pkg
31Conflicts: new-pkg (<< 3)'
32BUILDDIR='incoming/super-new-pkg-3'
33echo '/usr/share/doc/super-new-pkg /usr/share/doc/old-pkg' > "${BUILDDIR}/debian/super-new-pkg.links"
34echo '/usr/share/doc/super-new-pkg /usr/share/doc/new-pkg' >> "${BUILDDIR}/debian/super-new-pkg.links"
35buildpackage "$BUILDDIR" 'experimental' 'main'
36rm -rf "$BUILDDIR"
37
38setupsimplenativepackage 'new-pkg' 'all' '3' 'experimental' 'Depends: super-new-pkg'
39BUILDDIR='incoming/new-pkg-3'
40echo '/usr/share/doc/super-new-pkg /usr/share/doc/old-pkg' > "${BUILDDIR}/debian/new-pkg.links"
41echo '/usr/share/doc/super-new-pkg /usr/share/doc/new-pkg' >> "${BUILDDIR}/debian/new-pkg.links"
42echo "
43override_dh_link:
44 rm -rf debian/new-pkg/usr/share/doc/new-pkg/
45 dh_link" >> "${BUILDDIR}/debian/rules"
46buildpackage "$BUILDDIR" 'experimental' 'main'
47rm -rf "$BUILDDIR"
75954ae2 48
dabe9e24 49setupaptarchive
75954ae2 50
dabe9e24
DK
51msgmsg 'Let a package disappear' 'old-pkg'
52testsuccess aptget install old-pkg=1 --trivial-only
ec7f904e 53testmarkedauto # old-pkg is manual installed
dabe9e24
DK
54testsuccess aptget dist-upgrade -y
55testdpkgnotinstalled old-pkg
56cp rootdir/tmp/testsuccess.output disappear.output
57testsuccessequal 'The following package disappeared from your system as
75954ae2
DK
58all files have been overwritten by other packages:
59 old-pkg
dabe9e24 60Note: This is done automatically and on purpose by dpkg.' tail -n 4 disappear.output
75954ae2 61
ea65d079 62sed -i rootdir/var/log/apt/history.log -e '/^Commandline: / d' -e '/^Start-Date: / d' -e '/^End-Date: / d' -e "s#:$(getarchitecture 'native') #:native #"
0479205d
DK
63if [ -n "$SUDO_USER" ]; then
64 testfileequal 'rootdir/var/log/apt/history.log' "
65Requested-By: $SUDO_USER ($(id -u "$SUDO_USER"))
dabe9e24 66Install: old-pkg:native (1)
0479205d
DK
67
68Requested-By: $SUDO_USER ($(id -u "$SUDO_USER"))
dabe9e24
DK
69Install: new-pkg:native (2, automatic)
70Upgrade: old-pkg:native (1, 2)
71Disappeared: old-pkg (1)"
0479205d
DK
72else
73 testfileequal 'rootdir/var/log/apt/history.log' '
dabe9e24 74Install: old-pkg:native (1)
75954ae2 75
dabe9e24
DK
76Install: new-pkg:native (2, automatic)
77Upgrade: old-pkg:native (1, 2)
78Disappeared: old-pkg (1)'
0479205d 79fi
75954ae2 80
ec7f904e 81testmarkedauto # new-pkg should have get the manual flag from old-pkg
dabe9e24
DK
82
83msgmsg 'Let a package disappear which let the previous disappear' 'new-pkg'
84testsuccess aptget dist-upgrade -y -t experimental
85testdpkgnotinstalled new-pkg
86cp rootdir/tmp/testsuccess.output disappear.output
87testsuccessequal 'The following package disappeared from your system as
88all files have been overwritten by other packages:
89 new-pkg
90Note: This is done automatically and on purpose by dpkg.' tail -n 4 disappear.output
91
92testmarkedauto