You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

test-apt-update-transactions 2.3 KiB

support arch:all data e.g. in separate Packages file Based on a discussion with Niels Thykier who asked for Contents-all this implements apt trying for all architecture dependent files to get a file for the architecture all, which is treated internally now as an official architecture which is always around (like native). This way arch:all data can be shared instead of duplicated for each architecture requiring the user to download the same information again and again. There is one problem however: In Debian there is already a binary-all/ Packages file, but the binary-any files still include arch:all packages, so that downloading this file now would be a waste of time, bandwidth and diskspace. We therefore need a way to decide if it makes sense to download the all file for Packages in Debian or not. The obvious answer would be a special flag in the Release file indicating this, which would need to default to 'no' and every reasonable repository would override it to 'yes' in a few years time, but the flag would be there "forever". Looking closer at a Release file we see the field "Architectures", which doesn't include 'all' at the moment. With the idea outlined above that 'all' is a "proper" architecture now, we interpret this field as being authoritative in declaring which architectures are supported by this repository. If it says 'all', apt will try to get all, if not it will be skipped. This gives us another interesting feature: If I configure a source to download armel and mips, but it declares it supports only armel apt will now print a notice saying as much. Previously this was a very cryptic failure. If on the other hand the repository supports mips, too, but for some reason doesn't ship mips packages at the moment, this 'missing' file is silently ignored (= that is the same as the repository including an empty file). The Architectures field isn't mandatory through, so if it isn't there, we assume that every architecture is supported by this repository, which skips the arch:all if not listed in the release file.
5 years ago
support arch:all data e.g. in separate Packages file Based on a discussion with Niels Thykier who asked for Contents-all this implements apt trying for all architecture dependent files to get a file for the architecture all, which is treated internally now as an official architecture which is always around (like native). This way arch:all data can be shared instead of duplicated for each architecture requiring the user to download the same information again and again. There is one problem however: In Debian there is already a binary-all/ Packages file, but the binary-any files still include arch:all packages, so that downloading this file now would be a waste of time, bandwidth and diskspace. We therefore need a way to decide if it makes sense to download the all file for Packages in Debian or not. The obvious answer would be a special flag in the Release file indicating this, which would need to default to 'no' and every reasonable repository would override it to 'yes' in a few years time, but the flag would be there "forever". Looking closer at a Release file we see the field "Architectures", which doesn't include 'all' at the moment. With the idea outlined above that 'all' is a "proper" architecture now, we interpret this field as being authoritative in declaring which architectures are supported by this repository. If it says 'all', apt will try to get all, if not it will be skipped. This gives us another interesting feature: If I configure a source to download armel and mips, but it declares it supports only armel apt will now print a notice saying as much. Previously this was a very cryptic failure. If on the other hand the repository supports mips, too, but for some reason doesn't ship mips packages at the moment, this 'missing' file is silently ignored (= that is the same as the repository including an empty file). The Architectures field isn't mandatory through, so if it isn't there, we assume that every architecture is supported by this repository, which skips the arch:all if not listed in the release file.
5 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #!/bin/sh
  2. set -e
  3. # ensure that an update will only succeed entirely or not at all
  4. TESTDIR="$(readlink -f "$(dirname "$0")")"
  5. . "$TESTDIR/framework"
  6. setupenvironment
  7. configarchitecture 'i386'
  8. configcompression '.' 'gz'
  9. insertpackage 'unstable' 'foo' 'i386' '1.0'
  10. insertsource 'unstable' 'foo' 'i386' '1.0'
  11. setupaptarchive --no-update
  12. breakfile() {
  13. breakfiles "$1" "${1}.gz"
  14. }
  15. restorefile() {
  16. unbreakfiles "$1" "${1}.gz"
  17. }
  18. testrun() {
  19. rm -rf aptarchive/dists.good
  20. cp -a aptarchive/dists aptarchive/dists.good
  21. insertpackage 'unstable' 'bar' 'i386' '1.0'
  22. insertsource 'unstable' 'bar' 'i386' '1.0'
  23. buildaptarchivefromfiles '+1 hour'
  24. # produce an unsigned repository
  25. find aptarchive \( -name 'Release.gpg' -o -name 'InRelease' \) -delete
  26. testfailure aptget update --no-allow-insecure-repositories
  27. testfileequal "$1" "$(listcurrentlistsdirectory)"
  28. # signed but broken
  29. signreleasefiles
  30. onehashbroken() {
  31. rm -rf rootdir/var/lib/apt/lists/partial
  32. testfailure aptget update -o Debug::pkgAcquire::Worker=1 -o Debug::Acquire::http=1
  33. # each file generates two messages with this string
  34. testequal '2' grep --count 'Hash Sum mismatch' rootdir/tmp/testfailure.output
  35. testfileequal "$1" "$(listcurrentlistsdirectory)"
  36. }
  37. breakfile aptarchive/dists/unstable/main/binary-i386/Packages
  38. onehashbroken "$1"
  39. restorefile aptarchive/dists/unstable/main/binary-i386/Packages
  40. breakfile aptarchive/dists/unstable/main/source/Sources
  41. onehashbroken "$1"
  42. restorefile aptarchive/dists/unstable/main/source/Sources
  43. rm -rf aptarchive/dists
  44. cp -a aptarchive/dists.good aptarchive/dists
  45. }
  46. testsetup() {
  47. msgmsg 'Test with no initial data over' "$1"
  48. rm -rf rootdir/var/lib/apt/lists
  49. mkdir -p rootdir/var/lib/apt/lists/partial
  50. listcurrentlistsdirectory > listsdir.lst
  51. testrun 'listsdir.lst'
  52. msgmsg 'Test with initial data over' "$1"
  53. rm -rf rootdir/var/lib/apt/lists
  54. testsuccess aptget update -o Debug::pkgAcquire::Worker=1
  55. listcurrentlistsdirectory > listsdir.lst
  56. testrun 'listsdir.lst'
  57. }
  58. testsetup 'file'
  59. changetowebserver
  60. webserverconfig 'aptwebserver::support::modified-since' 'false' "$1"
  61. webserverconfig 'aptwebserver::support::last-modified' 'false' "$1" # curl is clever and sees hits here also
  62. webserverconfig 'aptwebserver::response-header::Accept-Ranges' 'none' "$1"
  63. testsetup 'http'
  64. changetohttpswebserver
  65. testsetup 'https'