test-apt-get-changelog 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/bin/sh
  2. set -e
  3. TESTDIR=$(readlink -f $(dirname $0))
  4. . $TESTDIR/framework
  5. setupenvironment
  6. configarchitecture "i386"
  7. buildsimplenativepackage 'apt' 'all' '1.0' 'stable'
  8. setupaptarchive --no-update
  9. changetowebserver
  10. testsuccess aptget update
  11. # simulate normal user with non-existent root-owned directories
  12. rm -rf rootdir/var/cache/apt/archives/
  13. mkdir rootdir/var/cache/apt/archives/
  14. addtrap 'prefix' "chmod -f -R +w $PWD/rootdir/var/cache/apt/archives || true;"
  15. chmod -R -w rootdir/var/cache/apt/archives
  16. echo 'Apt::Changelogs::Server "http://localhost:8080/";' > rootdir/etc/apt/apt.conf.d/changelog.conf
  17. testsuccessequal "'http://localhost:8080/pool/apt_1.0/changelog'" aptget changelog apt --print-uris
  18. testsuccessequal "'http://localhost:8080/pool/apt_1.0/changelog'
  19. 'http://localhost:8080/pool/apt_1.0/changelog'" aptget changelog apt apt --print-uris
  20. cd downloaded
  21. testsuccess aptget changelog apt -qq
  22. testfileequal '../rootdir/tmp/testsuccess.output' "$(cat ../aptarchive/pool/apt_1.0/changelog)"
  23. testsuccess aptget changelog apt -d
  24. testfileequal 'apt.changelog' "$(cat ../aptarchive/pool/apt_1.0/changelog)"
  25. testfilestats 'apt.changelog' '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644"
  26. rm -f apt.changelog ../aptarchive/pool/apt_1.0/changelog
  27. testequal "$(cat ../aptarchive/pool/apt_1.0.changelog)" aptget changelog apt \
  28. -qq -o APT::Changelogs::Server='http://not-on-the-main-server:8080/'
  29. testsuccess aptget changelog apt -d
  30. testfileequal 'apt.changelog' "$(cat ../aptarchive/pool/apt_1.0.changelog)"
  31. testfilestats 'apt.changelog' '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644"
  32. rm -f apt.changelog ../aptarchive/pool/apt_1.0.changelog
  33. testequal 'E: changelog download failed' aptget changelog apt -qq -d -o APT::Changelogs::Server='http://not-on-the-main-server:8080/'
  34. testfailure test -e apt.changelog