From 10e100e59a96ea7b6834a139beab5d9d70180633 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 23 Oct 2014 11:37:49 +0200 Subject: tests: support 'installed' release in insertpackage It is sometimes handy to have an installed package also in the archive, but this was until now harder than it should as you had to duplicate the lines, which is especially dangerous while writing the tests as it easily happens that these two lines divert and so the same-but-different version detection kicks in. Git-Dch: Ignore --- test/integration/framework | 50 ++++++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 22 deletions(-) (limited to 'test/integration/framework') diff --git a/test/integration/framework b/test/integration/framework index ea3903056..190d4d665 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -664,47 +664,53 @@ buildaptftparchivedirectorystructure() { } insertpackage() { - local RELEASE="$1" + local RELEASES="$1" local NAME="$2" local ARCH="$3" local VERSION="$4" local DEPENDENCIES="$5" local PRIORITY="${6:-optional}" - local DESCRIPTION="${7:-"an autogenerated dummy ${NAME}=${VERSION}/${RELEASE} + local DESCRIPTION="${7:-"an autogenerated dummy ${NAME}=${VERSION}/${RELEASES} If you find such a package installed on your system, something went horribly wrong! They are autogenerated und used only by testcases and surf no other proposeā€¦"}" local ARCHS="" - for arch in $(getarchitecturesfromcommalist "$ARCH"); do - if [ "$arch" = 'all' -o "$arch" = 'none' ]; then - ARCHS="$(getarchitectures)" - else - ARCHS="$arch" + for RELEASE in $(printf '%s' "$RELEASES" | tr ',' '\n'); do + if [ "$RELEASE" = 'installed' ]; then + insertinstalledpackage "$2" "$3" "$4" "$5" "$6" "$7" + continue fi - for BUILDARCH in $ARCHS; do - local PPATH="aptarchive/dists/${RELEASE}/main/binary-${BUILDARCH}" - mkdir -p $PPATH - local FILE="${PPATH}/Packages" - echo "Package: $NAME + for arch in $(getarchitecturesfromcommalist "$ARCH"); do + if [ "$arch" = 'all' -o "$arch" = 'none' ]; then + ARCHS="$(getarchitectures)" + else + ARCHS="$arch" + fi + for BUILDARCH in $ARCHS; do + local PPATH="aptarchive/dists/${RELEASE}/main/binary-${BUILDARCH}" + mkdir -p $PPATH + local FILE="${PPATH}/Packages" + echo "Package: $NAME Priority: $PRIORITY Section: other Installed-Size: 42 Maintainer: Joe Sixpack " >> $FILE - test "$arch" = 'none' || echo "Architecture: $arch" >> $FILE - echo "Version: $VERSION + test "$arch" = 'none' || echo "Architecture: $arch" >> $FILE + echo "Version: $VERSION Filename: pool/main/${NAME}/${NAME}_${VERSION}_${arch}.deb" >> $FILE - test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE - echo "Description: $(printf '%s' "$DESCRIPTION" | head -n 1)" >> $FILE - echo "Description-md5: $(printf '%s' "$DESCRIPTION" | md5sum | cut -d' ' -f 1)" >> $FILE - echo >> $FILE + test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE + echo "Description: $(printf '%s' "$DESCRIPTION" | head -n 1)" >> $FILE + echo "Description-md5: $(printf '%s' "$DESCRIPTION" | md5sum | cut -d' ' -f 1)" >> $FILE + echo >> $FILE + done done - done - mkdir -p aptarchive/dists/${RELEASE}/main/source aptarchive/dists/${RELEASE}/main/i18n - touch aptarchive/dists/${RELEASE}/main/source/Sources - echo "Package: $NAME + mkdir -p aptarchive/dists/${RELEASE}/main/source aptarchive/dists/${RELEASE}/main/i18n + touch aptarchive/dists/${RELEASE}/main/source/Sources + echo "Package: $NAME Description-md5: $(printf '%s' "$DESCRIPTION" | md5sum | cut -d' ' -f 1) Description-en: $DESCRIPTION " >> aptarchive/dists/${RELEASE}/main/i18n/Translation-en + done } insertsource() { -- cgit v1.2.3