4 TESTDIR
=$(readlink -f $(dirname $0))
7 configarchitecture
"i386"
13 rm -rf rootdir
/var
/lib
/apt rootdir
/var
/cache
/apt
14 aptget update
2>> testaptgetupdate.
diff >> testaptgetupdate.
diff || true
15 sed -i -e '/^Fetched / d' -e 's#\[[0-9]* [kMGTPY]*B\]#\[\]#' testaptgetupdate.
diff
18 msgtest
"Test for correctness of" "apt-get update with $*"
19 if [ -z "$GIVEN" ]; then
20 echo -n "" | checkdiff
- testaptgetupdate.
diff && msgpass
|| msgfail
22 echo "$GIVEN" | checkdiff
- testaptgetupdate.
diff && msgpass
|| msgfail
24 rm testaptgetupdate.
diff
27 createemptyarchive
() {
28 find aptarchive
/ \
( -name "Packages*" -o -name "en*" \
) -type f
-delete
29 if [ "en" = "$1" ]; then
30 echo -n "" | $COMPRESSOR > aptarchive
/Packages.
$COMPRESS
32 touch aptarchive
/Packages
33 echo -n "" | $COMPRESSOR > aptarchive
/${1}.
$COMPRESS
34 aptftparchive release aptarchive
/ > aptarchive
/Release
36 rm -f aptarchive
/Packages
40 find aptarchive
/ \
( -name "Packages*" -o -name "en*" \
) -type f
-delete
41 if [ "en" = "$1" ]; then
42 echo -n "" | $COMPRESSOR > aptarchive
/Packages.
$COMPRESS
44 touch aptarchive
/Packages aptarchive
/${1}.
$COMPRESS
45 aptftparchive release aptarchive
/ > aptarchive
/Release
47 rm -f aptarchive
/Packages
54 bzip2) COMPRESS
="bz2";;
55 lzma
) COMPRESS
="lzma";;
57 echo "Acquire::CompressionTypes::Order { \"${COMPRESS}\"; };
58 Dir::Bin::gzip \"/does/not/exist\";
59 Dir::Bin::bzip2 \"/does/not/exist\";
60 Dir::Bin::lzma \"/does/not/exist\";" > rootdir
/etc
/apt
/apt.conf.d
/00compressor
61 if [ -e "/bin/${COMPRESSOR}" ]; then
62 echo "Dir::Bin::${COMPRESSOR} \"/bin/${COMPRESSOR}\";" >> rootdir
/etc
/apt
/apt.conf.d
/00compressor
63 elif [ -e "/usr/bin/${COMPRESSOR}" ]; then
64 echo "Dir::Bin::${COMPRESSOR} \"/usr/bin/${COMPRESSOR}\";" >> rootdir
/etc
/apt
/apt.conf.d
/00compressor
66 msgtest
"Test for availability of compressor" "${COMPRESSOR}"
76 testaptgetupdate
"Get:1 file: Release.gpg []
77 Get:2 file: Release []
78 Ign file:$(readlink -f aptarchive)/ Translation-en
79 Reading package lists..." "empty file en.$COMPRESS over file"
81 createemptyarchive
'en'
82 testaptgetupdate
"Get:1 file: Release.gpg []
83 Get:2 file: Release []
84 Reading package lists..." "empty archive en.$COMPRESS over file"
86 createemptyarchive
'Packages'
87 # FIXME: Why omits the file transport the Packages Get line?
88 #Get:3 file: Packages []
89 testaptgetupdate
"Ign file:$(readlink -f aptarchive)/ Translation-en
90 Get:1 file: Release.gpg []
91 Get:2 file: Release []
92 Reading package lists..." "empty archive Packages.$COMPRESS over file"
94 createemptyfile
'Packages'
95 testaptgetupdate
"Ign file:$(readlink -f aptarchive)/ Translation-en
96 Get:1 file: Release.gpg []
97 Get:2 file: Release []
100 W: Failed to fetch file:$(readlink -f aptarchive/Packages.$COMPRESS) Undetermined Error
102 E: Some index files failed to download, they have been ignored, or old ones used instead." "empty file Packages.$COMPRESS over file"
109 testaptgetupdate
"Get:1 http://localhost Release.gpg []
110 Get:2 http://localhost/ Translation-en
111 Get:3 http://localhost Release []
112 Ign http://localhost/ Translation-en
113 Get:4 http://localhost Packages []
114 Reading package lists..." "empty file en.$COMPRESS over http"
116 createemptyarchive
'en'
117 testaptgetupdate
"Get:1 http://localhost Release.gpg []
118 Get:2 http://localhost/ Translation-en []
119 Get:3 http://localhost Release []
120 Get:4 http://localhost Packages []
121 Reading package lists..." "empty archive en.$COMPRESS over http"
123 createemptyarchive
'Packages'
124 testaptgetupdate
"Get:1 http://localhost Release.gpg []
125 Ign http://localhost/ Translation-en
126 Get:2 http://localhost Release []
127 Get:3 http://localhost Packages []
128 Reading package lists..." "empty archive Packages.$COMPRESS over http"
130 createemptyfile
'Packages'
131 #FIXME: we should response with a good error message instead
132 testaptgetupdate
"Get:1 http://localhost Release.gpg []
133 Ign http://localhost/ Translation-en
134 Get:2 http://localhost Release []
135 Get:3 http://localhost Packages
136 Err http://localhost Packages
138 W: Failed to fetch http://localhost:8080/Packages.$COMPRESS Undetermined Error
140 E: Some index files failed to download, they have been ignored, or old ones used instead." "empty file Packages.$COMPRESS over http"
143 for COMPRESSOR
in 'gzip' 'bzip2' 'lzma'; do testoverfile
$COMPRESSOR; done
145 # do the same again with http instead of file
148 for COMPRESSOR
in 'gzip' 'bzip2' 'lzma'; do testoverhttp
$COMPRESSOR; done