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