test-apt-get-build-dep-file 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. #!/bin/sh
  2. set -e
  3. TESTDIR="$(readlink -f "$(dirname "$0")")"
  4. . "$TESTDIR/framework"
  5. setupenvironment
  6. configarchitecture 'i386'
  7. insertpackage 'stable' 'debhelper' 'i386' '7'
  8. insertpackage 'stable' 'build-essential' 'i386' '1'
  9. insertpackage 'stable' 'build-depends' 'i386' '1'
  10. insertsource 'stable' 'unrelated' 'any' '1'
  11. insertinstalledpackage 'build-conflict' 'i386' '1'
  12. setupaptarchive
  13. msgmsg 'Test with' 'unsigned dsc'
  14. cat > 2vcard_0.5-3.dsc <<EOF
  15. Format: 1.0
  16. Source: 2vcard
  17. Binary: 2vcard
  18. Architecture: all
  19. Version: 0.5-3
  20. Maintainer: Martin Albisetti <argentina@gmail.com>
  21. Uploaders: Marcela Tiznado <mlt@debian.org>
  22. Standards-Version: 3.8.0
  23. Build-Depends: debhelper (>= 5.0.37)
  24. Build-Conflicts: build-conflict (<< 2)
  25. Checksums-Sha1:
  26. b7f1ce31ec856414a3f0f1090689f91aa7456d56 9398 2vcard_0.5.orig.tar.gz
  27. 5f9acd07ebda6ab00fa6b4fe3198c13e94090862 2036 2vcard_0.5-3.diff.gz
  28. Checksums-Sha256:
  29. efdc22859ac2f8f030d038dc4faa9020082ebae34212498c288968ffd45c9764 9398 2vcard_0.5.orig.tar.gz
  30. 82673ff3456af571094066c89bcea87b25c23c87cf1d0050b731e5222563626b 2036 2vcard_0.5-3.diff.gz
  31. Files:
  32. f73a69c170f772f3f6e75f2d11bbb792 9398 2vcard_0.5.orig.tar.gz
  33. 1e806d32233af87437258d86b1561f57 2036 2vcard_0.5-3.diff.gz
  34. EOF
  35. test2vcardbuilddep() {
  36. testsuccessequal "Note, using file './2vcard_0.5-3.dsc' to get the build dependencies
  37. Reading package lists...
  38. Building dependency tree...
  39. The following packages will be REMOVED:
  40. build-conflict
  41. The following NEW packages will be installed:
  42. build-essential debhelper
  43. 0 upgraded, 2 newly installed, 1 to remove and 0 not upgraded.
  44. Remv build-conflict [1]
  45. Inst build-essential (1 stable [i386])
  46. Inst debhelper (7 stable [i386])
  47. Conf build-essential (1 stable [i386])
  48. Conf debhelper (7 stable [i386])" aptget build-dep -s ./2vcard_0.5-3.dsc
  49. testfailure aptget build-dep --simulate 2vcard_0.5-3.dsc
  50. cd downloaded
  51. testsuccess aptget build-dep --simulate ../2vcard_0.5-3.dsc
  52. testsuccess aptget build-dep --simulate "$(readlink -f ../2vcard_0.5-3.dsc)"
  53. cd ..
  54. }
  55. test2vcardbuilddep
  56. msgmsg 'Test with' 'signed dsc'
  57. cat > 2vcard_0.5-3.dsc <<EOF
  58. -----BEGIN PGP SIGNED MESSAGE-----
  59. Hash: SHA1
  60. Format: 1.0
  61. Source: 2vcard
  62. Binary: 2vcard
  63. Architecture: all
  64. Version: 0.5-3
  65. Maintainer: Martin Albisetti <argentina@gmail.com>
  66. Uploaders: Marcela Tiznado <mlt@debian.org>
  67. Standards-Version: 3.8.0
  68. Build-Depends: debhelper (>= 5.0.37)
  69. Build-Conflicts: build-conflict (<< 2)
  70. Checksums-Sha1:
  71. b7f1ce31ec856414a3f0f1090689f91aa7456d56 9398 2vcard_0.5.orig.tar.gz
  72. 5f9acd07ebda6ab00fa6b4fe3198c13e94090862 2036 2vcard_0.5-3.diff.gz
  73. Checksums-Sha256:
  74. efdc22859ac2f8f030d038dc4faa9020082ebae34212498c288968ffd45c9764 9398 2vcard_0.5.orig.tar.gz
  75. 82673ff3456af571094066c89bcea87b25c23c87cf1d0050b731e5222563626b 2036 2vcard_0.5-3.diff.gz
  76. Files:
  77. f73a69c170f772f3f6e75f2d11bbb792 9398 2vcard_0.5.orig.tar.gz
  78. 1e806d32233af87437258d86b1561f57 2036 2vcard_0.5-3.diff.gz
  79. -----BEGIN PGP SIGNATURE-----
  80. Version: GnuPG v1.4.9 (GNU/Linux)
  81. iEYEARECAAYFAkijKhsACgkQsrBfRdYmq7aA2gCfaOW9riTYVQMx5ajKQVAcctlC
  82. z2UAn1oXgTai6opwhVfkxrlmJ+iRxzuc
  83. =4eRd
  84. -----END PGP SIGNATURE-----
  85. EOF
  86. test2vcardbuilddep
  87. msgmsg 'Test with' 'unpacked source dir'
  88. mkdir -p foo-1.0/debian
  89. cat > foo-1.0/debian/control <<'EOF'
  90. Source: apturl
  91. Section: admin
  92. Priority: optional
  93. Maintainer: Michael Vogt <mvo@ubuntu.com>
  94. Build-Depends: debhelper (>= 7)
  95. X-Python3-Version: >= 3.2
  96. Standards-Version: 3.9.3
  97. Package: apturl-common
  98. Architecture: any
  99. Depends: ${python3:Depends},
  100. ${shlibs:Depends},
  101. ${misc:Depends},
  102. python3-apt,
  103. python3-update-manager
  104. Replaces: apturl (<< 0.3.6ubuntu2)
  105. Description: install packages using the apt protocol - common data
  106. AptUrl is a simple graphical application that takes an URL (which follows the
  107. apt-protocol) as a command line option, parses it and carries out the
  108. operations that the URL describes (that is, it asks the user if he wants the
  109. indicated packages to be installed and if the answer is positive does so for
  110. him).
  111. .
  112. This package contains the common data shared between the frontends.
  113. EOF
  114. testsuccessequal "Note, using directory './foo-1.0' to get the build dependencies
  115. Reading package lists...
  116. Building dependency tree...
  117. The following NEW packages will be installed:
  118. build-essential debhelper
  119. 0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
  120. Inst build-essential (1 stable [i386])
  121. Inst debhelper (7 stable [i386])
  122. Conf build-essential (1 stable [i386])
  123. Conf debhelper (7 stable [i386])" aptget build-dep --simulate ./foo-1.0
  124. testfailure aptget build-dep --simulate foo-1.0
  125. cd downloaded
  126. testsuccess aptget build-dep --simulate ../foo-1.0
  127. testsuccess aptget build-dep --simulate "$(readlink -f ../foo-1.0)"
  128. cd ..
  129. cd foo-1.0
  130. testsuccess aptget build-dep --simulate './'
  131. testsuccess aptget build-dep --simulate '.'
  132. cd debian
  133. testsuccess aptget build-dep --simulate './../'
  134. testsuccess aptget build-dep --simulate '../'
  135. testsuccess aptget build-dep --simulate '..'
  136. cd ../..
  137. testfailureequal 'E: Must specify at least one package to check builddeps for' aptget build-dep
  138. testfailureequal 'E: No architecture information available for armel. See apt.conf(5) APT::Architectures for setup' aptget build-dep --simulate ./foo-1.0 -a armel
  139. testfailureequal 'Reading package lists...
  140. E: Unable to find a source package for foo' aptget build-dep --simulate foo
  141. msgmsg 'Test with a dsc' 'with comments'
  142. cat > comments.dsc <<EOF
  143. # I love comments
  144. # I love them so much, I give them their own paragraph
  145. #This is my first package
  146. Format: 3.0 (native)
  147. Source: comments
  148. Binary: comments
  149. Architecture: all
  150. Version: 1
  151. #Version: 2
  152. Maintainer: Joe Sixpack <joe@example.org>
  153. Build-Depends: debhelper (>= 5),
  154. # TODO: add more
  155. build-depends (= 1),
  156. Standards-Version: 3.9.6
  157. # This is the end…
  158. # or this?
  159. EOF
  160. testsuccessequal "Note, using file './comments.dsc' to get the build dependencies
  161. Reading package lists...
  162. Building dependency tree...
  163. The following NEW packages will be installed:
  164. build-depends build-essential debhelper
  165. 0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
  166. Inst build-depends (1 stable [i386])
  167. Inst build-essential (1 stable [i386])
  168. Inst debhelper (7 stable [i386])
  169. Conf build-depends (1 stable [i386])
  170. Conf build-essential (1 stable [i386])
  171. Conf debhelper (7 stable [i386])" aptget build-dep --simulate ./comments.dsc
  172. testsuccessequal "Note, using file './comments.dsc' to get the build dependencies
  173. Reading package lists...
  174. Building dependency tree...
  175. Execute external solver...
  176. The following NEW packages will be installed:
  177. build-depends build-essential debhelper
  178. 0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
  179. Inst build-depends (1 stable [i386])
  180. Inst build-essential (1 stable [i386])
  181. Inst debhelper (7 stable [i386])
  182. Conf build-depends (1 stable [i386])
  183. Conf build-essential (1 stable [i386])
  184. Conf debhelper (7 stable [i386])" aptget build-dep --simulate ./comments.dsc --solver apt