]> git.saurik.com Git - apt.git/blobdiff - test/integration/framework
really fix test
[apt.git] / test / integration / framework
index a2bb871ccb4693110d36e69ee19798760ff75fac..d899bb574ac4c74825fb37eeaa26b432f9a647e3 100644 (file)
@@ -216,14 +216,13 @@ getarchitectures() {
 }
 
 configarchitecture() {
-       local CONFFILE=rootdir/etc/apt/apt.conf.d/01multiarch.conf
-       rm -f $CONFFILE
-       echo "APT::Architecture \"$(getarchitecture $1)\";" > $CONFFILE
-       shift
-       while [ -n "$1" ]; do
-               echo "APT::Architectures:: \"$(getarchitecture $1)\";" >> $CONFFILE
-               shift
-       done
+       {
+               echo "APT::Architecture \"$(getarchitecture $1)\";"
+               while [ -n "$1" ]; do
+                       echo "APT::Architectures:: \"$(getarchitecture $1)\";"
+                       shift
+               done
+       } >rootdir/etc/apt/apt.conf.d/01multiarch.conf
        configdpkg
 }
 
@@ -236,16 +235,17 @@ configdpkg() {
                        echo -n > rootdir/var/lib/dpkg/status
                fi
        fi
+       rm -f rootdir/etc/apt/apt.conf.d/00foreigndpkg
        if $(which 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}; 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\";" >> aptconfig.conf
-                                               echo "DPKG::options:: \"${ARCH}\";" >> aptconfig.conf
+                                               echo "DPKG::options:: \"--foreign-architecture\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg
+                                               echo "DPKG::options:: \"${ARCH}\";"  >> rootdir/etc/apt/apt.conf.d/00foreigndpkg
                                        fi
                                fi
                        done
@@ -278,7 +278,11 @@ setupsimplenativepackage() {
        local VERSION="$3"
        local RELEASE="${4:-unstable}"
        local DEPENDENCIES="$5"
-       local DESCRIPTION="$6"
+       local DESCRIPTION="${6:-"Description: an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
+ If you find such a package installed on your system,
+ something went horribly wrong! They are autogenerated
+ und used only by testcases and surf no other propose…"}"
+
        local SECTION="${7:-others}"
        local DISTSECTION
        if [ "$SECTION" = "$(echo "$SECTION" | cut -d'/' -f 2)" ]; then
@@ -310,14 +314,8 @@ Package: $NAME" > debian/control
                echo "Architecture: any" >> debian/control
        fi
        test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> debian/control
-       if [ -z "$DESCRIPTION" ]; then
-               echo "Description: an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
- If you find such a package installed on your system,
- YOU did something horribly wrong! They are autogenerated
- und used only by testcases for APT and surf no other propose…" >> debian/control
-       else
-               echo "Description: $DESCRIPTION" >> debian/control
-       fi
+       echo "Description: $DESCRIPTION" >> debian/control
+
        test -e debian/compat || echo "7" > debian/compat
        test -e debian/source/format || echo "3.0 (native)" > debian/source/format
        test -e debian/rules || cp /usr/share/doc/debhelper/examples/rules.tiny debian/rules
@@ -330,7 +328,11 @@ buildsimplenativepackage() {
        local VERSION="$3"
        local RELEASE="${4:-unstable}"
        local DEPENDENCIES="$5"
-       local DESCRIPTION="$6"
+       local DESCRIPTION="${6:-"Description: an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
+ If you find such a package installed on your system,
+ something went horribly wrong! They are autogenerated
+ und used only by testcases and surf no other propose…"}"
+
        local SECTION="${7:-others}"
        local PRIORITY="${8:-optional}"
        local DISTSECTION
@@ -370,14 +372,7 @@ Package: $NAME" >> ${BUILDDIR}/debian/control
        fi
        local DEPS="$(echo "$DEPENDENCIES" | grep -v '^Build-')"
        test -z "$DEPS" || echo "$DEPS" >> ${BUILDDIR}/debian/control
-       if [ -z "$DESCRIPTION" ]; then
-               echo "Description: an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
- If you find such a package installed on your system,
- YOU did something horribly wrong! They are autogenerated
- und used only by testcases for APT and surf no other propose…" >> ${BUILDDIR}/debian/control
-       else
-               echo "Description: $DESCRIPTION" >> ${BUILDDIR}/debian/control
-       fi
+       echo "Description: $DESCRIPTION" >> ${BUILDDIR}/debian/control
 
        echo '3.0 (native)' > ${BUILDDIR}/debian/source/format
        (cd ${BUILDDIR}/..; dpkg-source -b ${NAME}-${VERSION} 2>&1) | sed -n 's#^dpkg-source: info: building [^ ]\+ in ##p' \
@@ -526,7 +521,10 @@ insertpackage() {
        local VERSION="$4"
        local DEPENDENCIES="$5"
        local PRIORITY="${6:-optional}"
-       local DESCRIPTION="${7}"
+       local DESCRIPTION="${7:-"Description: an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
+ If you find such a package installed on your system,
+ something went horribly wrong! They are autogenerated
+ und used only by testcases and surf no other propose…"}"
        local ARCHS=""
        for arch in $(echo "$ARCH" | sed -e 's#,#\n#g' | sed -e "s#^native\$#$(getarchitecture 'native')#"); do
                if [ "$arch" = 'all' -o "$arch" = 'none' ]; then
@@ -548,15 +546,7 @@ Maintainer: Joe Sixpack <joe@example.org>" >> $FILE
                        echo "Version: $VERSION
 Filename: pool/main/${NAME}/${NAME}_${VERSION}_${arch}.deb" >> $FILE
                        test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE
-                       echo -n 'Description: ' >> $FILE
-                       if [ -z "$DESCRIPTION" ]; then
-                               echo "an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
- If you find such a package installed on your system,
- YOU did something horribly wrong! They are autogenerated
- und used only by testcases for APT and surf no other propose…" >> $FILE
-                       else
-                               echo "$DESCRIPTION" >> $FILE
-                       fi
+                       echo "Description: $DESCRIPTION" >> $FILE
                        echo >> $FILE
                done
        done
@@ -591,6 +581,11 @@ insertinstalledpackage() {
        local DEPENDENCIES="$4"
        local PRIORITY="${5:-optional}"
        local STATUS="${6:-install ok installed}"
+       local DESCRIPTION="${7:-"Description: an autogenerated dummy ${NAME}=${VERSION}/installed
+ If you find such a package installed on your system,
+ something went horribly wrong! They are autogenerated
+ und used only by testcases and surf no other propose…"}"
+
        local FILE='rootdir/var/lib/dpkg/status'
        local INFO='rootdir/var/lib/dpkg/info'
        for arch in $(echo "$ARCH" | sed -e 's#,#\n#g' | sed -e "s#^native\$#$(getarchitecture 'native')#"); do
@@ -603,11 +598,8 @@ Maintainer: Joe Sixpack <joe@example.org>
 Version: $VERSION" >> $FILE
                test "$arch" = 'none' || echo "Architecture: $arch" >> $FILE
                test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE
-               echo "Description: an autogenerated dummy ${NAME}=${VERSION}/installed
- If you find such a package installed on your system,
- YOU did something horribly wrong! They are autogenerated
- und used only by testcases for APT and surf no other propose…
-" >> $FILE
+               echo "Description: $DESCRIPTION" >> $FILE
+               echo >> $FILE
                if [ "$(dpkg-query -W --showformat='${Multi-Arch}')" = 'same' ]; then
                        echo -n > ${INFO}/${NAME}:${arch}.list
                else
@@ -941,7 +933,7 @@ testequalor2() {
        echo "$2" > $COMPAREFILE2
        shift 2
        msgtest "Test for equality OR of" "$*"
-       $* >$COMPAREAGAINST 2>&1
+       $* >$COMPAREAGAINST 2>&1 || true
        (checkdiff $COMPAREFILE1 $COMPAREAGAINST 1> /dev/null ||
                checkdiff $COMPAREFILE2 $COMPAREAGAINST 1> /dev/null) && msgpass ||
                ( echo "\n${CINFO}Diff against OR 1${CNORMAL}" "$(checkdiff $COMPAREFILE1 $COMPAREAGAINST)" \