]> git.saurik.com Git - apt.git/blobdiff - test/integration/framework
test the xz compressor, too
[apt.git] / test / integration / framework
index c8591428972672d1ef66ddc761eac34f9ba021f5..71e7e476c92698cc6a11c81a25df14b731de471d 100644 (file)
@@ -79,6 +79,7 @@ aptcache() { runapt apt-cache $*; }
 aptget() { runapt apt-get $*; }
 aptftparchive() { runapt apt-ftparchive $*; }
 aptkey() { runapt apt-key $*; }
+aptmark() { runapt apt-mark $*; }
 dpkg() {
        $(which dpkg) --root=${TMPWORKINGDIRECTORY}/rootdir --force-not-root --force-bad-path --log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log $*
 }
@@ -188,8 +189,12 @@ Maintainer: Joe Sixpack <joe@example.org>
 Build-Depends: debhelper (>= 7)
 Standards-Version: 3.9.1
 
-Package: $NAME
-Architecture: $ARCH" > debian/control
+Package: $NAME" > debian/control
+       if [ "$ARCH" = 'all' ]; then
+               echo "Architecture: all" >> debian/control
+       else
+               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}
@@ -239,8 +244,12 @@ Priority: optional
 Maintainer: Joe Sixpack <joe@example.org>
 Standards-Version: 3.9.1
 
-Package: $NAME
-Architecture: $ARCH" > ${BUILDDIR}/debian/control
+Package: $NAME" > ${BUILDDIR}/debian/control
+       if [ "$ARCH" = 'all' ]; then
+               echo "Architecture: all" >> ${BUILDDIR}/debian/control
+       else
+               echo "Architecture: any" >> ${BUILDDIR}/debian/control
+       fi
        test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> ${BUILDDIR}/debian/control
        if [ -z "$DESCRIPTION" ]; then
                echo "Description: an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
@@ -256,14 +265,17 @@ Architecture: $ARCH" > ${BUILDDIR}/debian/control
        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}
        cp ${BUILDDIR}/${NAME} ${BUILDDIR}/debian/tmp/usr/bin
-       (cd ${BUILDDIR}; dpkg-gencontrol)
+       (cd ${BUILDDIR}; dpkg-gencontrol -DArchitecture=$ARCH)
        (cd ${BUILDDIR}/debian/tmp; md5sum $(find usr/ -type f) > DEBIAN/md5sums)
 
-       dpkg-deb --build ${BUILDDIR}/debian/tmp ${BUILDDIR}/.. > /dev/null
+       dpkg-deb --build ${BUILDDIR}/debian/tmp ${BUILDDIR}/.. 2> /dev/null > /dev/null
        echo "pool/${NAME}_${VERSION}_${ARCH}.deb" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.pkglist
        for SRC in $SRCS; do
                echo "pool/${SRC}" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.srclist
        done
+       mkdir -p ${BUILDDIR}/../${NAME}_${VERSION}
+       cp ${BUILDDIR}/debian/changelog ${BUILDDIR}/../${NAME}_${VERSION}/
+       cp ${BUILDDIR}/debian/changelog ${BUILDDIR}/../${NAME}_${VERSION}.changelog
        rm -rf "${BUILDDIR}"
        msgdone "info"
 }
@@ -316,10 +328,10 @@ createaptftparchiveconfig() {
        echo -n '";
 };
 Default {
-       Packages::Compress ". gzip bzip2 lzma";
-       Sources::Compress ". gzip bzip2 lzma";
-       Contents::Compress ". gzip bzip2 lzma";
-       Translation::Compress ". gzip bzip2 lzma";
+       Packages::Compress ". gzip bzip2 lzma xz";
+       Sources::Compress ". gzip bzip2 lzma xz";
+       Contents::Compress ". gzip bzip2 lzma xz";
+       Translation::Compress ". gzip bzip2 lzma xz";
        LongDescription "false";
 };
 TreeDefault {
@@ -426,6 +438,7 @@ buildaptarchivefromfiles() {
                cat ${line} | gzip > ${line}.gz
                cat ${line} | bzip2 > ${line}.bz2
                cat ${line} | lzma > ${line}.lzma
+               cat ${line} | xz > ${line}.xz
                msgdone "info"
        done
        generatereleasefiles
@@ -581,12 +594,12 @@ testequalor2() {
 }
 
 testshowvirtual() {
-       local VIRTUAL="N: Can't select versions from package '$1' as it purely virtual"
+       local VIRTUAL="N: Can't select versions from package '$1' as it is purely virtual"
        local PACKAGE="$1"
        shift
        while [ -n "$1" ]; do
                VIRTUAL="${VIRTUAL}
-N: Can't select versions from package '$1' as it purely virtual"
+N: Can't select versions from package '$1' as it is purely virtual"
                PACKAGE="${PACKAGE} $1"
                shift
        done
@@ -615,8 +628,8 @@ testnopackage() {
 
 testdpkginstalled() {
        msgtest "Test for correctly installed package(s) with" "dpkg -l $*"
-       local PKGS="$(dpkg -l $* | grep '^[a-z]' | grep '^[^i]' | wc -l)"
-       if [ "$PKGS" != 0 ]; then
+       local PKGS="$(dpkg -l $* | grep '^i' | wc -l)"
+       if [ "$PKGS" != $# ]; then
                echo $PKGS
                dpkg -l $* | grep '^[a-z]'
                msgfail
@@ -625,9 +638,9 @@ testdpkginstalled() {
        msgpass
 }
 
-testdpkgnoninstalled() {
-       msgtest "Test for correctly non-installed package(s) with" "dpkg -l $*"
-       local PKGS="$(dpkg -l $* | grep '^[a-z]' | grep '^[^u]' | wc -l)"
+testdpkgnotinstalled() {
+       msgtest "Test for correctly not-installed package(s) with" "dpkg -l $*"
+       local PKGS="$(dpkg -l $* 2> /dev/null | grep '^i' | wc -l)"
        if [ "$PKGS" != 0 ]; then
                echo
                dpkg -l $* | grep '^[a-z]'
@@ -636,3 +649,16 @@ testdpkgnoninstalled() {
        fi
        msgpass
 }
+
+testmarkedauto() {
+       local COMPAREFILE=$(mktemp)
+       addtrap "rm $COMPAREFILE;"
+       if [ -n "$1" ]; then
+               msgtest 'Test for correctly marked as auto-installed' "$*"
+               while [ -n "$1" ]; do echo "$1"; shift; done | sort > $COMPAREFILE
+       else
+               msgtest 'Test for correctly marked as auto-installed' 'no package'
+               echo > $COMPAREFILE
+       fi
+       aptmark showauto 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail
+}