test-apt-cdrom 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. #!/bin/sh
  2. set -e
  3. TESTDIR=$(readlink -f $(dirname $0))
  4. . $TESTDIR/framework
  5. setupenvironment
  6. configarchitecture 'amd64' 'i386'
  7. buildsimplenativepackage 'testing' 'amd64,i386' '0.8.15' 'stable'
  8. setupaptarchive --no-update
  9. changetocdrom 'Debian APT Testdisk 0.8.15'
  10. # -de is not in the Release file, but picked up anyway for compatibility
  11. cd rootdir/media/cdrom-unmounted/dists/stable/main/i18n
  12. chmod +w .
  13. sed -e '/^Description-en:/ d' -e '/^ / d' -e '/^$/ d' Translation-en > Translation-de
  14. echo 'Description-de: automatisch generiertes Testpaket testing=0.8.15/stable
  15. Diese Pakete sind nur für das testen von APT gedacht,
  16. sie erfüllen keinen Zweck auf einem normalen System…
  17. ' >> Translation-de
  18. compressfile Translation-de
  19. rm -f Translation-en Translation-de
  20. chmod -R -w .
  21. cd - > /dev/null
  22. aptcdromlog() {
  23. rm -f rootdir/tmp/apt-cdrom.log
  24. test ! -e rootdir/media/cdrom || echo "CD-ROM is mounted, but shouldn't be!"
  25. test -e rootdir/media/cdrom-unmounted || echo "Unmounted CD-ROM doesn't exist, but it should!"
  26. aptcdrom "$@" -o quiet=1 >rootdir/tmp/apt-cdrom.log 2>&1 </dev/null
  27. sed -e '/gpgv/ d' -e '/^Identifying/ d' -e '/Reading / d' rootdir/tmp/apt-cdrom.log
  28. test ! -e rootdir/media/cdrom || echo "CD-ROM is mounted, but shouldn't be!"
  29. test -e rootdir/media/cdrom-unmounted || echo "Unmounted CD-ROM doesn't exist, but it should!"
  30. }
  31. CDROM_PRE="Using CD-ROM mount point $(readlink -f ./rootdir/media)/cdrom/
  32. Unmounting CD-ROM...
  33. Waiting for disc...
  34. Please insert a Disc in the drive and press enter
  35. Mounting CD-ROM...
  36. Scanning disc for index files..."
  37. CDROM_POST="This disc is called:
  38. 'Debian APT Testdisk 0.8.15'
  39. Writing new source list
  40. Source list entries for this disc are:
  41. deb cdrom:[Debian APT Testdisk 0.8.15]/ stable main
  42. deb-src cdrom:[Debian APT Testdisk 0.8.15]/ stable main
  43. Unmounting CD-ROM...
  44. Repeat this process for the rest of the CDs in your set."
  45. testequal "$CDROM_PRE
  46. Found 2 package indexes, 1 source indexes, 1 translation indexes and 1 signatures
  47. Found label 'Debian APT Testdisk 0.8.15'
  48. $CDROM_POST" aptcdromlog add
  49. testequal "Using CD-ROM mount point $(readlink -f ./rootdir/media)/cdrom/
  50. Mounting CD-ROM...
  51. Stored label: Debian APT Testdisk 0.8.15
  52. Unmounting CD-ROM..." aptcdromlog ident
  53. # apt-setup uses these commands (expect the tr in the id) to find id and label
  54. ident="$(LC_ALL=C aptcdrom ident 2>&1 )"
  55. CD_ID="$(echo "$ident" | grep "^Identifying" | head -n1 | cut -d" " -f2 | tr --delete '[]')"
  56. CD_LABEL="$(echo "$ident" | grep "^Stored label:" | head -n1 | sed "s/^[^:]*: //")"
  57. testequal "CD::${CD_ID} \"${CD_LABEL}\";
  58. CD::${CD_ID}::Label \"${CD_LABEL}\";" cat rootdir/var/lib/apt/cdroms.list
  59. testequal 'Reading package lists...
  60. Building dependency tree...
  61. The following NEW packages will be installed:
  62. testing
  63. 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
  64. Inst testing (0.8.15 stable [amd64])
  65. Conf testing (0.8.15 stable [amd64])' aptget install testing -s
  66. testequal 'Reading package lists...
  67. Building dependency tree...
  68. The following NEW packages will be installed:
  69. testing:i386
  70. 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
  71. Inst testing:i386 (0.8.15 stable [i386])
  72. Conf testing:i386 (0.8.15 stable [i386])' aptget install testing:i386 -s
  73. # check Idempotence of apt-cdrom (and disabling of Translation dropping)
  74. testequal "$CDROM_PRE
  75. Found 2 package indexes, 1 source indexes, 2 translation indexes and 1 signatures
  76. $CDROM_POST" aptcdromlog add -o APT::CDROM::DropTranslation=0
  77. # take Translations from previous runs as needed
  78. testequal "$CDROM_PRE
  79. Found 2 package indexes, 1 source indexes, 2 translation indexes and 1 signatures
  80. $CDROM_POST" aptcdromlog add
  81. msgtest 'Test for the german description translation of' 'testing'
  82. aptcache show testing -o Acquire::Languages=de | grep -q '^Description-de: ' && msgpass || msgfail
  83. rm -rf rootdir/var/lib/apt/lists
  84. mkdir -p rootdir/var/lib/apt/lists/partial
  85. testequal "$CDROM_PRE
  86. Found 2 package indexes, 1 source indexes, 1 translation indexes and 1 signatures
  87. $CDROM_POST" aptcdromlog add
  88. msgtest 'Test for the english description translation of' 'testing'
  89. aptcache show testing -o Acquire::Languages=en | grep -q '^Description-en: ' && msgpass || msgfail
  90. # check that we really can install from a 'cdrom'
  91. testdpkgnotinstalled testing
  92. testsuccess aptget install testing -y
  93. testdpkginstalled testing