]>
Commit | Line | Data |
---|---|---|
f213b6ea DK |
1 | #!/bin/sh |
2 | set -e | |
3 | ||
9962ae93 | 4 | TESTDIR=$(readlink -f $(dirname $0)) |
f213b6ea DK |
5 | . $TESTDIR/framework |
6 | ||
7 | setupenvironment | |
8 | configarchitecture "i386" | |
9 | ||
10 | buildsimplenativepackage "testpkg" "i386" "1.0" | |
11 | setupaptarchive | |
12 | ||
718f797c | 13 | GOODSHOW="$(aptcache show testpkg) |
f213b6ea | 14 | " |
718f797c DK |
15 | GOODPOLICY="$(aptcache policy testpkg)" |
16 | GOODSHOWSRC="$(aptcache showsrc testpkg) | |
f213b6ea DK |
17 | " |
18 | ||
b761356f | 19 | test $(echo "$GOODSHOW" | grep -e '^Package: testpkg' -e '^Version: 1.0' -e '^Architecture: i386' | wc -l) -eq 3 || msgdie 'show is broken' |
f213b6ea | 20 | testequal "$GOODSHOW" aptcache show testpkg |
b761356f | 21 | test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^ Candidate:' -e '^ Installed: (none)' -e '500 file:/' | wc -l) -eq 4 || msgdie 'policy is broken' |
f213b6ea | 22 | testequal "$GOODPOLICY" aptcache policy testpkg |
b761356f | 23 | 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' |
f213b6ea DK |
24 | testequal "$GOODSHOWSRC" aptcache showsrc testpkg |
25 | ||
26 | ||
27 | testrun() { | |
28 | local F | |
29 | if [ -e rootdir/var/lib/apt/lists/*localhost*Release ]; then | |
30 | msgtest "Check if all index files are" "${1:-uncompressed}" | |
31 | if [ "$1" = "compressed" ]; then | |
32 | ! test -e rootdir/var/lib/apt/lists/*_Packages || F=1 | |
33 | ! test -e rootdir/var/lib/apt/lists/*_Sources || F=1 | |
34 | test -e rootdir/var/lib/apt/lists/*_Packages.gz || F=1 | |
35 | test -e rootdir/var/lib/apt/lists/*_Sources.gz || F=1 | |
36 | else | |
37 | test -e rootdir/var/lib/apt/lists/*_Packages || F=1 | |
38 | test -e rootdir/var/lib/apt/lists/*_Sources || F=1 | |
39 | ! test -e rootdir/var/lib/apt/lists/*_Packages.gz || F=1 | |
40 | ! test -e rootdir/var/lib/apt/lists/*_Sources.gz || F=1 | |
41 | fi | |
42 | if [ -n "$F" ]; then | |
43 | ls -laR rootdir/var/lib/apt/lists/ | |
44 | msgfail | |
45 | else | |
46 | msgpass | |
47 | fi | |
48 | msgtest "Check if package is downloadable" | |
49 | aptget install -d testpkg -qq && msgpass || msgfail | |
50 | msgtest "\tdeb file is present"; test -f rootdir/var/cache/apt/archives/testpkg_1.0_i386.deb && msgpass || msgfail | |
51 | aptget clean | |
52 | msgtest "\tdeb file is gone"; ! test -f rootdir/var/cache/apt/archives/testpkg_1.0_i386.deb && msgpass || msgfail | |
53 | fi | |
8de79b68 | 54 | rm -f rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin |
f213b6ea DK |
55 | testequal "$GOODSHOW" aptcache show testpkg |
56 | testequal "$GOODSHOW" aptcache show testpkg | |
8de79b68 | 57 | rm -f rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin |
f213b6ea DK |
58 | testequal "$GOODPOLICY" aptcache policy testpkg |
59 | testequal "$GOODPOLICY" aptcache policy testpkg | |
8de79b68 | 60 | rm -f rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin |
f213b6ea DK |
61 | testequal "$GOODSHOWSRC" aptcache showsrc testpkg |
62 | testequal "$GOODSHOWSRC" aptcache showsrc testpkg | |
8de79b68 | 63 | aptget clean |
f213b6ea DK |
64 | msgtest "Check if the source is aptgetable" |
65 | aptget source testpkg -qq 2> /dev/null > /dev/null && msgpass || msgfail | |
66 | msgtest "\tdsc file is present"; test -f testpkg_1.0.dsc && msgpass || msgfail | |
67 | msgtest "\tdirectory is present"; test -d testpkg-1.0 && msgpass || msgfail | |
68 | rm -rf testpkg-1.0 | |
69 | } | |
70 | ||
d88a49c8 | 71 | echo 'Acquire::GzipIndexes "false";' > rootdir/etc/apt/apt.conf.d/02compressindex |
f213b6ea DK |
72 | msgmsg "File: Test with uncompressed indexes" |
73 | testrun | |
74 | ||
75 | aptget update -qq -o Acquire::Pdiffs=1 | |
76 | msgmsg "File: Test with uncompressed indexes (update unchanged with pdiffs)" | |
77 | testrun | |
78 | ||
79 | aptget update -qq -o Acquire::Pdiffs=0 | |
80 | msgmsg "File: Test with uncompressed indexes (update unchanged without pdiffs)" | |
81 | testrun | |
82 | ||
83 | rm -rf rootdir/var/lib/apt/lists | |
84 | echo 'Acquire::CompressionTypes::Order:: "gz"; | |
85 | Acquire::GzipIndexes "true";' > rootdir/etc/apt/apt.conf.d/02compressindex | |
86 | ||
87 | aptget update -qq | |
88 | msgmsg "File: Test with compressed indexes" | |
89 | testrun "compressed" | |
90 | ||
91 | aptget update -qq -o Acquire::Pdiffs=1 | |
92 | msgmsg "File: Test with compressed indexes (update unchanged with pdiffs)" | |
93 | testrun "compressed" | |
94 | ||
95 | aptget update -qq -o Acquire::Pdiffs=0 | |
96 | msgmsg "File: Test with compressed indexes (update unchanged without pdiffs)" | |
97 | testrun "compressed" | |
98 | ||
99 | rm rootdir/etc/apt/apt.conf.d/02compressindex | |
100 | changetowebserver | |
101 | aptget update -qq | |
718f797c | 102 | GOODPOLICY="$(aptcache policy testpkg)" |
f213b6ea DK |
103 | test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^ Candidate:' -e '^ Installed: (none)' -e '500 http://' | wc -l) -eq 4 |
104 | testequal "$GOODPOLICY" aptcache policy testpkg | |
105 | ||
106 | msgmsg "HTTP: Test with uncompressed indexes" | |
107 | testrun | |
108 | ||
109 | aptget update -qq -o Acquire::Pdiffs=1 | |
110 | msgmsg "HTTP: Test with uncompressed indexes (update unchanged with pdiffs)" | |
111 | testrun | |
112 | ||
113 | aptget update -qq -o Acquire::Pdiffs=0 | |
114 | msgmsg "HTTP: Test with uncompressed indexes (update unchanged without pdiffs)" | |
115 | testrun | |
116 | ||
117 | rm -rf rootdir/var/lib/apt/lists | |
118 | echo 'Acquire::CompressionTypes::Order:: "gz"; | |
119 | Acquire::GzipIndexes "true";' > rootdir/etc/apt/apt.conf.d/02compressindex | |
120 | ||
121 | aptget update -qq | |
122 | msgmsg "HTTP: Test with compressed indexes" | |
123 | testrun "compressed" | |
124 | ||
125 | aptget update -qq -o Acquire::Pdiffs=1 | |
126 | msgmsg "HTTP: Test with compressed indexes (update unchanged with pdiffs)" | |
127 | testrun "compressed" | |
128 | ||
129 | aptget update -qq -o Acquire::Pdiffs=0 | |
130 | msgmsg "HTTP: Test with compressed indexes (update unchanged without pdiffs)" | |
131 | testrun "compressed" |