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.
 
 
 
 
 
 

159 lines
6.0 KiB

  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 555 .
  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\?:\s*Signature made/ d' \
  28. -e '/gpgv\?:\s*Good signature/ d' \
  29. -e '/gpgv\?:\s*using RSA key/ d' \
  30. -e '/gpgv\?:\s*issuer/ d' \
  31. -e '/^Identifying/ d' \
  32. -e '/Reading / d' rootdir/tmp/apt-cdrom.log
  33. test ! -e rootdir/media/cdrom || echo "CD-ROM is mounted, but shouldn't be!"
  34. test -e rootdir/media/cdrom-unmounted || echo "Unmounted CD-ROM doesn't exist, but it should!"
  35. }
  36. aptautotest_aptcdromlog_add() { aptautotest_aptget_update "$@"; }
  37. CDROM_PRE="Using CD-ROM mount point $(readlink -f ./rootdir/media)/cdrom/
  38. Unmounting CD-ROM...
  39. Waiting for disc...
  40. Please insert a Disc in the drive and press [Enter]
  41. Mounting CD-ROM...
  42. Scanning disc for index files..."
  43. CDROM_POST="This disc is called:
  44. 'Debian APT Testdisk 0.8.15'
  45. Writing new source list
  46. Source list entries for this disc are:
  47. deb cdrom:[Debian APT Testdisk 0.8.15]/ stable main
  48. deb-src cdrom:[Debian APT Testdisk 0.8.15]/ stable main
  49. Unmounting CD-ROM...
  50. Repeat this process for the rest of the CDs in your set."
  51. testsuccessequal "$CDROM_PRE
  52. Found 3 package indexes, 1 source indexes, 1 translation indexes and 1 signatures
  53. Found label 'Debian APT Testdisk 0.8.15'
  54. $CDROM_POST" aptcdromlog add
  55. testsuccessequal "Using CD-ROM mount point $(readlink -f ./rootdir/media)/cdrom/
  56. Mounting CD-ROM...
  57. Stored label: Debian APT Testdisk 0.8.15
  58. Unmounting CD-ROM..." aptcdromlog ident
  59. # apt-setup uses these commands (expect the tr in the id) to find id and label
  60. ident="$(LC_ALL=C aptcdrom ident 2>&1 )"
  61. CD_ID="$(echo "$ident" | grep "^Identifying" | head -n1 | cut -d" " -f2 | tr --delete '[]')"
  62. CD_LABEL="$(echo "$ident" | grep "^Stored label:" | head -n1 | sed "s/^[^:]*: //")"
  63. testfileequal rootdir/var/lib/apt/cdroms.list "CD::${CD_ID} \"${CD_LABEL}\";
  64. CD::${CD_ID}::Label \"${CD_LABEL}\";"
  65. testcdromusage() {
  66. touch rootdir/var/lib/apt/extended_states
  67. testsuccessequal 'Reading package lists...
  68. Building dependency tree...
  69. Reading state information...
  70. The following NEW packages will be installed:
  71. testing
  72. 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
  73. Inst testing (0.8.15 stable [amd64])
  74. Conf testing (0.8.15 stable [amd64])' aptget install testing -s
  75. testdpkgnotinstalled testing
  76. testsuccess aptget install testing -y
  77. testdpkginstalled testing
  78. testsuccess aptget purge testing -y
  79. testdpkgnotinstalled testing
  80. testsuccessequal 'Reading package lists...
  81. Building dependency tree...
  82. Reading state information...
  83. The following NEW packages will be installed:
  84. testing:i386
  85. 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
  86. Inst testing:i386 (0.8.15 stable [i386])
  87. Conf testing:i386 (0.8.15 stable [i386])' aptget install testing:i386 -s
  88. testdpkgnotinstalled testing:i386
  89. testsuccess aptget install testing:i386 -y
  90. testdpkginstalled testing:i386
  91. testsuccess aptget purge testing:i386 -y
  92. testdpkgnotinstalled testing:i386
  93. cd downloaded
  94. rm -f testing_0.8.15_amd64.deb
  95. testsuccess aptget download testing
  96. testsuccess test -s testing_0.8.15_amd64.deb
  97. rm -f testing_0.8.15_amd64.deb
  98. rm -f testing_0.8.15.dsc
  99. testsuccess aptget source testing --dsc-only
  100. testsuccess test -s testing_0.8.15.dsc
  101. rm -f testing_0.8.15.dsc
  102. cd - >/dev/null
  103. }
  104. testcdromusage
  105. # check Idempotence of apt-cdrom (and disabling of Translation dropping)
  106. testsuccessequal "$CDROM_PRE
  107. Found 3 package indexes, 1 source indexes, 2 translation indexes and 1 signatures
  108. $CDROM_POST" aptcdromlog add -o APT::CDROM::DropTranslation=0
  109. # take Translations from previous runs as needed
  110. testsuccessequal "$CDROM_PRE
  111. Found 3 package indexes, 1 source indexes, 2 translation indexes and 1 signatures
  112. $CDROM_POST" aptcdromlog add
  113. msgtest 'Test for the german description translation of' 'testing'
  114. aptcache show testing -o Acquire::Languages=de | grep -q '^Description-de: ' && msgpass || msgfail
  115. rm -rf rootdir/var/lib/apt/lists
  116. testsuccessequal "$CDROM_PRE
  117. Found 3 package indexes, 1 source indexes, 1 translation indexes and 1 signatures
  118. $CDROM_POST" aptcdromlog add
  119. msgtest 'Test for the english description translation of' 'testing'
  120. aptcache show testing -o Acquire::Languages=en | grep -q '^Description-en: ' && msgpass || msgfail
  121. # ensure cdrom method isn't trying to mount the cdrom
  122. mv rootdir/media/cdrom-unmounted rootdir/media/cdrom-ejected
  123. msgmsg "ensure an update doesn't mess with cdrom sources"
  124. testsuccess aptget update
  125. testfileequal rootdir/tmp/testsuccess.output 'Hit:1 cdrom://Debian APT Testdisk 0.8.15 stable InRelease
  126. Reading package lists...'
  127. mv rootdir/media/cdrom-ejected rootdir/media/cdrom-unmounted
  128. testcdromusage
  129. msgmsg 'and again to check that it withstands the temptation even if it could mount'
  130. testsuccess aptget update
  131. testfileequal rootdir/tmp/testsuccess.output 'Hit:1 cdrom://Debian APT Testdisk 0.8.15 stable InRelease
  132. Reading package lists...'
  133. testcdromusage
  134. msgmsg 'Check that nothing touched our' 'CD-ROM'
  135. for file in $(find rootdir/media/cdrom-unmounted/dists); do
  136. testfilestats "$file" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:555"
  137. done