4 TESTDIR
=$(readlink -f $(dirname $0))
8 configcompression
'.' 'gz' # only gz is supported for this, so ensure it is used
9 configarchitecture
"i386"
11 buildsimplenativepackage
"testpkg" "i386" "1.0"
14 GOODSHOW
="$(aptcache show testpkg)
16 GOODPOLICY
="$(aptcache policy testpkg)"
17 GOODSHOWSRC
="$(aptcache showsrc testpkg)
20 test $(echo "$GOODSHOW" | grep -e '^Package: testpkg' -e '^Version: 1.0' -e '^Architecture: i386' | wc -l) -eq 3 || msgdie
'show is broken'
21 testequal
"$GOODSHOW" aptcache show testpkg
22 test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^ Candidate:' -e '^ Installed: (none)' -e '500 file:/' | wc -l) -eq 4 || msgdie 'policy is broken
'
23 testequal "$GOODPOLICY" aptcache policy testpkg
24 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'
25 testequal
"$GOODSHOWSRC" aptcache showsrc testpkg
30 if [ -e rootdir
/var
/lib
/apt
/lists
/*localhost
*Release
]; then
31 msgtest
"Check if all index files are" "${1:-uncompressed}"
32 if [ "$1" = "compressed" ]; then
33 ! test -e rootdir
/var
/lib
/apt
/lists
/*_Packages
|| F
=1
34 ! test -e rootdir
/var
/lib
/apt
/lists
/*_Sources
|| F
=1
35 test -e rootdir
/var
/lib
/apt
/lists
/*_Packages.gz
|| F
=1
36 test -e rootdir
/var
/lib
/apt
/lists
/*_Sources.gz
|| F
=1
38 test -e rootdir
/var
/lib
/apt
/lists
/*_Packages
|| F
=1
39 test -e rootdir
/var
/lib
/apt
/lists
/*_Sources
|| F
=1
40 ! test -e rootdir
/var
/lib
/apt
/lists
/*_Packages.gz
|| F
=1
41 ! test -e rootdir
/var
/lib
/apt
/lists
/*_Sources.gz
|| F
=1
44 ls -laR rootdir
/var
/lib
/apt
/lists
/
49 msgtest
"Check if package is downloadable"
50 testsuccess
--nomsg aptget
install -d testpkg
51 msgtest
"\tdeb file is present"; testsuccess
--nomsg test -f rootdir
/var
/cache
/apt
/archives
/testpkg_1.0_i386.deb
53 msgtest
"\tdeb file is gone"; testfailure
--nomsg test -f rootdir
/var
/cache
/apt
/archives
/testpkg_1.0_i386.deb
55 rm -f rootdir
/var
/cache
/apt
/pkgcache.bin rootdir
/var
/cache
/apt
/srcpkgcache.bin
56 testequal
"$GOODSHOW" aptcache show testpkg
57 testequal
"$GOODSHOW" aptcache show testpkg
58 rm -f rootdir
/var
/cache
/apt
/pkgcache.bin rootdir
/var
/cache
/apt
/srcpkgcache.bin
59 testequal
"$GOODPOLICY" aptcache policy testpkg
60 testequal
"$GOODPOLICY" aptcache policy testpkg
61 rm -f rootdir
/var
/cache
/apt
/pkgcache.bin rootdir
/var
/cache
/apt
/srcpkgcache.bin
62 testequal
"$GOODSHOWSRC" aptcache showsrc testpkg
63 testequal
"$GOODSHOWSRC" aptcache showsrc testpkg
65 msgtest
"Check if the source is aptgetable"
66 testsuccess
--nomsg aptget
source testpkg
67 msgtest
"\tdsc file is present"; testsuccess
--nomsg test -f testpkg_1.0.dsc
68 msgtest
"\tdirectory is present"; testsuccess
--nomsg test -d testpkg
-1.0
70 testequal
"$(aptcache show testpkg -o Acquire::Languages=none)
74 echo 'Acquire::GzipIndexes "false";' > rootdir
/etc
/apt
/apt.conf.d
/02compressindex
75 msgmsg
"File: Test with uncompressed indexes"
78 testsuccess aptget update
-o Acquire
::Pdiffs
=1
79 msgmsg
"File: Test with uncompressed indexes (update unchanged with pdiffs)"
82 testsuccess aptget update
-o Acquire
::Pdiffs
=0
83 msgmsg
"File: Test with uncompressed indexes (update unchanged without pdiffs)"
86 rm -rf rootdir
/var
/lib
/apt
/lists
87 echo 'Acquire::CompressionTypes::Order:: "gz";
88 Acquire::GzipIndexes "true";' > rootdir
/etc
/apt
/apt.conf.d
/02compressindex
90 testsuccess aptget update
91 msgmsg
"File: Test with compressed indexes"
94 testsuccess aptget update
-o Acquire
::Pdiffs
=1
95 msgmsg
"File: Test with compressed indexes (update unchanged with pdiffs)"
98 testsuccess aptget update
-o Acquire
::Pdiffs
=0
99 msgmsg
"File: Test with compressed indexes (update unchanged without pdiffs)"
102 rm rootdir
/etc
/apt
/apt.conf.d
/02compressindex
104 testsuccess aptget update
105 GOODPOLICY
="$(aptcache policy testpkg)"
106 test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^ Candidate:' -e '^ Installed: (none)' -e '500 http
://' | wc -l) -eq 4
107 testequal "$GOODPOLICY" aptcache policy testpkg
109 msgmsg "HTTP: Test with uncompressed indexes"
112 testsuccess aptget update -o Acquire::Pdiffs=1
113 msgmsg "HTTP: Test with uncompressed indexes (update unchanged with pdiffs)"
116 testsuccess aptget update -o Acquire::Pdiffs=0
117 msgmsg "HTTP: Test with uncompressed indexes (update unchanged without pdiffs)"
120 rm -rf rootdir/var/lib/apt/lists
121 echo 'Acquire
::CompressionTypes
::Order
:: "gz";
122 Acquire
::GzipIndexes
"true";' > rootdir/etc/apt/apt.conf.d/02compressindex
124 testsuccess aptget update
125 msgmsg "HTTP: Test with compressed indexes"
128 testsuccess aptget update -o Acquire::Pdiffs=1
129 msgmsg "HTTP: Test with compressed indexes (update unchanged with pdiffs)"
132 testsuccess aptget update -o Acquire::Pdiffs=0
133 msgmsg "HTTP: Test with compressed indexes (update unchanged without pdiffs)"