Просмотр исходного кода

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
David Kalnischkies лет назад: 11
Родитель
Сommit
10e100e59a

+ 28 - 22
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() {

+ 4 - 9
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
 

+ 2 - 4
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
 

+ 1 - 2
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'
 

+ 3 - 6
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'

+ 1 - 2
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'