list_toolchain_updates_checks 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. #!/bin/bash
  2. # ndk version
  3. read -d '' p << 'EOF' || true
  4. if (m/^\\s*NDK_VERSION\\s*=\\s*"(.+)"/) {
  5. print $1;
  6. exit;
  7. }
  8. EOF
  9. needed=$(cat python/mozboot/mozboot/android.py | perl -ne "$p")
  10. current='r[% pc("android-toolchain", "var/android_ndk_version") %][% pc("android-toolchain", "var/android_ndk_revision") %]'
  11. check_update_needed ndk_version "$needed" "$current"
  12. # rust
  13. read -d '' p << 'EOF' || true
  14. my $d = YAML::XS::LoadFile('taskcluster/ci/toolchain/rust.yml');
  15. foreach my $t (keys %$d) {
  16. if ($d->{$t}{run}{'toolchain-alias'} eq 'linux64-rust-android') {
  17. my $channel;
  18. foreach my $arg (@{$d->{$t}{run}{arguments}}) {
  19. if ($arg eq '--channel') {
  20. $channel = 1;
  21. next;
  22. }
  23. if ($channel) {
  24. print $arg;
  25. exit;
  26. }
  27. }
  28. }
  29. }
  30. EOF
  31. needed=$(perl -MYAML::XS -e "$p")
  32. current='[% pc("rust", "version") %]'
  33. check_update_needed rust "$needed" "$current"
  34. # build_tools
  35. read -d '' p << 'EOF' || true
  36. if (m/build_tools_version\\s*=\\s*"([^"]+)"/) {
  37. print $1;
  38. exit;
  39. }
  40. EOF
  41. needed=$(cat build/moz.configure/android-sdk.configure | perl -ne "$p")
  42. current='[% pc("android-toolchain", "var/version_31") %]'
  43. check_update_needed build_tools "$needed" "$current"
  44. # target_sdk
  45. read -d '' p << 'EOF' || true
  46. if (m/target_sdk_version\\s*=\\s*"(.+)"/) {
  47. print $1;
  48. exit;
  49. }
  50. EOF
  51. needed=$(cat build/moz.configure/android-sdk.configure | perl -ne "$p")
  52. current='[% pc("android-toolchain", "var/android_api_level") %]'
  53. check_update_needed target_sdk "$needed" "$current"
  54. # cmdline-tools
  55. read -d '' p << 'EOF' || true
  56. my $v, $s;
  57. while (<>) {
  58. if (m/^\\s*CMDLINE_TOOLS_VERSION_STRING\\s*=\\s*"(.+)"/) {
  59. $s = $1;
  60. }
  61. if (m/^\\s*CMDLINE_TOOLS_VERSION\\s*=\\s*"(.+)"/) {
  62. $v = $1;
  63. }
  64. if ($v && $s) {
  65. print "$s-$v";
  66. exit;
  67. }
  68. }
  69. EOF
  70. needed=$(cat python/mozboot/mozboot/android.py | perl -e "$p")
  71. current='[% pc("android-toolchain", "var/commandlinetools_version_string") %]-[% pc("android-toolchain", "var/commandlinetools_version") %]'
  72. check_update_needed cmdline-tools "$needed" "$current"
  73. # min-android
  74. read -d '' p << 'EOF' || true
  75. use Path::Tiny;
  76. use Digest::SHA qw(sha256_hex);
  77. my $f;
  78. my $min_indent;
  79. foreach (path('build/moz.configure/android-ndk.configure')->lines_utf8) {
  80. if ($_ eq "def min_android_version(target):\\n") {
  81. $f = $_;
  82. next;
  83. } else {
  84. next unless $f;
  85. }
  86. m/^(\\s*)/;
  87. my $indent = length $1;
  88. $min_indent = $indent unless $min_indent;
  89. last if $indent < $min_indent;
  90. $f .= $_;
  91. }
  92. print substr(sha256_hex($f), 0, 10);
  93. EOF
  94. needed=$(perl -e "$p")
  95. # We can't easily parse the min_android_version function.
  96. # Instead we get a checksum of the function, and manually check it when
  97. # it was updated.
  98. # Current value of min_android_version is:
  99. # 21 on aarch64, x86_64
  100. # 16 on other archs
  101. current=303de6de36
  102. check_update_needed min-android "$needed" "$current"
  103. # min_sdk
  104. read -d '' p << 'EOF' || true
  105. if (m/^\\s*min_sdk_version="[^"]+" if geckoview_lite else "([^"]+)"/) {
  106. print $1;
  107. exit;
  108. }
  109. EOF
  110. needed=$(cat build/moz.configure/android-sdk.configure | perl -ne "$p")
  111. current=21
  112. check_update_needed min_sdk "$needed" "$current"
  113. # gradle
  114. read -d '' p << 'EOF' || true
  115. if (m|distributionUrl=https\\\\://services.gradle.org/distributions/gradle-(.*)-all.zip|) {
  116. print $1;
  117. exit;
  118. }
  119. EOF
  120. needed=$(cat gradle/wrapper/gradle-wrapper.properties | perl -ne "$p")
  121. current='[% c("var/gradle_version") %]'
  122. check_update_needed gradle "$needed" "$current"
  123. # cbindgen
  124. read -d '' p << 'EOF' || true
  125. if (m/^\\s*cbindgen_min_version\\s*=\\s*Version\\("([^"]+)"\\)/) {
  126. print $1;
  127. exit;
  128. }
  129. EOF
  130. needed=$(cat build/moz.configure/bindgen.configure | perl -ne "$p")
  131. current='[% pc("cbindgen", "version") %]'
  132. check_update_needed cbindgen "$needed" "$current"
  133. # nasm
  134. read -d '' p << 'EOF' || true
  135. my $nasm = YAML::XS::LoadFile('taskcluster/ci/toolchain/nasm.yml');
  136. my $linux64 = 'linux64-nasm';
  137. print substr $nasm->{$linux64}{'fetches'}{'fetch'}[0], 5;
  138. EOF
  139. needed=$(perl -MYAML::XS -e "$p")
  140. current='2.15.05'
  141. check_update_needed nasm "$needed" "$current"
  142. # clang
  143. read -d '' p << 'EOF' || true
  144. my $d = YAML::XS::LoadFile('taskcluster/ci/toolchain/clang.yml');
  145. my $clang_toolchain;
  146. TOOLCHAIN: foreach my $t (keys %$d) {
  147. foreach my $alias (@{$d->{$t}{run}{'toolchain-alias'}}) {
  148. if ($alias eq 'linux64-clang') {
  149. foreach my $fetch (@{$d->{$t}{fetches}{toolchain}}) {
  150. $clang_toolchain = $fetch if $fetch =~ m/^.*-clang-.*/;
  151. }
  152. last TOOLCHAIN;
  153. }
  154. }
  155. }
  156. if (!$clang_toolchain) {
  157. print STDERR "Error: could not find clang toolchain\\n";
  158. exit 1;
  159. }
  160. my $clang_fetch;
  161. foreach my $fetch (@{$d->{$clang_toolchain}{fetches}{fetch}}) {
  162. $clang_fetch = $fetch if $fetch =~ m/^clang-.*/;
  163. }
  164. if (!$clang_fetch) {
  165. print STDERR "Error: could not find clang fetch\\n";
  166. exit 1;
  167. }
  168. my $fetch = YAML::XS::LoadFile('taskcluster/ci/fetch/toolchains.yml');
  169. print $fetch->{$clang_fetch}{fetch}{revision};
  170. EOF
  171. needed=$(perl -MYAML::XS -e "$p")
  172. current='[% pc("llvm-project", "git_hash") %]'
  173. check_update_needed clang "$needed" "$current"
  174. # node
  175. read -d '' p << 'EOF' || true
  176. sub l {
  177. ref $_[0] eq 'ARRAY' ? $_[0] : [ $_[0] ];
  178. }
  179. my $d = YAML::XS::LoadFile('taskcluster/ci/toolchain/node.yml');
  180. my $node_toolchain;
  181. T: foreach my $t (keys %$d) {
  182. foreach my $alias (@{l($d->{$t}{run}{'toolchain-alias'})}) {
  183. if ($alias eq 'linux64-node') {
  184. foreach my $fetch (@{$d->{$t}{fetches}{fetch}}) {
  185. if ($fetch =~ m/^nodejs-.*/) {
  186. $node_toolchain = $fetch;
  187. last T;
  188. }
  189. }
  190. }
  191. }
  192. }
  193. exit 1 unless $node_toolchain;
  194. my $fetch = YAML::XS::LoadFile('taskcluster/ci/fetch/toolchains.yml');
  195. my ($version) = $fetch->{$node_toolchain}{fetch}{url} =~ m|^https://nodejs.org/dist/v([^/]+)/|;
  196. print "$version\\n";
  197. EOF
  198. needed=$(perl -MYAML::XS -e "$p")
  199. current='[% pc("node", "version") %]'
  200. check_update_needed node "$needed" "$current"
  201. # python
  202. read -d '' p << 'EOF' || true
  203. if (m/^\\s*"Bootstrap currently only runs on Python ([^"]+)\\."/) {
  204. print $1;
  205. exit;
  206. }
  207. EOF
  208. needed=$(cat python/mozboot/bin/bootstrap.py | perl -ne "$p")
  209. current="3.5+"
  210. check_update_needed python "$needed" "$current"