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.
 
 
 
 
 
 

162 lines
5.5 KiB

  1. #!/bin/sh
  2. set -e
  3. TESTDIR="$(readlink -f "$(dirname "$0")")"
  4. . "$TESTDIR/framework"
  5. setupenvironment
  6. configarchitecture 'amd64' 'i386' 'armel'
  7. insertinstalledpackage 'build-essential' 'all' '0' 'Multi-Arch: foreign'
  8. insertpackage 'unstable' 'foo' 'all' '1.0'
  9. insertpackage 'unstable' 'bar' 'all' '1.0'
  10. insertsource 'unstable' 'buildprofiles' 'any' '1' 'Build-Depends: foo (>= 1.0) [i386 arm] <!stage1 !cross>, bar'
  11. # table from https://wiki.debian.org/BuildProfileSpec
  12. insertsource 'unstable' 'spec-1' 'any' '1' 'Build-Depends: foo <!stage1>'
  13. insertsource 'unstable' 'spec-2' 'any' '1' 'Build-Depends: foo <stage1>'
  14. insertsource 'unstable' 'spec-3' 'any' '1' 'Build-Depends: foo <!stage1 !notest>'
  15. insertsource 'unstable' 'spec-4' 'any' '1' 'Build-Depends: foo <stage1 notest>'
  16. insertsource 'unstable' 'spec-5' 'any' '1' 'Build-Depends: foo <!stage1 notest>'
  17. insertsource 'unstable' 'spec-6' 'any' '1' 'Build-Depends: foo <stage1 !notest>'
  18. insertsource 'unstable' 'spec-7' 'any' '1' 'Build-Depends: foo <stage1> <!notest>'
  19. setupaptarchive
  20. testsuccessequal 'Reading package lists...
  21. Reading package lists...
  22. Building dependency tree...
  23. The following NEW packages will be installed:
  24. bar
  25. 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
  26. Inst bar (1.0 unstable [all])
  27. Conf bar (1.0 unstable [all])' aptget build-dep buildprofiles -s
  28. testsuccessequal 'Reading package lists...
  29. Building dependency tree...
  30. The following NEW packages will be installed:
  31. bar foo
  32. 0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
  33. Inst bar (1.0 unstable [all])
  34. Inst foo (1.0 unstable [all])
  35. Conf bar (1.0 unstable [all])
  36. Conf foo (1.0 unstable [all])' aptget build-dep buildprofiles -s -o APT::Architecture=i386
  37. testsuccessequal 'Reading package lists...
  38. Building dependency tree...
  39. The following NEW packages will be installed:
  40. bar
  41. 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
  42. Inst bar (1.0 unstable [all])
  43. Conf bar (1.0 unstable [all])' aptget build-dep buildprofiles -s -o APT::Architecture=armel
  44. testsuccessequal 'Reading package lists...
  45. Building dependency tree...
  46. The following NEW packages will be installed:
  47. bar
  48. 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
  49. Inst bar (1.0 unstable [all])
  50. Conf bar (1.0 unstable [all])' aptget build-dep buildprofiles -s -o APT::Architecture=i386 -P stage1
  51. KEEP='Reading package lists...
  52. Reading package lists...
  53. Building dependency tree...
  54. The following NEW packages will be installed:
  55. foo
  56. 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
  57. Inst foo (1.0 unstable [all])
  58. Conf foo (1.0 unstable [all])'
  59. setdrop() {
  60. DROP="Reading package lists...
  61. $1 has no build depends.
  62. Reading package lists...
  63. Building dependency tree...
  64. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded."
  65. }
  66. msgtest 'Check if version of installed dpkg is high enough for' 'build profiles support'
  67. if dpkg --compare-versions "$(dpkg_version)" 'ge' '1.17.14'; then
  68. msgpass
  69. testwithdpkg() {
  70. msgtest "Test with" "dpkg-checkbuilddeps -d '$1' -P '$2'"
  71. local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwithdpkg.output"
  72. if dpkgcheckbuilddeps -d "$1" -P "$2" /dev/null >$OUTPUT 2>&1; then
  73. if [ "$3" = "$DROP" ]; then
  74. msgpass
  75. else
  76. cat $OUTPUT
  77. msgfail
  78. fi
  79. else
  80. if [ "$3" = "$KEEP" ]; then
  81. msgpass
  82. else
  83. cat $OUTPUT
  84. msgfail
  85. fi
  86. fi
  87. }
  88. else
  89. msgskip
  90. testwithdpkg() {
  91. msgtest "Test with" "dpkg-checkbuilddeps -d '$1' -P '$2'"
  92. msgskip
  93. }
  94. fi
  95. testprofile() {
  96. if [ -n "$3" ]; then
  97. testequal "$4" aptget build-dep "$1" -s -P "$3"
  98. export DEB_BUILD_PROFILES="$(echo "$3" | tr ',' ' ')"
  99. testequal "$4" aptget build-dep "$1" -s -o with::environment=1
  100. unset DEB_BUILD_PROFILES
  101. else
  102. testequal "$4" aptget build-dep "$1" -s
  103. fi
  104. testwithdpkg "$2" "$3" "$4"
  105. }
  106. testsuccess aptcache gencaches
  107. setdrop 'spec-1'
  108. testprofile 'spec-1' 'foo <!stage1>' '' "$KEEP"
  109. testprofile 'spec-1' 'foo <!stage1>' 'stage1' "$DROP"
  110. testprofile 'spec-1' 'foo <!stage1>' 'notest' "$KEEP"
  111. testprofile 'spec-1' 'foo <!stage1>' 'stage1,notest' "$DROP"
  112. setdrop 'spec-2'
  113. testprofile 'spec-2' 'foo <stage1>' '' "$DROP"
  114. testprofile 'spec-2' 'foo <stage1>' 'stage1' "$KEEP"
  115. testprofile 'spec-2' 'foo <stage1>' 'notest' "$DROP"
  116. testprofile 'spec-2' 'foo <stage1>' 'stage1,notest' "$KEEP"
  117. setdrop 'spec-3'
  118. testprofile 'spec-3' 'foo <!stage1 !notest>' '' "$KEEP"
  119. testprofile 'spec-3' 'foo <!stage1 !notest>' 'stage1' "$DROP"
  120. testprofile 'spec-3' 'foo <!stage1 !notest>' 'notest' "$DROP"
  121. testprofile 'spec-3' 'foo <!stage1 !notest>' 'stage1,notest' "$DROP"
  122. setdrop 'spec-4'
  123. testprofile 'spec-4' 'foo <stage1 notest>' '' "$DROP"
  124. testprofile 'spec-4' 'foo <stage1 notest>' 'stage1' "$DROP"
  125. testprofile 'spec-4' 'foo <stage1 notest>' 'notest' "$DROP"
  126. testprofile 'spec-4' 'foo <stage1 notest>' 'stage1,notest' "$KEEP"
  127. setdrop 'spec-5'
  128. testprofile 'spec-5' 'foo <!stage1 notest>' '' "$DROP"
  129. testprofile 'spec-5' 'foo <!stage1 notest>' 'stage1' "$DROP"
  130. testprofile 'spec-5' 'foo <!stage1 notest>' 'notest' "$KEEP"
  131. testprofile 'spec-5' 'foo <!stage1 notest>' 'stage1,notest' "$DROP"
  132. setdrop 'spec-6'
  133. testprofile 'spec-6' 'foo <stage1 !notest>' '' "$DROP"
  134. testprofile 'spec-6' 'foo <stage1 !notest>' 'stage1' "$KEEP"
  135. testprofile 'spec-6' 'foo <stage1 !notest>' 'notest' "$DROP"
  136. testprofile 'spec-6' 'foo <stage1 !notest>' 'stage1,notest' "$DROP"
  137. setdrop 'spec-7'
  138. testprofile 'spec-7' 'foo <stage1> <!notest>' '' "$KEEP"
  139. testprofile 'spec-7' 'foo <stage1> <!notest>' 'stage1' "$KEEP"
  140. testprofile 'spec-7' 'foo <stage1> <!notest>' 'notest' "$DROP"
  141. testprofile 'spec-7' 'foo <stage1> <!notest>' 'stage1,notest' "$KEEP"