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

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