]> git.saurik.com Git - apt.git/commitdiff
tests: support 'installed' release in insertpackage
authorDavid Kalnischkies <david@kalnischkies.de>
Thu, 23 Oct 2014 09:37:49 +0000 (11:37 +0200)
committerDavid Kalnischkies <david@kalnischkies.de>
Thu, 23 Oct 2014 14:54:27 +0000 (16:54 +0200)
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
test/integration/test-apt-get-upgrade
test/integration/test-bug-745036-new-foreign-invalidates-cache
test/integration/test-bug-753297-upgradable
test/integration/test-prevent-markinstall-multiarch-same-versionscrew
test/integration/test-suggest-installed-multiarch-silbing

index ea3903056f6f0782baffd53051929bcf0994fd7c..190d4d665a48305e268c8178f515b9e6cd116e48 100644 (file)
@@ -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() {
index 5335c243aa240c1460da3ef2aafdc3ac1a9f2a02..d042e4fb73c6ad4148e8cb1d2068d05d6e90f0da 100755 (executable)
@@ -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
 
index 490cbecdd94a34164926c70e040a384825901859..2b7ee06ad426f28fd0f561875f3d13084ceca52e 100755 (executable)
@@ -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
 
index 068704b3e73a1ad11ff74556c4ff8faf2b0415e4..01395a095aa98a0520ab1cf82c8bc705a4d579cc 100755 (executable)
@@ -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'
 
index 9d2ea2d5da6f44e47da76ec65239203169073ae2..db97687ce0276af89c78af9e88a3c426fb00ca68 100755 (executable)
@@ -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'
index d55d250aad260241606b17115103e29f4452d747..89640a30cbb21c9513a37c86e26af192e699c189 100755 (executable)
@@ -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'