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-cli-show 3.2 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
  1. #!/bin/sh
  2. set -e
  3. TESTDIR="$(readlink -f "$(dirname "$0")")"
  4. . "$TESTDIR/framework"
  5. setupenvironment
  6. configarchitecture 'i386' 'amd64'
  7. generatelotsofnames() {
  8. for i in $(seq 0 10000); do
  9. printf ', this-is-a-long-pkg-name-%s (= 0.a.long.version)' "$i"
  10. done
  11. }
  12. DESCR='Some description
  13. That has multiple lines'
  14. insertpackage 'unstable' 'foo' 'all' '1.0' '' '' "$DESCR"
  15. insertpackage 'unstable' 'bar' 'i386,amd64' '1' '' '' "$DESCR"
  16. insertpackage 'unstable' 'big' 'i386,amd64' '1' 'Installed-Size: 4129421' '' "$DESCR"
  17. insertpackage 'unstable' 'large' 'all' '1' "Provides: pkga$(generatelotsofnames)" '' "$DESCR"
  18. insertpackage 'unstable' 'large2' 'all' '1' "Provides: foobar, pkga$(generatelotsofnames)" '' "$DESCR"
  19. insertinstalledpackage 'foo' 'all' '1.0'
  20. setupaptarchive
  21. APTARCHIVE=$(readlink -f ./aptarchive)
  22. # note that we do not display Description-md5 with the "apt" cmd
  23. # and also show some additional fields that are calculated
  24. testsuccessequal "Package: foo
  25. Version: 1.0
  26. Priority: optional
  27. Section: other
  28. Maintainer: Joe Sixpack <>
  29. Installed-Size: 43.0 kB
  30. Download-Size: unknown
  31. APT-Manual-Installed: yes
  32. APT-Sources: file:$APTARCHIVE unstable/main all Packages
  33. Description: Some description
  34. That has multiple lines
  35. " apt show foo
  36. testsuccessequal "Package: bar
  37. Version: 1
  38. Priority: optional
  39. Section: other
  40. Maintainer: Joe Sixpack <>
  41. Installed-Size: 43.0 kB
  42. Download-Size: unknown
  43. APT-Sources: file:$APTARCHIVE unstable/main i386 Packages
  44. Description: Some description
  45. That has multiple lines
  46. " apt show bar
  47. testsuccessequal "Package: bar:amd64
  48. Version: 1
  49. Priority: optional
  50. Section: other
  51. Maintainer: Joe Sixpack <>
  52. Installed-Size: 43.0 kB
  53. Download-Size: unknown
  54. APT-Sources: file:$APTARCHIVE unstable/main amd64 Packages
  55. Description: Some description
  56. That has multiple lines
  57. " apt show bar:amd64
  58. testsuccessequal "Package: big:amd64
  59. Version: 1
  60. Priority: optional
  61. Section: other
  62. Maintainer: Joe Sixpack <>
  63. Installed-Size: 4229 MB
  64. Download-Size: unknown
  65. APT-Sources: file:$APTARCHIVE unstable/main amd64 Packages
  66. Description: Some description
  67. That has multiple lines
  68. " apt show big:amd64
  69. testsuccessequal "Package: large
  70. Version: 1
  71. Priority: optional
  72. Section: other
  73. Maintainer: Joe Sixpack <>
  74. Installed-Size: 43.0 kB
  75. Provides: pkga$(generatelotsofnames)
  76. Download-Size: unknown
  77. APT-Sources: file:$APTARCHIVE unstable/main all Packages
  78. Description: Some description
  79. That has multiple lines
  80. " apt show large
  81. testsuccessequal "Package: large2
  82. Version: 1
  83. Priority: optional
  84. Section: other
  85. Maintainer: Joe Sixpack <>
  86. Installed-Size: 43.0 kB
  87. Provides: foobar, pkga$(generatelotsofnames)
  88. Download-Size: unknown
  89. APT-Sources: file:$APTARCHIVE unstable/main all Packages
  90. Description: Some description
  91. That has multiple lines
  92. " apt show large2
  93. # this is the default, but disabled by the testcases
  94. testsuccess apt show foo -o Apt::Cmd::Disable-Script-Warning=0
  95. cp rootdir/tmp/testsuccess.output aptshow.output
  96. testsuccess grep '^WARNING: ' aptshow.output
  97. if [ "$(id -u)" != '0' ]; then
  98. testsuccess apt install foo -s -o APT::Get::Show-User-Simulation-Note=1
  99. cp rootdir/tmp/testsuccess.output aptshow.output
  100. testsuccess grep '^NOTE: ' aptshow.output
  101. fi