]> git.saurik.com Git - apt.git/blob - test/integration/test-compressed-indexes
Merge remote-tracking branch 'mvo/feature/helpful-apt-list' into debian/sid
[apt.git] / test / integration / test-compressed-indexes
1 #!/bin/sh
2 set -e
3
4 TESTDIR=$(readlink -f $(dirname $0))
5 . $TESTDIR/framework
6
7 setupenvironment
8 configcompression '.' 'gz' # only gz is supported for this, so ensure it is used
9 configarchitecture "i386"
10
11 buildsimplenativepackage "testpkg" "i386" "1.0"
12 setupaptarchive
13
14 GOODSHOW="$(aptcache show testpkg)
15 "
16 GOODPOLICY="$(aptcache policy testpkg)"
17 GOODSHOWSRC="$(aptcache showsrc testpkg)
18 "
19
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
26
27
28 testrun() {
29 local F
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
37 else
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
42 fi
43 if [ -n "$F" ]; then
44 ls -laR rootdir/var/lib/apt/lists/
45 msgfail
46 else
47 msgpass
48 fi
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
52 aptget clean
53 msgtest "\tdeb file is gone"; testfailure --nomsg test -f rootdir/var/cache/apt/archives/testpkg_1.0_i386.deb
54 fi
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
64 aptget clean
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
69 rm -rf testpkg-1.0
70 }
71
72 echo 'Acquire::GzipIndexes "false";' > rootdir/etc/apt/apt.conf.d/02compressindex
73 msgmsg "File: Test with uncompressed indexes"
74 testrun
75
76 testsuccess aptget update -o Acquire::Pdiffs=1
77 msgmsg "File: Test with uncompressed indexes (update unchanged with pdiffs)"
78 testrun
79
80 testsuccess aptget update -o Acquire::Pdiffs=0
81 msgmsg "File: Test with uncompressed indexes (update unchanged without pdiffs)"
82 testrun
83
84 rm -rf rootdir/var/lib/apt/lists
85 echo 'Acquire::CompressionTypes::Order:: "gz";
86 Acquire::GzipIndexes "true";' > rootdir/etc/apt/apt.conf.d/02compressindex
87
88 testsuccess aptget update
89 msgmsg "File: Test with compressed indexes"
90 testrun "compressed"
91
92 testsuccess aptget update -o Acquire::Pdiffs=1
93 msgmsg "File: Test with compressed indexes (update unchanged with pdiffs)"
94 testrun "compressed"
95
96 testsuccess aptget update -o Acquire::Pdiffs=0
97 msgmsg "File: Test with compressed indexes (update unchanged without pdiffs)"
98 testrun "compressed"
99
100 rm rootdir/etc/apt/apt.conf.d/02compressindex
101 changetowebserver
102 testsuccess aptget update
103 GOODPOLICY="$(aptcache policy testpkg)"
104 test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^ Candidate:' -e '^ Installed: (none)' -e '500 http://' | wc -l) -eq 4
105 testequal "$GOODPOLICY" aptcache policy testpkg
106
107 msgmsg "HTTP: Test with uncompressed indexes"
108 testrun
109
110 testsuccess aptget update -o Acquire::Pdiffs=1
111 msgmsg "HTTP: Test with uncompressed indexes (update unchanged with pdiffs)"
112 testrun
113
114 testsuccess aptget update -o Acquire::Pdiffs=0
115 msgmsg "HTTP: Test with uncompressed indexes (update unchanged without pdiffs)"
116 testrun
117
118 rm -rf rootdir/var/lib/apt/lists
119 echo 'Acquire::CompressionTypes::Order:: "gz";
120 Acquire::GzipIndexes "true";' > rootdir/etc/apt/apt.conf.d/02compressindex
121
122 testsuccess aptget update
123 msgmsg "HTTP: Test with compressed indexes"
124 testrun "compressed"
125
126 testsuccess aptget update -o Acquire::Pdiffs=1
127 msgmsg "HTTP: Test with compressed indexes (update unchanged with pdiffs)"
128 testrun "compressed"
129
130 testsuccess aptget update -o Acquire::Pdiffs=0
131 msgmsg "HTTP: Test with compressed indexes (update unchanged without pdiffs)"
132 testrun "compressed"