]> git.saurik.com Git - apt.git/blame_incremental - test/integration/test-disappearing-packages
Don't download "optional" files not in Release :/.
[apt.git] / test / integration / test-disappearing-packages
... / ...
CommitLineData
1#!/bin/sh
2set -e
3
4TESTDIR="$(readlink -f "$(dirname "$0")")"
5. "$TESTDIR/framework"
6setupenvironment
7configarchitecture 'amd64' 'i386'
8
9buildsimplenativepackage 'old-pkg' 'amd64' '1' 'stable'
10
11setupsimplenativepackage 'new-pkg' 'amd64' '2' 'unstable' 'Provides: old-pkg
12Replaces: old-pkg
13Conflicts: old-pkg (<< 2)'
14BUILDDIR='incoming/new-pkg-2'
15echo '/usr/share/doc/new-pkg /usr/share/doc/old-pkg' > "${BUILDDIR}/debian/new-pkg.links"
16buildpackage "$BUILDDIR" 'unstable' 'main'
17rm -rf "$BUILDDIR"
18
19setupsimplenativepackage 'old-pkg' 'all' '2' 'unstable' 'Depends: new-pkg'
20BUILDDIR='incoming/old-pkg-2'
21echo '/usr/share/doc/new-pkg /usr/share/doc/old-pkg' > "${BUILDDIR}/debian/old-pkg.links"
22echo "
23override_dh_link:
24 rm -rf debian/old-pkg/usr/share/doc/old-pkg/
25 dh_link" >> "${BUILDDIR}/debian/rules"
26buildpackage "$BUILDDIR" 'unstable' 'main'
27rm -rf "$BUILDDIR"
28
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"
48
49setupaptarchive
50
51msgmsg 'Let a package disappear' 'old-pkg'
52testsuccess aptget install old-pkg=1 --trivial-only
53testmarkedauto # old-pkg is manual installed
54testsuccess aptget dist-upgrade -y
55testdpkgnotinstalled old-pkg
56cp rootdir/tmp/testsuccess.output disappear.output
57testsuccessequal 'The following package disappeared from your system as
58all files have been overwritten by other packages:
59 old-pkg
60Note: This is done automatically and on purpose by dpkg.' tail -n 4 disappear.output
61
62sed -i rootdir/var/log/apt/history.log -e '/^Commandline: / d' -e '/^Start-Date: / d' -e '/^End-Date: / d' -e "s#:$(getarchitecture 'native') #:native #"
63if [ -n "$SUDO_USER" ]; then
64 testfileequal 'rootdir/var/log/apt/history.log' "
65Requested-By: $SUDO_USER ($(id -u "$SUDO_USER"))
66Install: old-pkg:native (1)
67
68Requested-By: $SUDO_USER ($(id -u "$SUDO_USER"))
69Install: new-pkg:native (2, automatic)
70Upgrade: old-pkg:native (1, 2)
71Disappeared: old-pkg (1)"
72else
73 testfileequal 'rootdir/var/log/apt/history.log' '
74Install: old-pkg:native (1)
75
76Install: new-pkg:native (2, automatic)
77Upgrade: old-pkg:native (1, 2)
78Disappeared: old-pkg (1)'
79fi
80
81testmarkedauto # new-pkg should have get the manual flag from old-pkg
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