summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/integration/framework129
-rwxr-xr-xtest/integration/test-bug-590041-prefer-non-virtual-packages2
-rwxr-xr-xtest/integration/test-bug-590438-broken-provides-thanks-to-remove-order2
-rwxr-xr-xtest/integration/test-bug-591882-conkeror2
4 files changed, 125 insertions, 10 deletions
diff --git a/test/integration/framework b/test/integration/framework
index 5e6c5427f..e3d77c5cd 100644
--- a/test/integration/framework
+++ b/test/integration/framework
@@ -92,10 +92,124 @@ configarchitecture() {
done
}
-buildflataptarchive() {
- msginfo "Build APT archive for ${CCMD}$0${CINFO}…"
+buildsimplenativepackage() {
+ local NAME="$1"
+ local ARCH="$2"
+ local VERSION="$3"
+ local RELEASE="${4:-unstable}"
+ local DEPENDENCIES="$5"
+ local DESCRIPTION="$6"
+ msgndebug "Build package ${CCMD}${NAME}=${VERSION}/${RELEASE}${CDEBUG}… "
+ local BUILDDIR=incoming/${NAME}-${VERSION}
+ mkdir -p ${BUILDDIR}/debian/source
+ cd ${BUILDDIR}
+ echo "* most suckless software product ever" > FEATURES
+ test -e debian/copyright || (echo "Copyleft by Joe Sixpack $(date +%Y)" > debian/copyright)
+ test -e debian/changelog || (echo "$NAME ($VERSION) $RELEASE; urgency=low
+
+ * Initial release
+
+ -- Joe Sixpack <joe@example.org> $(date -R)" > debian/changelog)
+ test -e debian/control || (echo "Source: $NAME
+Section: admin
+Priority: optional
+Maintainer: Joe Sixpack <joe@example.org>
+Build-Depends: debhelper (>= 7)
+Standards-Version: 3.9.1
+
+Package: $NAME
+Architecture: $ARCH" > debian/control)
+ 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
+ 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
+ dpkg-buildpackage -uc -us -a$ARCH > /dev/null 2> /dev/null
+ cd - > /dev/null
+ rm -rf $BUILDDIR
+ msgdone "debug"
+}
+
+buildaptarchive() {
+ msgninfo "Build APT archive for ${CCMD}$0${CINFO} based on "
+ if [ -d incoming ]; then
+ buildaptarchivefromincoming $*
+ else
+ buildaptarchivefromfiles $*
+ fi
+}
+
+createaptftparchiveconfig() {
+ local ARCHS="$(find pool/ -name '*.deb' | grep -oE '_[a-z0-9-]+\.deb$' | sort | uniq | sed -e '/^_all.deb$/ d' -e 's#^_\([a-z0-9-]*\)\.deb$#\1#' | tr '\n' ' ')"
+ echo -n 'Dir {
+ ArchiveDir "' >> ftparchive.conf
+ echo -n $(readlink -f .) >> ftparchive.conf
+ echo -n '";
+ CacheDir "' >> ftparchive.conf
+ echo -n $(readlink -f ..) >> ftparchive.conf
+ echo -n '";
+};
+TreeDefault {
+ Directory "pool/";
+ SrcDirectory "pool/";
+};
+APT {
+ FTPArchive {
+ Release {
+ Origin "joesixpack";
+ Label "apttestcases";
+ Suite "unstable";
+ Description "repository with dummy packages";
+ Architectures "' >> ftparchive.conf
+ echo -n "$ARCHS" >> ftparchive.conf
+ echo 'source";
+ };
+ };
+};' >> ftparchive.conf
+ if [ -z "$1" ]; then
+ echo -n 'tree "dists/unstable" {
+ Architectures "' >> ftparchive.conf
+ echo -n "$ARCHS" >> ftparchive.conf
+ echo 'source";
+ Sections "main";
+};' >> ftparchive.conf
+ fi
+}
+
+buildaptftparchivedirectorystructure() {
+ local ARCHS="$(find pool/ -name '*.deb' | grep -oE '_[a-z0-9-]+\.deb$' | sort | uniq | sed -e '/^_all.deb$/ d' -e 's#^_\([a-z0-9-]*\)\.deb$#\1#')"
+ for arch in $ARCHS; do
+ mkdir -p dists/unstable/main/binary-${arch}
+ done
+ mkdir -p dists/unstable/main/source
+ mkdir -p dists/unstable/main/i18n
+}
+
+buildaptarchivefromincoming() {
+ msginfo "incoming packages…"
+ cd aptarchive
+ [ -e pool ] || ln -s ../incoming pool
+ [ -e ftparchive.conf ] || createaptftparchiveconfig
+ [ -e dists ] || buildaptftparchivedirectorystructure
+ aptftparchive -qq generate ftparchive.conf
+ for dir in $(find ./dists -mindepth 1 -maxdepth 1 -type d); do
+ aptftparchive -qq release $dir > $dir/Release
+ sed -i -e '/0 Release$/ d' $dir/Release # remove the self reference
+ done
+ cd - > /dev/null
+ msgdone "info"
+}
+
+buildaptarchivefromfiles() {
+ msginfo "prebuild files…"
cd aptarchive
- APTARCHIVE=$(readlink -f .)
if [ -f Packages ]; then
msgninfo "\tPackages file… "
cat Packages | gzip > Packages.gz
@@ -110,13 +224,14 @@ buildflataptarchive() {
cat Sources | lzma > Sources.lzma
msgdone "info"
fi
+ aptftparchive -qq release . > Release
+ sed -i -e '/0 Release$/ d' Release # remove the self reference
cd ..
- aptftparchive release . > Release
}
-setupflataptarchive() {
- buildflataptarchive
- APTARCHIVE=$(readlink -f ./aptarchive)
+setupaptarchive() {
+ buildaptarchive
+ local APTARCHIVE=$(readlink -f ./aptarchive)
if [ -f ${APTARCHIVE}/Packages ]; then
msgninfo "\tadd deb sources.list line… "
echo "deb file://$APTARCHIVE /" > rootdir/etc/apt/sources.list.d/apt-test-archive-deb.list
diff --git a/test/integration/test-bug-590041-prefer-non-virtual-packages b/test/integration/test-bug-590041-prefer-non-virtual-packages
index aa9e487e1..3e2693f85 100755
--- a/test/integration/test-bug-590041-prefer-non-virtual-packages
+++ b/test/integration/test-bug-590041-prefer-non-virtual-packages
@@ -41,7 +41,7 @@ $pkglibc6
$pkglibdb1
EOF
-setupflataptarchive
+setupaptarchive
testshowvirtual libc6:i386
testequal "$pkglibc6" aptcache show libc6:armel
diff --git a/test/integration/test-bug-590438-broken-provides-thanks-to-remove-order b/test/integration/test-bug-590438-broken-provides-thanks-to-remove-order
index 17ce50295..9fd7741f4 100755
--- a/test/integration/test-bug-590438-broken-provides-thanks-to-remove-order
+++ b/test/integration/test-bug-590438-broken-provides-thanks-to-remove-order
@@ -6,7 +6,7 @@ local TESTDIR=$(readlink -f $(dirname $0))
setupenvironment
configarchitecture "i386"
-setupflataptarchive
+setupaptarchive
pkgbasefile="Package: base-files
Status: install ok installed
diff --git a/test/integration/test-bug-591882-conkeror b/test/integration/test-bug-591882-conkeror
index cba7e7665..b1dbb3a0a 100755
--- a/test/integration/test-bug-591882-conkeror
+++ b/test/integration/test-bug-591882-conkeror
@@ -5,7 +5,7 @@ local TESTDIR=$(readlink -f $(dirname $0))
. $TESTDIR/framework
setupenvironment
configarchitecture "i386"
-setupflataptarchive
+setupaptarchive
UPGRADEFAIL="Reading package lists...
Building dependency tree...