merged r1972 from lp:~paolorotolo/apt/fix-for-967393
[ntk/apt.git] / test / integration / test-disappearing-packages
CommitLineData
75954ae2
DK
1#!/bin/sh
2set -e
3
9962ae93 4TESTDIR=$(readlink -f $(dirname $0))
75954ae2
DK
5. $TESTDIR/framework
6setupenvironment
ea65d079 7configarchitecture 'native'
75954ae2 8
ea65d079 9buildsimplenativepackage "old-pkg" "native" "1.0" "stable"
75954ae2
DK
10buildsimplenativepackage "unrelated" "all" "0.5" "unstable"
11
ea65d079 12setupsimplenativepackage "new-pkg" "native" "2.0" "unstable" "Provides: old-pkg
75954ae2
DK
13Replaces: old-pkg
14Conflicts: old-pkg (<< 2.0)"
718f797c 15BUILDDIR="incoming/new-pkg-2.0"
75954ae2
DK
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"
718f797c 21BUILDDIR="incoming/old-pkg-2.0"
75954ae2
DK
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
32aptget install old-pkg=1.0 --trivial-only -qq 2>&1 > /dev/null
33
ec7f904e 34testmarkedauto # old-pkg is manual installed
75954ae2 35
718f797c 36CMD="aptget dist-upgrade -y -q=0"
75954ae2 37msgtest "Test for equality of" "$CMD"
718f797c 38COMPAREFILE=$(mktemp)
75954ae2
DK
39echo "The following package disappeared from your system as
40all files have been overwritten by other packages:
41 old-pkg
a12d5352 42Note: This is done automatically and on purpose by dpkg." > $COMPAREFILE
75954ae2
DK
43$CMD 2>&1 | tail -n 4 | diff $COMPAREFILE - && msgpass || msgfail
44rm $COMPAREFILE
45
ea65d079 46sed -i rootdir/var/log/apt/history.log -e '/^Commandline: / d' -e '/^Start-Date: / d' -e '/^End-Date: / d' -e "s#:$(getarchitecture 'native') #:native #"
75954ae2 47testfileequal "rootdir/var/log/apt/history.log" "
ea65d079 48Install: old-pkg:native (1.0)
75954ae2 49
ea65d079
DK
50Install: new-pkg:native (2.0, automatic)
51Upgrade: old-pkg:native (1.0, 2.0)
75954ae2
DK
52Disappeared: old-pkg (1.0)"
53
ec7f904e 54testmarkedauto # new-pkg should have get the manual flag from old-pkg