]> git.saurik.com Git - apt.git/blame_incremental - test/integration/test-disappearing-packages
protect only the latest same-source providers from autoremove
[apt.git] / test / integration / test-disappearing-packages
... / ...
CommitLineData
1#!/bin/sh
2set -e
3
4TESTDIR="$(readlink -f "$(dirname "$0")")"
5. "$TESTDIR/framework"
6setupenvironment
7configarchitecture 'native'
8
9buildsimplenativepackage 'old-pkg' 'native' '1.0' 'stable'
10buildsimplenativepackage 'unrelated' 'all' '0.5' 'unstable'
11
12setupsimplenativepackage 'new-pkg' 'native' '2.0' 'unstable' 'Provides: old-pkg
13Replaces: old-pkg
14Conflicts: old-pkg (<< 2.0)'
15BUILDDIR='incoming/new-pkg-2.0'
16echo '/usr/share/doc/new-pkg /usr/share/doc/old-pkg' > "${BUILDDIR}/debian/new-pkg.links"
17buildpackage "$BUILDDIR" 'unstable' 'main'
18rm -rf "$BUILDDIR"
19
20setupsimplenativepackage 'old-pkg' 'all' '2.0' 'unstable' 'Depends: new-pkg'
21BUILDDIR='incoming/old-pkg-2.0'
22echo '/usr/share/doc/new-pkg /usr/share/doc/old-pkg' > "${BUILDDIR}/debian/old-pkg.links"
23echo "
24override_dh_link:
25 rm -rf debian/old-pkg/usr/share/doc/old-pkg/
26 dh_link" >> "${BUILDDIR}/debian/rules"
27buildpackage "$BUILDDIR" 'unstable' 'main'
28rm -rf "$BUILDDIR"
29
30setupaptarchive
31
32testsuccess aptget install old-pkg=1.0 --trivial-only
33
34testmarkedauto # old-pkg is manual installed
35
36CMD='aptget dist-upgrade -y'
37msgtest 'Test for equality of' "$CMD"
38COMPAREFILE="$(mktemp)"
39echo 'The following package disappeared from your system as
40all files have been overwritten by other packages:
41 old-pkg
42Note: This is done automatically and on purpose by dpkg.' > "$COMPAREFILE"
43$CMD 2>&1 | tail -n 4 | diff -u "$COMPAREFILE" - && msgpass || msgfail
44rm "$COMPAREFILE"
45
46sed -i rootdir/var/log/apt/history.log -e '/^Commandline: / d' -e '/^Start-Date: / d' -e '/^End-Date: / d' -e "s#:$(getarchitecture 'native') #:native #"
47if [ -n "$SUDO_USER" ]; then
48 testfileequal 'rootdir/var/log/apt/history.log' "
49Requested-By: $SUDO_USER ($(id -u "$SUDO_USER"))
50Install: old-pkg:native (1.0)
51
52Requested-By: $SUDO_USER ($(id -u "$SUDO_USER"))
53Install: new-pkg:native (2.0, automatic)
54Upgrade: old-pkg:native (1.0, 2.0)
55Disappeared: old-pkg (1.0)"
56else
57 testfileequal 'rootdir/var/log/apt/history.log' '
58Install: old-pkg:native (1.0)
59
60Install: new-pkg:native (2.0, automatic)
61Upgrade: old-pkg:native (1.0, 2.0)
62Disappeared: old-pkg (1.0)'
63fi
64
65testmarkedauto # new-pkg should have get the manual flag from old-pkg