test-apt-translation-has-no-packages 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. # coming out of a Translation file. Downloading this versions fails as
  8. # there is no acquire method available for the package
  9. #
  10. set -e
  11. TESTDIR=$(readlink -f $(dirname $0))
  12. . $TESTDIR/framework
  13. setupenvironment
  14. configarchitecture "amd64"
  15. if [ ! -x ${BUILDDIRECTORY}/apt ]; then
  16. msgmsg "No ${BUILDDIRECTORY}/apt"
  17. msgskip
  18. exit 0
  19. fi
  20. buildsimplenativepackage 'foo' 'all' '1.0'
  21. setupaptarchive
  22. APTARCHIVE=$(readlink -f ./aptarchive)
  23. # corrupt the Translation-en file to look like a regular Packages file
  24. rm rootdir/var/cache/apt/*.bin
  25. cp $APTARCHIVE/dists/unstable/main/binary-amd64/Packages \
  26. rootdir/var/lib/apt/lists/*Translation-en
  27. # ensure that there is no Version for the package foo generated out of
  28. # the corrupted Translation-en file
  29. testsuccessequal "foo:
  30. Installed: (none)
  31. Candidate: 1.0
  32. Version table:
  33. 1.0 500
  34. 500 file:$APTARCHIVE unstable/main amd64 Packages" aptcache policy foo