]> git.saurik.com Git - apt.git/blobdiff - test/integration/framework
check that the right amount of packages is installed if multiple passed in
[apt.git] / test / integration / framework
index f55cfddfab854ce6b1bb51bf9f0450d8a32ef985..3aa80db23048eafac2c9ba76919a0c37b02bee6b 100644 (file)
@@ -188,8 +188,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}
@@ -219,9 +223,57 @@ buildsimplenativepackage() {
        else
                DISTSECTION="$(echo "$SECTION" | cut -d'/' -f 1)"
        fi
-       setupsimplenativepackage "$NAME" "$ARCH" "$VERSION" "$RELEASE" "$DEPENDENCIES" "$DESCRIPTION" "$SECTION"
-       buildpackage "incoming/${NAME}-${VERSION}" "$RELEASE" "$DISTSECTION"
-       rm -rf "incoming/${NAME}-${VERSION}"
+       local BUILDDIR=${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}
+
+       msgninfo "Build package ${NAME} in ${VERSION} for ${RELEASE} in ${DISTSECTION}… "
+       mkdir -p $BUILDDIR/debian/source
+       echo "* most suckless software product ever" > ${BUILDDIR}/FEATURES
+       echo "#!/bin/sh
+echo '$NAME says \"Hello!\"'" > ${BUILDDIR}/${NAME}
+
+       echo "Copyleft by Joe Sixpack $(date +%Y)" > ${BUILDDIR}/debian/copyright
+       echo "$NAME ($VERSION) $RELEASE; urgency=low
+
+  * Initial release
+
+ -- Joe Sixpack <joe@example.org>  $(date -R)" > ${BUILDDIR}/debian/changelog
+       echo "Source: $NAME
+Section: $SECTION
+Priority: optional
+Maintainer: Joe Sixpack <joe@example.org>
+Standards-Version: 3.9.1
+
+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}
+ 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" >> ${BUILDIR}/debian/control
+       fi
+       echo '3.0 (native)' > ${BUILDDIR}/debian/source/format
+       local SRCS="$( (cd ${BUILDDIR}/..; dpkg-source -b ${NAME}-${VERSION} 2>&1) | grep '^dpkg-source: info: building' | grep -o '[a-z0-9._+~-]*$')"
+
+       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 -DArchitecture=$ARCH)
+       (cd ${BUILDDIR}/debian/tmp; md5sum $(find usr/ -type f) > DEBIAN/md5sums)
+
+       dpkg-deb --build ${BUILDDIR}/debian/tmp ${BUILDDIR}/.. > /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
+       rm -rf "${BUILDDIR}"
+       msgdone "info"
 }
 
 buildpackage() {
@@ -275,6 +327,8 @@ Default {
        Packages::Compress ". gzip bzip2 lzma";
        Sources::Compress ". gzip bzip2 lzma";
        Contents::Compress ". gzip bzip2 lzma";
+       Translation::Compress ". gzip bzip2 lzma";
+       LongDescription "false";
 };
 TreeDefault {
        Directory "pool/";
@@ -389,6 +443,9 @@ generatereleasefiles() {
        msgninfo "\tGenerate Release files… "
        local DATE="${1:-now}"
        if [ -e aptarchive/dists ]; then
+               for dir in $(find ./aptarchive/dists -mindepth 3 -maxdepth 3 -type d -name 'i18n'); do
+                       aptftparchive -qq release $dir -o APT::FTPArchive::Release::Patterns::='Translation-*' > $dir/Index
+               done
                for dir in $(find ./aptarchive/dists -mindepth 1 -maxdepth 1 -type d); do
                        local CODENAME="$(echo "$dir" | cut -d'/' -f 4)"
                        aptftparchive -qq release $dir -o APT::FTPArchive::Release::Suite="${CODENAME}" -o APT::FTPArchive::Release::Codename="${CODENAME}" | sed -e '/0 Release$/ d' > $dir/Release # remove the self reference
@@ -566,8 +623,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
@@ -576,9 +633,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]'