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.
 
 
 
 
 
 

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