check_version.sh 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/sh
  2. # Copyright 2020 gRPC authors.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. set -e
  16. buildfile=BUILD
  17. yamlfile=build_handwritten.yaml
  18. status=0
  19. check_key () {
  20. key=$1
  21. build=$(grep "^$key =" < $buildfile | awk -F\" '{print $2}')
  22. yaml=$(grep "^ *${key}:" < $yamlfile | head -1 | awk '{print $2}')
  23. if [ x"$build" = x ] ; then
  24. echo "$key not defined in $buildfile"
  25. status=1
  26. fi
  27. if [ x"$yaml" = x ] ; then
  28. echo "$key not defined in $yamlfile"
  29. status=1
  30. fi
  31. if [ x"$build" != x"$yaml" ] ; then
  32. echo "$key mismatch between $buildfile ($build) and $yamlfile ($yaml)"
  33. status=1
  34. fi
  35. }
  36. check_key core_version
  37. check_key version
  38. exit $status