diff options
author | David Kalnischkies <david@kalnischkies.de> | 2016-06-30 18:10:19 +0200 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2016-06-30 18:10:19 +0200 |
commit | b8242321065c0f0e498ffcf6ba92675a19011dd4 (patch) | |
tree | 98981c247e5ac48b4dd9575b4ba871ad90553544 /test/integration | |
parent | 309f497b7280a45e3626493318adb6d39ba5c69b (diff) | |
download | apt-b8242321065c0f0e498ffcf6ba92675a19011dd4.tar.gz |
tests: deduplicate package creation framework code
Gbp-Dch: Ignore
Diffstat (limited to 'test/integration')
-rw-r--r-- | test/integration/framework | 96 |
1 files changed, 38 insertions, 58 deletions
diff --git a/test/integration/framework b/test/integration/framework index 795731deb..bebcbf342 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -594,7 +594,7 @@ Dir::Bin::uncompressed \"/does/not/exist\";" > "$CONFFILE" done } -setupsimplenativepackage() { +_setupsimplenativepackage() { local NAME="$1" local ARCH="$2" local VERSION="$3" @@ -606,62 +606,6 @@ setupsimplenativepackage() { und used only by testcases and serve no other purposeā¦"}" local SECTION="${7:-others}" - local DISTSECTION - if [ "$SECTION" = "${SECTION#*/}" ]; then - DISTSECTION="main" - else - DISTSECTION="${SECTION%/*}" - fi - 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 -u +%Y)" > debian/copyright - test -e debian/changelog || echo "$NAME ($VERSION) $RELEASE; urgency=low - - * Initial release - - -- Joe Sixpack <joe@example.org> $(date -u -R)" > debian/changelog - test -e debian/control || echo "Source: $NAME -Section: $SECTION -Priority: optional -Maintainer: Joe Sixpack <joe@example.org> -Build-Depends: debhelper (>= 7) -Standards-Version: 3.9.1 - -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 - echo "Description: $DESCRIPTION" >> debian/control - - 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 - cd - > /dev/null -} - -buildsimplenativepackage() { - local NAME="$1" - local NM - if [ "$(echo "$NAME" | cut -c 1-3)" = 'lib' ]; then - NM="$(echo "$NAME" | cut -c 1-4)" - else - NM="$(echo "$NAME" | cut -c 1)" - fi - local ARCH="$2" - local VERSION="$3" - local RELEASE="${4:-unstable}" - local DEPENDENCIES="$5" - local DESCRIPTION="${6:-"an autogenerated dummy ${NAME}=${VERSION}/${RELEASE} - If you find such a package installed on your system, - something went horribly wrong! They are autogenerated - und used only by testcases and serve no other purposeā¦"}" - - local SECTION="${7:-others}" local PRIORITY="${8:-optional}" local FILE_TREE="$9" local COMPRESS_TYPE="${10:-gzip}" @@ -673,7 +617,6 @@ buildsimplenativepackage() { fi local BUILDDIR="${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}" - msgtest "Build source package in version ${VERSION} for ${RELEASE} in ${DISTSECTION}" "$NAME" mkdir -p "$BUILDDIR/debian/source" echo "* most suckless software product ever" > "${BUILDDIR}/FEATURES" echo "#!/bin/sh @@ -709,6 +652,37 @@ Package: $NAME" } > "${BUILDDIR}/debian/control" echo '3.0 (native)' > "${BUILDDIR}/debian/source/format" +} + +setupsimplenativepackage() { + _setupsimplenativepackage "$@" + local NAME="$1" + local VERSION="$3" + local BUILDDIR="${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}" + test -e "${BUILDDIR}/debian/compat" || echo '7' > "${BUILDDIR}/debian/compat" + test -e "${BUILDDIR}/debian/rules" || cp /usr/share/doc/debhelper/examples/rules.tiny "${BUILDDIR}/debian/rules" +} + +buildsimplenativepackage() { + local NAME="$1" + local ARCH="$2" + local VERSION="$3" + local RELEASE="${4:-unstable}" + local DEPENDENCIES="$5" + local DESCRIPTION="$6" + local SECTION="${7:-others}" + local PRIORITY="${8:-optional}" + local FILE_TREE="$9" + local COMPRESS_TYPE="${10:-gzip}" + local DISTSECTION + if [ "$SECTION" = "${SECTION#*/}" ]; then + DISTSECTION="main" + else + DISTSECTION="${SECTION%/*}" + fi + local BUILDDIR="${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}" + msgtest "Build source package in version ${VERSION} for ${RELEASE} in ${DISTSECTION}" "$NAME" + _setupsimplenativepackage "$@" cd "${BUILDDIR}/.." testsuccess --nomsg dpkg-source -b ${NAME}-${VERSION} cd - >/dev/null @@ -742,6 +716,12 @@ Package: $NAME" echo "pool/${NAME}_${VERSION}_${arch}.deb" >> "${BUILDDIR}/../${RELEASE}.${DISTSECTION}.pkglist" done + local NM + if [ "$(echo "$NAME" | cut -c 1-3)" = 'lib' ]; then + NM="$(echo "$NAME" | cut -c 1-4)" + else + NM="$(echo "$NAME" | cut -c 1)" + fi local CHANGEPATH="${BUILDDIR}/../${DISTSECTION}/${NM}/${NAME}/${NAME}_${VERSION}" mkdir -p "$CHANGEPATH" cp "${BUILDDIR}/debian/changelog" "$CHANGEPATH" |