]> git.saurik.com Git - apt.git/blobdiff - test/integration/test-dpkg-assert-multi-arch
report warnings&errors consistently in edit-sources
[apt.git] / test / integration / test-dpkg-assert-multi-arch
index 177d7489b6798424e7ffdaefbacf1528358017ea..14b29ec87d5ff99f6f93be9c2332a4f3f22a4e1e 100755 (executable)
@@ -1,8 +1,8 @@
 #!/bin/sh
 set -e
 
-TESTDIR=$(readlink -f $(dirname $0))
-. $TESTDIR/framework
+TESTDIR="$(readlink -f "$(dirname "$0")")"
+. "$TESTDIR/framework"
 setupenvironment
 configarchitecture 'amd64' 'i386'
 
@@ -16,25 +16,30 @@ setupaptarchive
 
 testqualifier() {
        msgtest 'Test with' $1 'for correct qualifier mode' $2
-       GIVEN="$(aptget install $1 -qq -o Debug::pkgDPkgPM=1 2>&1 | grep -v -- '--unpack' | sed -e 's/^.*--[^u][^ ]* \([^ ]*\).*$/\1/')"
+       #aptget install $1 -qq -o Debug::pkgDPkgPM=1 || true
+       aptget install $1 -qq -o Debug::pkgDPkgPM=1 -o Dpkg::ExplicitLastConfigure=1 > testqualifier.output 2>&1 || true
+       GIVEN="$(grep -v -- '--unpack' testqualifier.output | sed -e 's/^.*--[^u][^ ]* \([^ ]*\).*$/\1/')"
        if [ "$GIVEN" = "$2" ]; then
                msgpass
        else
-               echo
-               echo "$GIVEN"
+               cat >&2 testqualifier.output
+               echo >&2
+               echo >&2 "$GIVEN"
                msgfail
        fi
 }
 
-# non-multiarch or "ubuntus" old multiarchified dpkg
+msgmsg 'non-multiarch or "ubuntus" old multiarchified dpkg'
 echo 'Dir::Bin::dpkg "./dpkg-wrapper";' > rootdir/etc/apt/apt.conf.d/99dpkgwrapper
-echo '#! /bin/sh
-if echo "$*" | grep -q -- "--assert-multi-arch"; then
+cat > ./dpkg-wrapper <<EOF
+#! /bin/sh
+if echo "\$*" | grep -q -- "--assert-multi-arch"; then
        echo >&2 'dpkg: Fehler: unbekannte Option --assert-multi-arch'
        echo >&1 'dpkg: Info: unbekannte Option --assert-multi-arch'
-       return 2;
+       exit 2
 fi
-return $*' > ./dpkg-wrapper
+exec "\$@"
+EOF
 chmod +x ./dpkg-wrapper
 
 testqualifier 'native-pkg' 'native-pkg'
@@ -61,16 +66,18 @@ testqualifier 'all-foreign-pkg-' 'all-foreign-pkg'
 testqualifier 'always-all-pkg-' 'always-all-pkg'
 testqualifier 'always-all-foreign-pkg-' 'always-all-foreign-pkg'
 
-# multiarch dpkg (new interface version)
-
+msgmsg 'multiarch dpkg (new interface version)'
 rm rootdir/var/lib/dpkg/status
 touch rootdir/var/lib/dpkg/status
 echo 'Dir::Bin::dpkg "./dpkg-wrapper";' > rootdir/etc/apt/apt.conf.d/99dpkgwrapper
-echo '#! /bin/sh
-if echo "$*" | grep -q -- "--assert-multi-arch"; then
-       return 0;
+cat > ./dpkg-wrapper <<EOF
+#! /bin/sh
+if echo "\$*" | grep -q -- "--assert-multi-arch"; then
+       exit 0
 fi
-return $*' > ./dpkg-wrapper
+exec "\$@"
+EOF
+chmod +x ./dpkg-wrapper
 
 testqualifier 'native-pkg' 'native-pkg:amd64'
 testqualifier 'native-pkg:amd64' 'native-pkg:amd64'