]> git.saurik.com Git - apt.git/blame - test/integration/test-ubuntu-bug-761175-remove-purge
test: Use a file to determine TEST_DEFAULT_GROUP
[apt.git] / test / integration / test-ubuntu-bug-761175-remove-purge
CommitLineData
949e033c
DK
1#!/bin/sh
2set -e
3
3abb6a6a
DK
4TESTDIR="$(readlink -f "$(dirname "$0")")"
5. "$TESTDIR/framework"
949e033c 6setupenvironment
016bea82
DK
7configarchitecture 'amd64' 'i386'
8
9buildcompizpkg() {
10 setupsimplenativepackage "compiz-core-$1" "$2" "$3" "$4"
11 BUILDDIR="incoming/compiz-core-$1-$3"
12 mkdir -p ${BUILDDIR}/debian/compiz-core/etc
13 echo 'foo=bar;' > ${BUILDDIR}/compiz.conf
14 echo 'compiz.conf /etc/compiz.conf' >> ${BUILDDIR}/debian/install
15 buildpackage "$BUILDDIR" "$4" 'main' "$2"
16 rm -rf "$BUILDDIR"
17}
18buildcompizpkg 'native' 'all' '1.0' 'stable'
19buildcompizpkg 'all' 'native' '1.0' 'stable'
20buildcompizpkg 'native' 'native' '2.0' 'unstable'
21buildcompizpkg 'all' 'all' '2.0' 'unstable'
949e033c
DK
22
23setupaptarchive
24
016bea82 25runtests() {
33190fe3
DK
26 local PKG="$1"
27 local RELEASE="${2}"
28 shift 2
29 testdpkgnotinstalled compiz-core-${PKG}
30 testsuccess aptget install compiz-core-${PKG} -t "${RELEASE}" "$@"
31 testdpkginstalled compiz-core-${PKG}
949e033c 32
d3930f87
DK
33 testsuccess aptget remove compiz-core-${PKG} -y "$@" -o Debug::pkgDpkgPm=1
34 testfailure grep -- '--force-remove-essential' rootdir/tmp/testsuccess.output
33190fe3
DK
35 testsuccess aptget remove compiz-core-${PKG} -y "$@"
36 testdpkgnotinstalled compiz-core-${PKG}
37 testdpkgstatus 'rc' '1' "compiz-core-${PKG}"
949e033c 38
33190fe3
DK
39 if [ -z "$1" ]; then
40 testsuccessequal "Reading package lists...
949e033c
DK
41Building dependency tree...
42Reading state information...
43The following packages will be REMOVED:
33190fe3 44 compiz-core-${PKG}*
949e033c 450 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
33190fe3
DK
46Purg compiz-core-${PKG}" aptget purge compiz-core-${PKG} -s "$@"
47 else
48 # check that the rc-version isn't passed to the external resolver if its only in dpkg/status
49 export APT_EDSP_DUMP_FILENAME="${TMPWORKINGDIRECTORY}/dump-${PKG}.edsp"
50 testfailure aptget purge compiz-core-${PKG} -y "$@" -s --solver dump
51 testsuccessequal '2' grep -c "^Package: compiz-core-${PKG}\$" "$APT_EDSP_DUMP_FILENAME"
52 mv rootdir/etc/apt/sources.list.d/apt-test-stable-deb.list rootdir/etc/apt/sources.list.d/apt-test-stable-deb.disabled
53 testfailure aptget purge compiz-core-${PKG} -y "$@" -s --solver dump
54 testsuccessequal '1' grep -c "^Package: compiz-core-${PKG}\$" "$APT_EDSP_DUMP_FILENAME"
55 mv rootdir/etc/apt/sources.list.d/apt-test-stable-deb.disabled rootdir/etc/apt/sources.list.d/apt-test-stable-deb.list
56
57 testsuccessequal "Reading package lists...
58Building dependency tree...
59Reading state information...
60Execute external solver...
61The following packages will be REMOVED:
62 compiz-core-${PKG}*
630 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
64Purg compiz-core-${PKG}" aptget purge compiz-core-${PKG} -s "$@"
65 fi
d3930f87
DK
66 testsuccess aptget purge compiz-core-${PKG} -y "$@" -o Debug::pkgDpkgPm=1
67 testfailure grep -- '--force-remove-essential' rootdir/tmp/testsuccess.output
33190fe3 68 testsuccess aptget purge compiz-core-${PKG} -y "$@"
41fadd29 69 echo -n '' > rootdir/var/lib/dpkg/available # dpkg -l < 1.16.2 reads the available file by default, where the package can be found
33190fe3
DK
70 testequalor2 "dpkg-query: no packages found matching compiz-core-${PKG}" "No packages found matching compiz-core-${PKG}." dpkg -l compiz-core-${PKG}
71}
72runtestround() {
73 runtests 'native' 'unstable' "$@"
74 runtests 'all' 'unstable' "$@"
75 runtests 'native' 'stable' "$@"
76 runtests 'all' 'stable' "$@"
016bea82 77}
33190fe3
DK
78testround() {
79 msgmsg 'Test in multi arch environment' "$@"
80 configarchitecture 'amd64' 'i386'
81 runtestround "$@"
016bea82 82
33190fe3
DK
83 msgmsg 'Test in single arch environment' "$@"
84 configarchitecture 'amd64'
85 runtestround "$@"
86}
87testround
88testround --solver apt