diff options
author | David Kalnischkies <david@kalnischkies.de> | 2014-10-23 11:37:49 +0200 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2014-10-23 16:54:27 +0200 |
commit | 10e100e59a96ea7b6834a139beab5d9d70180633 (patch) | |
tree | 5647642e1631494ab779d71529b6baf63696c8aa | |
parent | 0e0d9919cc1749e5343b2076084d77122db1820d (diff) |
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
6 files changed, 39 insertions, 45 deletions
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 <joe@example.org>" >> $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() { diff --git a/test/integration/test-apt-get-upgrade b/test/integration/test-apt-get-upgrade index 5335c243a..d042e4fb7 100755 --- a/test/integration/test-apt-get-upgrade +++ b/test/integration/test-apt-get-upgrade @@ -8,23 +8,18 @@ setupenvironment configarchitecture "i386" # simple case -insertpackage 'stable' 'upgrade-simple' 'all' '1.0' +insertpackage 'stable,installed' 'upgrade-simple' 'all' '1.0' insertpackage 'unstable' 'upgrade-simple' 'all' '2.0' -insertinstalledpackage 'upgrade-simple' 'all' '1.0' # upgrade with a new dependency -insertpackage 'stable' 'upgrade-with-new-dep' 'all' '1.0' +insertpackage 'stable,installed' 'upgrade-with-new-dep' 'all' '1.0' insertpackage 'unstable' 'upgrade-with-new-dep' 'all' '2.0' 'Depends: new-dep' insertpackage 'stable' 'new-dep' 'all' '1.0' -insertinstalledpackage 'upgrade-with-new-dep' 'all' '1.0' # upgrade with conflict and a new pkg with higher priority than conflict -insertpackage 'stable' 'upgrade-with-conflict' 'all' '1.0' +insertpackage 'stable,installed' 'upgrade-with-conflict' 'all' '1.0' insertpackage 'unstable' 'upgrade-with-conflict' 'all' '2.0' 'Conflicts: conflicting-dep' 'standard' -insertpackage 'stable' 'conflicting-dep' 'all' '1.0' -insertinstalledpackage 'upgrade-with-conflict' 'all' '1.0' -insertinstalledpackage 'conflicting-dep' 'all' '1.0' - +insertpackage 'stable,installed' 'conflicting-dep' 'all' '1.0' setupaptarchive diff --git a/test/integration/test-bug-745036-new-foreign-invalidates-cache b/test/integration/test-bug-745036-new-foreign-invalidates-cache index 490cbecdd..2b7ee06ad 100755 --- a/test/integration/test-bug-745036-new-foreign-invalidates-cache +++ b/test/integration/test-bug-745036-new-foreign-invalidates-cache @@ -6,10 +6,8 @@ TESTDIR=$(readlink -f $(dirname $0)) setupenvironment configarchitecture 'amd64' -insertpackage 'unstable' 'cool-foo' 'amd64' '1.0' 'Depends: foo' -insertpackage 'unstable' 'foo' 'amd64' '1.0' 'Multi-Arch: foreign' -insertinstalledpackage 'cool-foo' 'amd64' '1.0' 'Depends: foo' -insertinstalledpackage 'foo' 'amd64' '1.0' 'Multi-Arch: foreign' +insertpackage 'unstable,installed' 'cool-foo' 'amd64' '1.0' 'Depends: foo' +insertpackage 'unstable,installed' 'foo' 'amd64' '1.0' 'Multi-Arch: foreign' setupaptarchive diff --git a/test/integration/test-bug-753297-upgradable b/test/integration/test-bug-753297-upgradable index 068704b3e..01395a095 100755 --- a/test/integration/test-bug-753297-upgradable +++ b/test/integration/test-bug-753297-upgradable @@ -16,8 +16,7 @@ Pin: release unstable Pin-Priority: 1 EOF -insertinstalledpackage 'foo' 'all' '1' -insertpackage 'testing' 'foo' 'all' '1' +insertpackage 'testing,installed' 'foo' 'all' '1' insertpackage 'testing-updates' 'foo' 'all' '2' insertpackage 'unstable' 'foo' 'all' '3' diff --git a/test/integration/test-prevent-markinstall-multiarch-same-versionscrew b/test/integration/test-prevent-markinstall-multiarch-same-versionscrew index 9d2ea2d5d..db97687ce 100755 --- a/test/integration/test-prevent-markinstall-multiarch-same-versionscrew +++ b/test/integration/test-prevent-markinstall-multiarch-same-versionscrew @@ -9,20 +9,17 @@ configarchitecture 'amd64' 'i386' 'armel' insertpackage 'stable' 'allarchs' 'all' '1' insertpackage 'unstable' 'allarchs' 'all' '2' -insertinstalledpackage 'fine' 'i386,amd64' '1' 'Multi-Arch: same' -insertpackage 'stable' 'fine' 'i386,amd64' '1' 'Multi-Arch: same' +insertpackage 'stable,installed' 'fine' 'i386,amd64' '1' 'Multi-Arch: same' insertpackage 'unstable' 'fine' 'amd64,i386' '2' 'Multi-Arch: same' insertinstalledpackage 'fine-installed' 'i386,amd64' '1' 'Multi-Arch: same' insertpackage 'stable' 'fine-installed' 'i386,amd64,armel' '1' 'Multi-Arch: same' insertpackage 'unstable' 'fine-installed' 'i386,amd64' '2' 'Multi-Arch: same' -insertinstalledpackage 'out-of-sync-native' 'i386,amd64' '1' 'Multi-Arch: same' -insertpackage 'stable' 'out-of-sync-native' 'i386,amd64' '1' 'Multi-Arch: same' +insertpackage 'stable,installed' 'out-of-sync-native' 'i386,amd64' '1' 'Multi-Arch: same' insertpackage 'unstable' 'out-of-sync-native' 'amd64' '2' 'Multi-Arch: same' -insertinstalledpackage 'out-of-sync-foreign' 'i386,amd64' '1' 'Multi-Arch: same' -insertpackage 'stable' 'out-of-sync-foreign' 'i386,amd64' '1' 'Multi-Arch: same' +insertpackage 'stable,installed' 'out-of-sync-foreign' 'i386,amd64' '1' 'Multi-Arch: same' insertpackage 'unstable' 'out-of-sync-foreign' 'i386' '2' 'Multi-Arch: same' insertinstalledpackage 'out-of-sync-gone-native' 'i386,amd64' '1' 'Multi-Arch: same' diff --git a/test/integration/test-suggest-installed-multiarch-silbing b/test/integration/test-suggest-installed-multiarch-silbing index d55d250aa..89640a30c 100755 --- a/test/integration/test-suggest-installed-multiarch-silbing +++ b/test/integration/test-suggest-installed-multiarch-silbing @@ -9,8 +9,7 @@ configarchitecture 'amd64' 'i386' 'armel' insertinstalledpackage 'foo' 'i386' '1' insertpackage 'unstable' 'foo' 'amd64,i386' '1' -insertinstalledpackage 'foo2' 'i386' '1' -insertpackage 'unstable' 'foo2' 'i386' '1' +insertpackage 'unstable,installed' 'foo2' 'i386' '1' insertinstalledpackage 'foo3' 'amd64' '1' insertpackage 'unstable' 'foo3' 'amd64,i386' '1' |