4 TESTDIR
=$(readlink -f $(dirname $0)) 
   8 configcompression 
'.' 'xz' 'bz2' 'lzma' 'gz' 
   9 configarchitecture 
'i386' 
  11 buildsimplenativepackage 
'testpkg' 'i386' '1.0' 
  15 # fake a pdiff setup as apt wouldn't try pdiffs otherwise 
  16 find aptarchive 
-name 'Packages' -o -name 'Sources' | while read file; do 
  18         PATCHINDEX
="${file}.diff/Index" 
  19         echo 'SHA1-Current: adc83b19e793491b1c6ea0fd8b46cd9f32e592fc 0 
  21  adc83b19e793491b1c6ea0fd8b46cd9f32e592fc 33053002 2010-08-18-2013.28 
  22  ecfd1b19e793491b1c6ea123eabdcd9f32e592fc 33053001 2010-08-18-2013.29 
  24  abc1fc0ac57cd83d41c63195a9342e2db5650257 19722 2010-08-18-0814.28 
  25  dfe3444ac57cd83d41c63195a9342e2db5650257 19722 2010-08-18-0814.29' > $PATCHINDEX 
  32         msgtest 
'Check if all index files are' "${1:-uncompressed}" 
  33         if [ "$1" = 'compressed' ]; then 
  34                 ! test -e rootdir
/var
/lib
/apt
/lists
/*i386_Packages 
|| F
=1 
  35                 ! test -e rootdir
/var
/lib
/apt
/lists
/*all_Packages 
|| F
=1 
  36                 ! test -e rootdir
/var
/lib
/apt
/lists
/*_Sources 
|| F
=1 
  37                 ! test -e rootdir
/var
/lib
/apt
/lists
/*_Translation
-en || F
=1 
  38                 test -e rootdir
/var
/lib
/apt
/lists
/*i386_Packages.
${COMPRESS} || F
=1 
  39                 test -e rootdir
/var
/lib
/apt
/lists
/*all_Packages.
${COMPRESS} || F
=1 
  40                 test -e rootdir
/var
/lib
/apt
/lists
/*_Sources.
${COMPRESS} || F
=1 
  41                 test -e rootdir
/var
/lib
/apt
/lists
/*_Translation
-en.
${COMPRESS} || F
=1 
  42                 # there is no point in trying pdiff if we have compressed indexes 
  43                 # as we can't patch compressed files (well, we can, but what is the point?) 
  44                 ! test -e rootdir
/var
/lib
/apt
/lists
/*diff_Index 
|| F
=1 
  46                 # clear the faked pdiff indexes so the glob below works 
  47                 rm -f rootdir
/var
/lib
/apt
/lists
/*diff_Index
 
  48                 test -e rootdir
/var
/lib
/apt
/lists
/*i386_Packages 
|| F
=1 
  49                 test -e rootdir
/var
/lib
/apt
/lists
/*all_Packages 
|| F
=1 
  50                 test -e rootdir
/var
/lib
/apt
/lists
/*_Sources 
|| F
=1 
  51                 test -e rootdir
/var
/lib
/apt
/lists
/*_Translation
-en || F
=1 
  52                 ! test -e rootdir
/var
/lib
/apt
/lists
/*i386_Packages.
* || F
=1 
  53                 ! test -e rootdir
/var
/lib
/apt
/lists
/*all_Packages.
* || F
=1 
  54                 ! test -e rootdir
/var
/lib
/apt
/lists
/*_Sources.
* || F
=1 
  55                 ! test -e rootdir
/var
/lib
/apt
/lists
/*_Translation
-en.
* || F
=1 
  58                 cat rootdir
/tmp
/testsuccess.output
 
  59                 ls -laR rootdir
/var
/lib
/apt
/lists
/ 
  64         msgtest 
'Check if package is downloadable' 
  66         testsuccess 
--nomsg aptget download testpkg
 
  67         msgtest 
'deb file is present'; testsuccess 
--nomsg test -f testpkg_1.0_i386.deb
 
  68         rm -f testpkg_1.0_i386.deb
 
  70         testsuccessequal 
'Reading package lists... 
  71 Building dependency tree... 
  72 The following NEW packages will be installed: 
  74 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. 
  75 Inst testpkg (1.0 unstable [i386]) 
  76 Conf testpkg (1.0 unstable [i386])' aptget 
install testpkg 
-s 
  77         rm -f rootdir
/var
/cache
/apt
/pkgcache.bin rootdir
/var
/cache
/apt
/srcpkgcache.bin
 
  78         testsuccessequal 
"$GOODSHOW" aptcache show testpkg
 
  79         testsuccessequal 
"$GOODSHOW" aptcache show testpkg
 
  80         rm -f rootdir
/var
/cache
/apt
/pkgcache.bin rootdir
/var
/cache
/apt
/srcpkgcache.bin
 
  81         testsuccessequal 
"$GOODPOLICY" aptcache policy testpkg
 
  82         testsuccessequal 
"$GOODPOLICY" aptcache policy testpkg
 
  83         rm -f rootdir
/var
/cache
/apt
/pkgcache.bin rootdir
/var
/cache
/apt
/srcpkgcache.bin
 
  84         testsuccessequal 
"$GOODSHOWSRC" aptcache showsrc testpkg
 
  85         testsuccessequal 
"$GOODSHOWSRC" aptcache showsrc testpkg
 
  87         msgtest 
'Check if the source is aptgetable' 
  89         testsuccess 
--nomsg aptget 
source testpkg
 
  90         testsuccess 
test -s testpkg_1.0.dsc
 
  91         testsuccess 
test -d testpkg
-1.0
 
  94         testsuccessequal 
"$(aptcache show testpkg -o Acquire::Languages=none) 
  98 echo 'Debug::pkgAcquire::worker "true"; 
  99 debug::pkgAcquire::Auth "true"; 
 100 Debug::pkgAcquire::Diffs "true"; 
 101 Debug::Acquire::http "true";' > rootdir
/etc
/apt
/apt.conf.d
/99debugconf
 
 106         for INDEX 
in 'false' 'true'; do 
 107                 rm -rf rootdir
/var
/lib
/apt
/lists
 
 108                 echo "Acquire::GzipIndexes \"${INDEX}\";" > rootdir
/etc
/apt
/apt.conf.d
/02compressindex
 
 110                 if [ "$INDEX" = 'false' -o "$1" = 'cdrom' ]; then 
 111                         INDCOMP
='uncompressed' 
 116                 msgmsg 
"${1}: ${COMPRESSOR}: Test with $INDCOMP indexes gzip=$INDEX" 
 117                 if [ "${1}" = 'cdrom' ]; then 
 118                         testsuccess aptcdrom add 
</dev
/null
 
 120                 testsuccess aptget update
 
 123                 if [ "${1}" != 'cdrom' ]; then 
 124                         testsuccess aptget update 
-o Acquire
::Pdiffs
=1 
 125                         msgmsg 
"${1}: ${COMPRESSOR}: Test with $INDCOMP indexes gzip=$INDEX (update unchanged with pdiffs)" 
 128                         testsuccess aptget update 
-o Acquire
::Pdiffs
=0 
 129                         msgmsg 
"${1}: ${COMPRESSOR}: Test with $INDCOMP indexes gzip=$INDEX (update unchanged without pdiffs)" 
 133                 rm rootdir
/etc
/apt
/apt.conf.d
/02compressindex
 
 137 testsuccess aptget update
 
 138 GOODSHOW
="$(aptcache show testpkg) 
 140 test $(echo "$GOODSHOW" | grep -e '^Package: testpkg' -e '^Version: 1.0' -e '^Architecture: i386' | wc -l) -eq 3 || msgdie 
'show is broken' 
 141 testsuccessequal 
"$GOODSHOW" aptcache show testpkg
 
 142 GOODSHOWSRC
="$(aptcache showsrc testpkg) 
 144 test $(echo "$GOODSHOWSRC" | grep -e '^Package: testpkg' -e '^Format: 3.0 (native)' -e '^Files
:' -e '^Checksums
-Sha256:' | wc -l) -eq 4 || msgdie 'showsrc is broken
' 
 145 testsuccessequal "$GOODSHOWSRC" aptcache showsrc testpkg 
 146 GOODPOLICY="$(aptcache policy testpkg)" 
 147 test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^  Candidate:' -e '^  Installed: (none)' -e '500 file:/' | wc -l) -eq 4 || msgdie 
'file policy is broken' 
 148 testsuccessequal 
"$GOODPOLICY" aptcache policy testpkg
 
 149 for COMPRESSOR 
in 'gzip' 'bzip2' 'lzma' 'xz'; do testovermethod 
'file' $COMPRESSOR; done 
 151 rewritesourceslist 
"copy://${TMPWORKINGDIRECTORY}/aptarchive" 
 152 rm -rf rootdir
/var
/lib
/apt
/lists
 
 153 testsuccess aptget update
 
 154 GOODPOLICY
="$(aptcache policy testpkg)" 
 155 test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^  Candidate:' -e '^  Installed: (none)' -e '500 copy
:/' | wc -l) -eq 4 || msgdie 'copy policy is broken
' 
 156 testsuccessequal "$GOODPOLICY" aptcache policy testpkg 
 157 for COMPRESSOR in 'gzip' 'bzip2' 'lzma
' 'xz
'; do testovermethod 'copy
' $COMPRESSOR; done 
 160 rm -rf rootdir/var/lib/apt/lists 
 161 testsuccess aptget update 
 162 GOODPOLICY="$(aptcache policy testpkg)" 
 163 test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^  Candidate:' -e '^  Installed: (none)' -e '500 http://' | wc -l) -eq 4 || msgdie 
'http policy is broken' 
 164 testsuccessequal 
"$GOODPOLICY" aptcache policy testpkg
 
 165 for COMPRESSOR 
in 'gzip' 'bzip2' 'lzma' 'xz'; do testovermethod 
'http' $COMPRESSOR; done 
 167 changetohttpswebserver
 
 168 rm -rf rootdir
/var
/lib
/apt
/lists
 
 169 testsuccess aptget update
 
 170 GOODPOLICY
="$(aptcache policy testpkg)" 
 171 test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^  Candidate:' -e '^  Installed: (none)' -e '500 https
://' | wc -l) -eq 4 || msgdie 'https policy is broken
' 
 172 testsuccessequal "$GOODPOLICY" aptcache policy testpkg 
 173 for COMPRESSOR in 'gzip' 'bzip2' 'lzma
' 'xz
'; do testovermethod 'https
' $COMPRESSOR; done 
 175 changetocdrom 'Debian APT Testdisk 
0.8.15' 
 176 rm -rf rootdir/var/lib/apt/lists 
 177 testsuccess aptcdrom add </dev/null 
 178 GOODPOLICY="$(aptcache policy testpkg)" 
 179 test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^  Candidate:' -e '^  Installed: (none)' -e '500 cdrom://' | wc -l) -eq 4 || msgdie 
'cdrom policy is broken' 
 180 testsuccessequal 
"$GOODPOLICY" aptcache policy testpkg
 
 181 for COMPRESSOR 
in 'gzip' 'bzip2' 'lzma' 'xz'; do testovermethod 
'cdrom' $COMPRESSOR; done