#!/bin/sh set -e TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework setupenvironment configarchitecture 'amd64' 'i386' insertpackage 'unstable' 'bar' 'amd64,i386' '1' insertpackage 'unstable' 'uninstalled' 'all' '1' insertpackage 'unstable' 'uninstalled-native' 'amd64' '1' insertinstalledpackage 'foo' 'all' '1' insertinstalledpackage 'bar' 'amd64' '1' setupaptarchive # dpkg is "installed" by our test framework testdpkginstalled dpkg testnoautopkg() { testempty aptmark showauto testempty aptcache showauto testequal 'bar dpkg foo' aptmark showmanual testequal 'bar foo' aptmark showmanual bar foo uninstalled } testfooisauto() { testequal 'foo' aptmark showauto testequal 'foo' aptcache showauto testequal 'foo' aptmark showauto foo testequal 'foo' aptcache showauto foo testequal 'bar dpkg' aptmark showmanual testequal 'bar' aptmark showmanual bar } testmarkonpkgasauto() { testsuccess $1 $2 foo testfooisauto testsuccess $1 $2 foo testfooisauto testsuccess $1 $3 foo testnoautopkg testsuccess $1 $3 foo testnoautopkg } testequal 'E: No packages found' aptmark auto testequal 'E: No packages found' aptmark manual testnoautopkg testmarkonpkgasauto 'aptmark' 'auto' 'manual' testmarkonpkgasauto 'aptmark' 'markauto' 'unmarkauto' testmarkonpkgasauto 'aptget' 'markauto' 'unmarkauto' testnoholdpkg() { testempty aptmark showhold testempty aptmark showholds # typical "typo" testempty aptmark showhold dpkg testempty aptmark showholds dpkg } testpkgonhold() { testequal "$1" aptmark showhold testequal "$1" aptmark showholds testequal "$1" aptmark showhold $1 testequal "$1" aptmark showholds $1 } testmarkonepkgashold() { testsuccess aptmark hold $1 testpkgonhold $1 testsuccess aptmark hold $1 testpkgonhold $1 testsuccess aptmark unhold $1 testnoholdpkg testsuccess aptmark unhold $1 testnoholdpkg } testequal 'E: No packages found' aptmark hold testequal 'E: No packages found' aptmark unhold testnoholdpkg testmarkonepkgashold 'foo' testmarkonepkgashold 'bar' msgtest 'dpkg supports --merge-avail via' 'stdin' if dpkg --merge-avail - < /dev/null >/dev/null 2>&1; then msgpass else msgskip 'dpkg version too old' exit 0 fi testmarkonepkgashold 'uninstalled' testmarkonepkgashold 'uninstalled-native' testequal 'uninstalled set on hold.' aptmark hold uninstalled testequal 'uninstalled-native set on hold.' aptmark hold uninstalled-native