test-apt-key-used-in-maintainerscript 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/sh
  2. set -e
  3. TESTDIR="$(readlink -f "$(dirname "$0")")"
  4. . "$TESTDIR/framework"
  5. setupenvironment
  6. unset APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE
  7. configarchitecture 'native'
  8. configdpkgnoopchroot
  9. buildingpkg() {
  10. local PKG="$1"
  11. shift
  12. setupsimplenativepackage "$PKG" 'native' '1' 'unstable' "$@"
  13. BUILDDIR="incoming/${PKG}-1"
  14. echo '#!/bin/sh
  15. apt-key list >/dev/null' > "${BUILDDIR}/debian/postinst"
  16. buildpackage "$BUILDDIR" 'unstable' 'main' 'native'
  17. rm -rf "$BUILDDIR"
  18. }
  19. buildingpkg 'aptkeyuser-nodepends' 'Depends: unrelated'
  20. buildingpkg 'aptkeyuser-depends' 'Depends: gnupg'
  21. setupaptarchive
  22. insertinstalledpackage 'unrelated' 'native' '1'
  23. insertinstalledpackage 'gnupg' 'native' '1'
  24. testsuccess apt install aptkeyuser-depends -y
  25. cp rootdir/tmp/testsuccess.output apt.output
  26. testfailure grep '^Warning: This will BREAK' apt.output
  27. testsuccess grep '^Warning: apt-key' apt.output
  28. testsuccess apt install aptkeyuser-nodepends -y
  29. cp rootdir/tmp/testsuccess.output apt.output
  30. testsuccess grep '^Warning: This will BREAK' apt.output
  31. testsuccess grep '^Warning: apt-key' apt.output
  32. testsuccess aptkey list
  33. cp rootdir/tmp/testsuccess.output aptkey.list
  34. testsuccess grep '^Warning: apt-key' aptkey.list