update.sh 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/bin/sh
  2. # Script to update the mozilla in-tree copy of the fdlibm library.
  3. # Run this within the /modules/fdlibm directory of the source tree.
  4. set -e
  5. API_BASE_URL=https://api.github.com/repos/freebsd/freebsd
  6. get_commit() {
  7. curl -s "${API_BASE_URL}/commits?path=lib/msun/src&per_page=1" \
  8. | python -c 'import json, sys; print(json.loads(sys.stdin.read())[0]["sha"])'
  9. }
  10. get_date() {
  11. curl -s "${API_BASE_URL}/commits/${COMMIT}" \
  12. | python -c 'import json, sys; print(json.loads(sys.stdin.read())["commit"]["committer"]["date"])'
  13. }
  14. mv ./src/moz.build ./src_moz.build
  15. rm -rf src
  16. if [ "$#" -eq 0 ]; then
  17. COMMIT=$(get_commit)
  18. else
  19. COMMIT="$1"
  20. fi
  21. sh ./import.sh "${COMMIT}"
  22. mv ./src_moz.build ./src/moz.build
  23. COMMITDATE=$(get_date)
  24. for FILE in $(ls patches/*.patch | sort); do
  25. echo "Applying ${FILE} ..."
  26. patch -p3 --no-backup-if-mismatch < ${FILE}
  27. done
  28. hg add src
  29. perl -p -i -e "s/\[commit [0-9a-f]{40} \(.{1,100}\)\]/[commit ${COMMIT} (${COMMITDATE})]/" README.mozilla
  30. echo "###"
  31. echo "### Updated fdlibm/src to ${COMMIT}."
  32. echo "### Remember to verify and commit the changes to source control!"
  33. echo "###"