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.
 
 
 
 
 
 

122 lines
4.3 KiB

  1. #!/bin/sh
  2. set -e
  3. TESTDIR="$(readlink -f "$(dirname "$0")")"
  4. . "$TESTDIR/framework"
  5. setupenvironment
  6. configarchitecture 'amd64' 'i386'
  7. # regression test for #754904
  8. testfailureequal 'E: Unsupported file /dev/null given on commandline' aptget install -qq /dev/null
  9. # only consider .deb files
  10. cat > foo.rpm <<EOF
  11. I'm not a deb, I'm a teapot.
  12. EOF
  13. testfailureequal 'E: Unsupported file ./foo.rpm given on commandline' aptget install -qq ./foo.rpm
  14. # and ensure we fail for invalid debs
  15. mv foo.rpm foo.deb
  16. testfailuremsg "E: Sub-process Popen returned an error code (2)
  17. E: Encountered a section with no Package: header
  18. E: Problem with MergeList ${TMPWORKINGDIRECTORY}/foo.deb
  19. E: The package lists or status file could not be parsed or opened." aptget install ./foo.deb
  20. buildsimplenativepackage 'foo' 'i386,amd64' '1.0'
  21. testfailureequal "Reading package lists...
  22. Building dependency tree...
  23. Note, selecting 'foo:i386' instead of './incoming/foo_1.0_i386.deb'
  24. Note, selecting 'foo' instead of './incoming/foo_1.0_amd64.deb'
  25. Some packages could not be installed. This may mean that you have
  26. requested an impossible situation or if you are using the unstable
  27. distribution that some required packages have not yet been created
  28. or been moved out of Incoming.
  29. The following information may help to resolve the situation:
  30. The following packages have unmet dependencies:
  31. foo:i386 : Conflicts: foo but 1.0 is to be installed
  32. foo : Conflicts: foo:i386 but 1.0 is to be installed
  33. E: Unable to correct problems, you have held broken packages." aptget install ./incoming/foo_1.0_i386.deb ./incoming/foo_1.0_amd64.deb -s
  34. testdpkgnotinstalled 'foo' 'foo:i386'
  35. testsuccess aptget install ./incoming/foo_1.0_i386.deb -o Debug::pkgCacheGen=1
  36. testdpkginstalled 'foo:i386'
  37. testfailure aptget install incoming/foo_1.0_i386.deb -o Debug::pkgCacheGen=1
  38. cd downloaded
  39. testsuccess aptget install "$(readlink -f ../incoming/foo_1.0_i386.deb)" -o Debug::pkgCacheGen=1 -y --allow-downgrades
  40. testsuccess aptget install ../incoming/foo_1.0_i386.deb -o Debug::pkgCacheGen=1 -y --allow-downgrades
  41. cd ..
  42. testsuccessequal "Reading package lists...
  43. Building dependency tree...
  44. Reading state information...
  45. Note, selecting 'foo' instead of './incoming/foo_1.0_amd64.deb'
  46. The following packages will be REMOVED:
  47. foo:i386
  48. The following NEW packages will be installed:
  49. foo
  50. 0 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
  51. Remv foo:i386 [1.0]
  52. Inst foo (1.0 local-deb [amd64])
  53. Conf foo (1.0 local-deb [amd64])" aptget install ./incoming/foo_1.0_amd64.deb -s
  54. # Check that installing the local deb works if it is not the candidate
  55. echo "Package: foo
  56. Pin: version 1.0
  57. Pin-Priority: -1" > rootdir/etc/apt/preferences
  58. testsuccessequal "Reading package lists...
  59. Building dependency tree...
  60. Reading state information...
  61. Note, selecting 'foo' instead of './incoming/foo_1.0_amd64.deb'
  62. The following packages will be REMOVED:
  63. foo:i386
  64. The following NEW packages will be installed:
  65. foo
  66. 0 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
  67. Remv foo:i386 [1.0]
  68. Inst foo (1.0 local-deb [amd64])
  69. Conf foo (1.0 local-deb [amd64])" aptget install ./incoming/foo_1.0_amd64.deb -s
  70. createpkg() {
  71. local PKG="pkg-$1"
  72. mkdir -p ./incoming/$PKG/DEBIAN
  73. if [ -n "$2" ]; then
  74. echo -n "$2" >> ./incoming/$PKG/DEBIAN/control
  75. fi
  76. echo "Package: $PKG
  77. Version: 0
  78. Priority: extra
  79. Maintainer: No Body <no@example.org>
  80. Architecture: all
  81. Description: test package" >> ./incoming/$PKG/DEBIAN/control
  82. if [ -n "$3" ]; then
  83. echo -n "$3" >> ./incoming/$PKG/DEBIAN/control
  84. fi
  85. testsuccess dpkg-deb --build ./incoming/$PKG/ ./incoming
  86. #dpkg-deb -I ./incoming/${PKG}_0_all.deb control
  87. }
  88. createpkg 'as-it-should-be'
  89. createpkg 'leading-newline' '
  90. '
  91. createpkg 'trailing-newline' '' '
  92. '
  93. testsuccess aptget install ./incoming/pkg-as-it-should-be_0_all.deb
  94. testsuccess aptget install ./incoming/pkg-leading-newline_0_all.deb
  95. testsuccess aptget install ./incoming/pkg-trailing-newline_0_all.deb
  96. # see if permission dropping is checked before usage
  97. if [ "$(id -u)" = '0' ]; then
  98. apt clean
  99. chmod 711 ./incoming
  100. testsuccess aptget install -y --allow-downgrades ./incoming/pkg-as-it-should-be_0_all.deb
  101. chmod 710 ./incoming
  102. testsuccesswithnotice aptget install -y --allow-downgrades ./incoming/pkg-as-it-should-be_0_all.deb
  103. chmod 700 ./incoming
  104. testsuccesswithnotice aptget install -y --allow-downgrades ./incoming/pkg-as-it-should-be_0_all.deb
  105. fi