]> git.saurik.com Git - apt.git/blobdiff - test/integration/framework
run integration tests on my new amd64 box without failures
[apt.git] / test / integration / framework
index a2e71760edea3e97504783d3472867027474707f..b55f793a4860b3590ca8d717a7222c86814a89cd 100644 (file)
@@ -149,6 +149,7 @@ setupenvironment() {
        echo "DPKG::options:: \"--root=${TMPWORKINGDIRECTORY}/rootdir\";" >> aptconfig.conf
        echo "DPKG::options:: \"--force-not-root\";" >> aptconfig.conf
        echo "DPKG::options:: \"--force-bad-path\";" >> aptconfig.conf
+       echo "DPKG::options:: \"--force-architecture\";" >> aptconfig.conf # Added to test multiarch before dpkg is ready for it…
        echo "DPKG::options:: \"--log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log\";" >> aptconfig.conf
        echo 'quiet::NoUpdate "true";' >> aptconfig.conf
        export LC_ALL=C
@@ -156,13 +157,26 @@ setupenvironment() {
        msgdone "info"
 }
 
+getarchitecture() {
+       if [ "$1" = "native" -o -z "$1" ]; then
+               eval `aptconfig shell ARCH APT::Architecture`
+               if [ -n "$ARCH" ]; then
+                       echo $ARCH
+               else
+                       dpkg-architecture -qDEB_BUILD_ARCH
+               fi
+       else
+               echo $1
+       fi
+}
+
 configarchitecture() {
        local CONFFILE=rootdir/etc/apt/apt.conf.d/01multiarch.conf
        rm -f $CONFFILE
-       echo "APT::Architecture \"$1\";" > $CONFFILE
+       echo "APT::Architecture \"$(getarchitecture $1)\";" > $CONFFILE
        shift
        while [ -n "$1" ]; do
-               echo "APT::Architectures:: \"$1\";" >> $CONFFILE
+               echo "APT::Architectures:: \"$(getarchitecture $1)\";" >> $CONFFILE
                shift
        done
 }
@@ -275,7 +289,7 @@ Package: $NAME" > ${BUILDDIR}/debian/control
                echo "pool/${SRC}" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.srclist
        done
 
-       for arch in $(echo "$ARCH" | sed -e 's#,#\n#g'); do
+       for arch in $(echo "$ARCH" | sed -e 's#,#\n#g' | sed -e "s#^native\$#$(getarchitecture 'native')#"); do
                rm -rf ${BUILDDIR}/debian/tmp
                mkdir -p ${BUILDDIR}/debian/tmp/DEBIAN ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME} ${BUILDDIR}/debian/tmp/usr/bin
                cp ${BUILDDIR}/debian/copyright ${BUILDDIR}/debian/changelog ${BUILDDIR}/FEATURES ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME}
@@ -298,6 +312,7 @@ buildpackage() {
        local BUILDDIR=$1
        local RELEASE=$2
        local SECTION=$3
+       local ARCH=$(getarchitecture $4)
        msgninfo "Build package $(echo "$BUILDDIR" | grep -o '[^/]*$') for ${RELEASE} in ${SECTION}… "
        cd $BUILDDIR
        if [ "$ARCH" = "all" ]; then
@@ -408,7 +423,7 @@ insertpackage() {
        local DEPENDENCIES="$5"
        local PRIORITY="${6:-optional}"
        local ARCHS=""
-       for arch in $(echo "$ARCH" | sed -e 's#,#\n#g'); do
+       for arch in $(echo "$ARCH" | sed -e 's#,#\n#g' | sed -e "s#^native\$#$(getarchitecture 'native')#"); do
                if [ "$arch" = "all" ]; then
                        ARCHS="$(aptconfig dump | grep APT::Architecture | cut -d'"' -f 2 | sed '/^$/ d' | sort | uniq | tr '\n' ' ')"
                else
@@ -465,7 +480,7 @@ insertinstalledpackage() {
        local DEPENDENCIES="$4"
        local PRIORITY="${5:-optional}"
        local FILE="rootdir/var/lib/dpkg/status"
-       for arch in $(echo "$ARCH" | sed -e 's#,#\n#g'); do
+       for arch in $(echo "$ARCH" | sed -e 's#,#\n#g' | sed -e "s#^native\$#$(getarchitecture 'native')#"); do
                echo "Package: $NAME
 Status: install ok installed
 Priority: $PRIORITY
@@ -715,8 +730,7 @@ N: Can't select versions from package '$1' as it is purely virtual"
 N: No packages found"
        local COMPAREFILE=$(mktemp)
        addtrap "rm $COMPAREFILE;"
-       local ARCH=$(dpkg-architecture -qDEB_HOST_ARCH_CPU)
-       eval `apt-config shell ARCH APT::Architecture`
+       local ARCH="$(getarchitecture 'native')"
        echo "$VIRTUAL" | sed -e "s/:$ARCH//" -e 's/:all//' > $COMPAREFILE
        aptcache show -q=0 $PACKAGE 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail
 }