test-apt-cli-show 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #!/bin/sh
  2. set -e
  3. TESTDIR="$(readlink -f "$(dirname "$0")")"
  4. . "$TESTDIR/framework"
  5. setupenvironment
  6. configarchitecture 'i386' 'amd64'
  7. DESCR='Some description
  8. That has multiple lines'
  9. insertpackage 'unstable' 'foo' 'all' '1.0' '' '' "$DESCR"
  10. insertpackage 'unstable' 'bar' 'i386,amd64' '1' '' '' "$DESCR"
  11. insertinstalledpackage 'foo' 'all' '1.0'
  12. setupaptarchive
  13. APTARCHIVE=$(readlink -f ./aptarchive)
  14. # note that we do not display Description-md5 with the "apt" cmd
  15. # and also show some additional fields that are calculated
  16. testsuccessequal "Package: foo
  17. Version: 1.0
  18. Priority: optional
  19. Section: other
  20. Maintainer: Joe Sixpack <joe@example.org>
  21. Installed-Size: 43.0 kB
  22. Download-Size: unknown
  23. APT-Manual-Installed: yes
  24. APT-Sources: file:$APTARCHIVE unstable/main all Packages
  25. Description: Some description
  26. That has multiple lines
  27. " apt show foo
  28. testsuccessequal "Package: bar
  29. Version: 1
  30. Priority: optional
  31. Section: other
  32. Maintainer: Joe Sixpack <joe@example.org>
  33. Installed-Size: 43.0 kB
  34. Download-Size: unknown
  35. APT-Sources: file:$APTARCHIVE unstable/main i386 Packages
  36. Description: Some description
  37. That has multiple lines
  38. " apt show bar
  39. testsuccessequal "Package: bar:amd64
  40. Version: 1
  41. Priority: optional
  42. Section: other
  43. Maintainer: Joe Sixpack <joe@example.org>
  44. Installed-Size: 43.0 kB
  45. Download-Size: unknown
  46. APT-Sources: file:$APTARCHIVE unstable/main amd64 Packages
  47. Description: Some description
  48. That has multiple lines
  49. " apt show bar:amd64
  50. # this is the default, but disabled by the testcases
  51. testsuccess apt show foo -o Apt::Cmd::Disable-Script-Warning=0
  52. cp rootdir/tmp/testsuccess.output aptshow.output
  53. testsuccess grep '^WARNING: ' aptshow.output
  54. if [ "$(id -u)" != '0' ]; then
  55. testsuccess apt install foo -s -o APT::Get::Show-User-Simulation-Note=1
  56. cp rootdir/tmp/testsuccess.output aptshow.output
  57. testsuccess grep '^NOTE: ' aptshow.output
  58. fi