prepare 1.0.4 upload
[ntk/apt.git] / test / integration / test-apt-translation-has-no-packages
CommitLineData
bc1c9081
MV
1#!/bin/sh
2#
3# Due to corruption (local or network) a user might end up with a
4# Translation-$lang file on disk that is actually a Packages file. In this
5# case apt used to generate invalid package versions out of the
6# Translation-$lang file (i.e. apt-cache policy foo) would show a version
7# comming out of a Translation file. Downloading this versions fails as
8# there is no acquire method available for the package
9#
10set -e
11
12TESTDIR=$(readlink -f $(dirname $0))
13. $TESTDIR/framework
14
15setupenvironment
16configarchitecture "amd64"
17
18if [ ! -x ${BUILDDIRECTORY}/apt ]; then
19 msgmsg "No ${BUILDDIRECTORY}/apt"
20 msgskip
21 exit 0
22fi
23
24buildsimplenativepackage 'foo' 'all' '1.0'
25setupaptarchive
26
27APTARCHIVE=$(readlink -f ./aptarchive)
28
29# corrupt the Translation-en file to look like a regular Packages file
30rm rootdir/var/cache/apt/*.bin
31cp $APTARCHIVE/dists/unstable/main/binary-amd64/Packages \
32 rootdir/var/lib/apt/lists/*Translation-en
33
34# ensure that there is no Version for the package foo generated out of
35# the corrupted Translation-en file
36testequal "foo:
37 Installed: (none)
38 Candidate: 1.0
39 Version table:
40 1.0 0
41 500 file:$APTARCHIVE/ unstable/main amd64 Packages" aptcache policy foo