X-Git-Url: https://git.hcoop.net/ntk/apt.git/blobdiff_plain/a23a7811d04b3f3f7ce761d025b684b3cf82b25e..ce9864a8bfdfc7f5380b3335a6a14f305d372d45:/test/integration/framework diff --git a/test/integration/framework b/test/integration/framework index 5e6c5427..e3d77c5c 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 $(date -R)" > debian/changelog) + test -e debian/control || (echo "Source: $NAME +Section: admin +Priority: optional +Maintainer: Joe Sixpack +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