Most tests are either multiarch, do not care for the specific
architecture or do not interact with dpkg, so really effect by this is
only test-external-installation-planner-protocol, but its a general
issue that while APT can be told to treat any architecture as native
dpkg has the native architecture hardcoded so if we run tests we must
make sure that dpkg knows about the architecture we will treat as
"native" in apt as otherwise dpkg will refuse to install packages from
such an architecture.
This reverts
f883d2c3675eae2700e4cd1532c1a236cae69a4e as it complicates
the test slightly for no practical gain after the generic fix.
rm -f rootdir/etc/apt/apt.conf.d/00foreigndpkg
if command dpkg --assert-multi-arch >/dev/null 2>&1 ; then
local ARCHS="$(getarchitectures)"
rm -f rootdir/etc/apt/apt.conf.d/00foreigndpkg
if command dpkg --assert-multi-arch >/dev/null 2>&1 ; then
local ARCHS="$(getarchitectures)"
- if echo "$ARCHS" | grep -E -q '[^ ]+ [^ ]+'; then
- DPKGARCH="$(dpkg --print-architecture)"
- for ARCH in ${ARCHS}; do
- if [ "${ARCH}" != "${DPKGARCH}" ]; then
- if ! dpkg --add-architecture ${ARCH} >/dev/null 2>&1; then
- # old-style used e.g. in Ubuntu-P – and as it seems travis
- echo "DPKG::options:: \"--foreign-architecture\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg
- echo "DPKG::options:: \"${ARCH}\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg
- fi
+ local DPKGARCH="$(dpkg --print-architecture)"
+ # this ensures that even if multi-arch isn't active in the view
+ # of apt, given that dpkg can't be told which arch is native
+ # the arch apt treats as native might be foreign for dpkg
+ for ARCH in ${ARCHS}; do
+ if [ "${ARCH}" != "${DPKGARCH}" ]; then
+ if ! dpkg --add-architecture ${ARCH} >/dev/null 2>&1; then
+ # old-style used e.g. in Ubuntu-P – and as it seems travis
+ echo "DPKG::options:: \"--foreign-architecture\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg
+ echo "DPKG::options:: \"${ARCH}\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg
+ fi
+ done
+ # if multi-arch make sure dpkg can detect itself as capable of it
+ if echo "$ARCHS" | grep -E -q '[^ ]+ [^ ]+'; then
if [ "0" = "$(dpkg -l dpkg 2> /dev/null | grep '^i' | wc -l)" ]; then
# dpkg doesn't really check the version as long as it is fully installed,
# but just to be sure we choose one above the required version
if [ "0" = "$(dpkg -l dpkg 2> /dev/null | grep '^i' | wc -l)" ]; then
# dpkg doesn't really check the version as long as it is fully installed,
# but just to be sure we choose one above the required version
set -e
TESTDIR="$(readlink -f "$(dirname "$0")")"
set -e
TESTDIR="$(readlink -f "$(dirname "$0")")"
-NATIVE="$(command dpkg --print-architecture)"
. "$TESTDIR/framework"
setupenvironment
. "$TESTDIR/framework"
setupenvironment
-configarchitecture "${NATIVE}"
+configarchitecture 'amd64'
-buildsimplenativepackage 'libfoo' "${NATIVE}" '3' 'experimental' 'Multi-Arch: same'
+buildsimplenativepackage 'libfoo' 'amd64' '3' 'experimental' 'Multi-Arch: same'
buildsimplenativepackage 'foo' 'all' '3' 'experimental' 'Depends: newstuff'
buildsimplenativepackage 'foo' 'all' '3' 'experimental' 'Depends: newstuff'
-buildsimplenativepackage 'foo' 'all' '2' 'unstable' "Depends: libfoo:$NATIVE, stuff
+buildsimplenativepackage 'foo' 'all' '2' 'unstable' 'Depends: libfoo:amd64, stuff
Conflicts: bar, libfoo:i386
Conflicts: bar, libfoo:i386
-Recommends: unrelated"
-buildsimplenativepackage 'libfoo' "${NATIVE}" '2' 'unstable' 'Multi-Arch: same'
-buildsimplenativepackage 'unrelated-2' "${NATIVE}" '2' 'unstable'
+Recommends: unrelated'
+buildsimplenativepackage 'libfoo' 'amd64' '2' 'unstable' 'Multi-Arch: same'
+buildsimplenativepackage 'unrelated-2' 'amd64' '2' 'unstable'
insertinstalledpackage 'foo' 'all' '1'
insertinstalledpackage 'bar' 'all' '1'
insertinstalledpackage 'stuff' 'all' '1'
insertinstalledpackage 'foo' 'all' '1'
insertinstalledpackage 'bar' 'all' '1'
insertinstalledpackage 'stuff' 'all' '1'
testsuccess aptget install foo -s
testsuccess aptget install foo -y
testsuccess test -r "$EIPPLOG"
testsuccess aptget install foo -s
testsuccess aptget install foo -y
testsuccess test -r "$EIPPLOG"
-testsuccessequal "Request: EIPP 0.1
-Architecture: ${NATIVE}
-Architectures: ${NATIVE}
-Remove: bar:${NATIVE}
-Install: libfoo:${NATIVE} foo:${NATIVE}
-Planner: internal" head -n 6 "$EIPPLOG"
+testsuccessequal 'Request: EIPP 0.1
+Architecture: amd64
+Architectures: amd64
+Remove: bar:amd64
+Install: libfoo:amd64 foo:amd64
+Planner: internal' head -n 6 "$EIPPLOG"
aptinternalplanner < "$EIPPLOG" > planner.log || true
testsuccessequal 'Remove: 6
Unpack: 2
aptinternalplanner < "$EIPPLOG" > planner.log || true
testsuccessequal 'Remove: 6
Unpack: 2
testsuccess aptget install foo -s --reinstall
testsuccess aptget install foo -y --reinstall
testsuccess test -r "$EIPPLOG"
testsuccess aptget install foo -s --reinstall
testsuccess aptget install foo -y --reinstall
testsuccess test -r "$EIPPLOG"
-testsuccessequal "Request: EIPP 0.1
-Architecture: ${NATIVE}
-Architectures: ${NATIVE}
-ReInstall: foo:${NATIVE}
-Planner: internal" head -n 5 "$EIPPLOG"
+testsuccessequal 'Request: EIPP 0.1
+Architecture: amd64
+Architectures: amd64
+ReInstall: foo:amd64
+Planner: internal' head -n 5 "$EIPPLOG"
aptinternalplanner < "$EIPPLOG" > planner.log || true
testsuccessequal 'Unpack: 4
Configure: 4' grep -e '^Unpack:' -e '^Install:' -e '^Configure:' -e '^Remove:' planner.log
aptinternalplanner < "$EIPPLOG" > planner.log || true
testsuccessequal 'Unpack: 4
Configure: 4' grep -e '^Unpack:' -e '^Install:' -e '^Configure:' -e '^Remove:' planner.log
testsuccess aptget purge foo -s
testsuccess aptget purge foo -y
testsuccess test -r "$EIPPLOG"
testsuccess aptget purge foo -s
testsuccess aptget purge foo -y
testsuccess test -r "$EIPPLOG"
-testsuccessequal "Request: EIPP 0.1
-Architecture: ${NATIVE}
-Architectures: ${NATIVE}
-Remove: foo:${NATIVE}
-Planner: internal" head -n 5 "$EIPPLOG"
+testsuccessequal 'Request: EIPP 0.1
+Architecture: amd64
+Architectures: amd64
+Remove: foo:amd64
+Planner: internal' head -n 5 "$EIPPLOG"
aptinternalplanner < "$EIPPLOG" > planner.log || true
testsuccessequal 'Remove: 4' grep -e '^Unpack:' -e '^Install:' -e '^Configure:' -e '^Remove:' planner.log
aptinternalplanner < "$EIPPLOG" > planner.log || true
testsuccessequal 'Remove: 4' grep -e '^Unpack:' -e '^Install:' -e '^Configure:' -e '^Remove:' planner.log