]> git.saurik.com Git - apt.git/commitdiff
use apt-mark instead of hand-mangling with the extended_states file
authorDavid Kalnischkies <kalnischkies@gmail.com>
Thu, 10 Feb 2011 17:10:14 +0000 (18:10 +0100)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Thu, 10 Feb 2011 17:10:14 +0000 (18:10 +0100)
test/integration/framework
test/integration/test-apt-get-autoremove
test/integration/test-bug-604222-new-and-autoremove
test/integration/test-bug-611729-mark-as-manual
test/integration/test-disappearing-packages

index e10709079907410bbc63b977d8ed2bb92b00aa58..11d9a9659a578c85bdf7ad0dd050d5eafcea4088 100644 (file)
@@ -79,6 +79,7 @@ aptcache() { runapt apt-cache $*; }
 aptget() { runapt apt-get $*; }
 aptftparchive() { runapt apt-ftparchive $*; }
 aptkey() { runapt apt-key $*; }
+aptmark() { runapt apt-mark $*; }
 dpkg() {
        $(which dpkg) --root=${TMPWORKINGDIRECTORY}/rootdir --force-not-root --force-bad-path --log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log $*
 }
@@ -647,3 +648,16 @@ testdpkgnotinstalled() {
        fi
        msgpass
 }
+
+testmarkedauto() {
+       local COMPAREFILE=$(mktemp)
+       addtrap "rm $COMPAREFILE;"
+       if [ -n "$1" ]; then
+               msgtest 'Test for correctly marked as auto-installed' "$*"
+               while [ -n "$1" ]; do echo "$1"; shift; done | sort > $COMPAREFILE
+       else
+               msgtest 'Test for correctly marked as auto-installed' 'no package'
+               echo > $COMPAREFILE
+       fi
+       aptmark showauto 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail
+}
index 9dfab19f56c91427816aef320e33854cc7ac8b1a..c25ce3f585530daa1964c7c5f80b5885c4c84466 100755 (executable)
@@ -14,10 +14,7 @@ setupaptarchive
 aptget install unrelated debhelper -qq 2>&1 > /dev/null
 testdpkginstalled 'unrelated' 'debhelper' 'po-debconf'
 
-testfileequal 'rootdir/var/lib/apt/extended_states' 'Package: po-debconf
-Architecture: i386
-Auto-Installed: 1
-'
+testmarkedauto 'po-debconf'
 aptget remove debhelper -y -qq 2>&1 > /dev/null
 testdpkgnotinstalled 'debhelper'
 testdpkginstalled 'po-debconf' 'unrelated'
@@ -43,8 +40,7 @@ testdpkginstalled "po-debconf"
 rm rootdir/etc/apt/apt.conf.d/00autoremove
 aptget autoremove -y -qq 2>&1 > /dev/null
 testdpkgnotinstalled 'po-debconf'
-
-testfileequal 'rootdir/var/lib/apt/extended_states' ''
+testmarkedauto
 
 sed -i rootdir/var/log/apt/history.log -e '/^Commandline: / d' -e '/^Start-Date: / d' -e '/^End-Date: / d'
 testfileequal 'rootdir/var/log/apt/history.log' '
index fa6dcdc70a0b8403cbffac12e7835601cc061140..9187dd1cdacaa416f644ed34dffb29c3bc22d613 100755 (executable)
@@ -7,9 +7,9 @@ setupenvironment
 configarchitecture "i386"
 setupaptarchive
 
-echo 'Package: libvtk5.4
-Auto-Installed: 1
-Architecture: i386' > rootdir/var/lib/apt/extended_states
+touch rootdir/var/lib/apt/extended_states
+aptmark markauto 'libvtk5.4'
+testmarkedauto 'libvtk5.4'
 
 testequal "Reading package lists...
 Building dependency tree...
index 9c1cd3d1b34dbb6a9757e934d2f18719ae2cbf51..4e3e2fa0b237ba9952b0fa6e62323ae153b4eb31 100755 (executable)
@@ -17,59 +17,41 @@ setupaptarchive
 # dpkg freaks out if the last package is removed so keep one around
 aptget install peace-dpkg -y -qq 2>&1 > /dev/null
 testdpkginstalled peace-dpkg
-testfileequal 'rootdir/var/lib/apt/extended_states' ''
+testmarkedauto
 
 aptget install a -y -qq 2>&1 > /dev/null
 testdpkginstalled a b
 testdpkgnotinstalled c
-testfileequal 'rootdir/var/lib/apt/extended_states' 'Package: b
-Architecture: i386
-Auto-Installed: 1
-'
+testmarkedauto 'b'
 
 aptget remove a -y -qq 2>&1 > /dev/null
 testdpkgnotinstalled a c
 testdpkginstalled b
-testfileequal 'rootdir/var/lib/apt/extended_states' 'Package: b
-Architecture: i386
-Auto-Installed: 1
-'
+testmarkedauto 'b'
 
 aptget install c -y -qq 2>&1 > /dev/null
 testdpkgnotinstalled a
 testdpkginstalled b c
-testfileequal 'rootdir/var/lib/apt/extended_states' 'Package: b
-Architecture: i386
-Auto-Installed: 1
-'
+testmarkedauto 'b'
 
 testequal 'Reading package lists...
 Building dependency tree...
 Reading state information...
 b is already the newest version.
 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget install b --only-upgrade
-testfileequal 'rootdir/var/lib/apt/extended_states' 'Package: b
-Architecture: i386
-Auto-Installed: 1
-'
+testmarkedauto 'b'
 
 testequal 'Reading package lists...
 Building dependency tree...
 Reading state information...
 b is already the newest version.
 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget install b -d
-testfileequal 'rootdir/var/lib/apt/extended_states' 'Package: b
-Architecture: i386
-Auto-Installed: 1
-'
+testmarkedauto 'b'
 
 aptget install b --reinstall -y -qq 2>&1 > /dev/null
 testdpkgnotinstalled a
 testdpkginstalled b c
-testfileequal 'rootdir/var/lib/apt/extended_states' 'Package: b
-Architecture: i386
-Auto-Installed: 1
-'
+testmarkedauto 'b'
 
 testequal 'Reading package lists...
 Building dependency tree...
@@ -77,29 +59,26 @@ Reading state information...
 b is already the newest version.
 b set to manually installed.
 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget install b
-testfileequal 'rootdir/var/lib/apt/extended_states' 'Package: b
-Architecture: i386
-Auto-Installed: 0
-'
+testmarkedauto
 
 aptget remove b -y -qq 2>&1 > /dev/null
 testdpkgnotinstalled a b c
-testfileequal 'rootdir/var/lib/apt/extended_states' ''
+testmarkedauto
 
 aptget install a b -y -qq 2>&1 > /dev/null
 testdpkginstalled a b
 testdpkgnotinstalled c
-testfileequal 'rootdir/var/lib/apt/extended_states' ''
+testmarkedauto
 
 aptget purge a b -y -qq 2>&1 > /dev/null
 testdpkgnotinstalled a b c
-testfileequal 'rootdir/var/lib/apt/extended_states' ''
+testmarkedauto
 
 aptget install b c -y -qq 2>&1 > /dev/null
 testdpkgnotinstalled a
 testdpkginstalled b c
-testfileequal 'rootdir/var/lib/apt/extended_states' ''
+testmarkedauto
 
 aptget install a -y -qq 2>&1 > /dev/null
 testdpkginstalled a b c
-testfileequal 'rootdir/var/lib/apt/extended_states' ''
+testmarkedauto
index 12d215d7a626cfedf6a0bc224df1dc7867d1d2e8..b5d565c2f13eb3ee839219633eedc3c0032346f3 100755 (executable)
@@ -31,7 +31,7 @@ setupaptarchive
 
 aptget install old-pkg=1.0 --trivial-only -qq 2>&1 > /dev/null
 
-testfileequal "rootdir/var/lib/apt/extended_states" "" # old-pkg is manual installed
+testmarkedauto # old-pkg is manual installed
 
 local CMD="aptget dist-upgrade -y -q=0"
 msgtest "Test for equality of" "$CMD"
@@ -51,4 +51,4 @@ Install: new-pkg:i386 (2.0, automatic)
 Upgrade: old-pkg:i386 (1.0, 2.0)
 Disappeared: old-pkg (1.0)"
 
-testfileequal "rootdir/var/lib/apt/extended_states" "" # new-pkg should have get the manual flag from old-pkg
+testmarkedauto  # new-pkg should have get the manual flag from old-pkg