list_toolchain_updates_checks 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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_30") %]'
  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*MOZ_ANDROID_MIN_SDK_VERSION\\s*=\\s*([^\\s]+)/) {
  106. print $1;
  107. exit;
  108. }
  109. EOF
  110. needed=$(cat mobile/android/confvars.sh | perl -ne "$p")
  111. current=16
  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. if (m/^\\s*MODERN_NASM_VERSION\\s*=\\s*LooseVersion\\("([^"]+)"\\)/) {
  136. print $1;
  137. exit;
  138. }
  139. EOF
  140. needed=$(cat python/mozboot/mozboot/base.py | perl -ne "$p")
  141. current='2.14'
  142. check_update_needed nasm "$needed" "$current"
  143. # clang
  144. read -d '' p << 'EOF' || true
  145. my $d = YAML::XS::LoadFile('taskcluster/ci/toolchain/clang.yml');
  146. my $clang_toolchain;
  147. foreach my $t (keys %$d) {
  148. if ($d->{$t}{run}{'toolchain-alias'} eq 'linux64-clang-android-cross') {
  149. foreach my $fetch (@{$d->{$t}{fetches}{fetch}}) {
  150. $clang_toolchain = $fetch if $fetch =~ m/^clang-.*/;
  151. }
  152. last;
  153. }
  154. }
  155. if (!$clang_toolchain) {
  156. print STDERR "Error: could not find clang toolchain";
  157. exit 1;
  158. }
  159. my $fetch = YAML::XS::LoadFile('taskcluster/ci/fetch/toolchains.yml');
  160. print $fetch->{$clang_toolchain}{fetch}{revision};
  161. EOF
  162. needed=$(perl -MYAML::XS -e "$p")
  163. current='[% pc("llvm-project", "git_hash") %]'
  164. check_update_needed clang "$needed" "$current"
  165. # node
  166. read -d '' p << 'EOF' || true
  167. sub l {
  168. ref $_[0] eq 'ARRAY' ? $_[0] : [ $_[0] ];
  169. }
  170. my $d = YAML::XS::LoadFile('taskcluster/ci/toolchain/node.yml');
  171. my $node_toolchain;
  172. T: foreach my $t (keys %$d) {
  173. foreach my $alias (@{l($d->{$t}{run}{'toolchain-alias'})}) {
  174. if ($alias eq 'linux64-node') {
  175. foreach my $fetch (@{$d->{$t}{fetches}{fetch}}) {
  176. if ($fetch =~ m/^nodejs-.*/) {
  177. $node_toolchain = $fetch;
  178. last T;
  179. }
  180. }
  181. }
  182. }
  183. }
  184. exit 1 unless $node_toolchain;
  185. my $fetch = YAML::XS::LoadFile('taskcluster/ci/fetch/toolchains.yml');
  186. my ($version) = $fetch->{$node_toolchain}{fetch}{url} =~ m|^https://nodejs.org/dist/v([^/]+)/|;
  187. print "$version\\n";
  188. EOF
  189. needed=$(perl -MYAML::XS -e "$p")
  190. current='[% pc("node", "version") %]'
  191. check_update_needed node "$needed" "$current"
  192. # python
  193. read -d '' p << 'EOF' || true
  194. if (m/find_python3_executable\\(min_version\\s*=\\s*"([^"]+)"/) {
  195. print $1;
  196. exit;
  197. }
  198. EOF
  199. needed=$(cat build/moz.configure/init.configure | perl -ne "$p")
  200. current=3.6.0
  201. check_update_needed python "$needed" "$current"