2016-01-07 06:30:26 +03:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Script to update the mozilla in-tree copy of the fdlibm library.
|
|
|
|
# Run this within the /modules/fdlibm directory of the source tree.
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
API_BASE_URL=https://api.github.com/repos/freebsd/freebsd
|
|
|
|
|
2016-05-19 17:20:19 +03:00
|
|
|
get_commit() {
|
2016-01-07 06:30:26 +03:00
|
|
|
curl -s "${API_BASE_URL}/commits?path=lib/msun/src&per_page=1" \
|
|
|
|
| python -c 'import json, sys; print(json.loads(sys.stdin.read())[0]["sha"])'
|
|
|
|
}
|
2017-02-28 23:33:18 +03:00
|
|
|
get_date() {
|
2019-07-08 19:52:47 +03:00
|
|
|
curl -s "${API_BASE_URL}/commits/${COMMIT}" \
|
|
|
|
| python -c 'import json, sys; print(json.loads(sys.stdin.read())["commit"]["committer"]["date"])'
|
2017-02-28 23:33:18 +03:00
|
|
|
}
|
2016-01-07 06:30:26 +03:00
|
|
|
|
2016-05-19 17:20:19 +03:00
|
|
|
mv ./src/moz.build ./src_moz.build
|
2016-01-07 06:30:26 +03:00
|
|
|
rm -rf src
|
2019-07-08 19:52:47 +03:00
|
|
|
if [ "$#" -eq 0 ]; then
|
|
|
|
COMMIT=$(get_commit)
|
|
|
|
else
|
|
|
|
COMMIT="$1"
|
|
|
|
fi
|
|
|
|
sh ./import.sh "${COMMIT}"
|
2016-05-19 17:20:19 +03:00
|
|
|
mv ./src_moz.build ./src/moz.build
|
2017-02-28 23:33:18 +03:00
|
|
|
COMMITDATE=$(get_date)
|
2016-01-07 06:30:26 +03:00
|
|
|
for FILE in $(ls patches/*.patch | sort); do
|
2018-02-18 16:56:29 +03:00
|
|
|
echo "Applying ${FILE} ..."
|
2019-07-08 19:52:47 +03:00
|
|
|
patch -p3 --no-backup-if-mismatch < ${FILE}
|
2016-01-07 06:30:26 +03:00
|
|
|
done
|
|
|
|
hg add src
|
|
|
|
|
2017-02-28 23:33:18 +03:00
|
|
|
perl -p -i -e "s/\[commit [0-9a-f]{40} \(.{1,100}\)\]/[commit ${COMMIT} (${COMMITDATE})]/" README.mozilla
|
2016-01-07 06:30:26 +03:00
|
|
|
|
|
|
|
echo "###"
|
|
|
|
echo "### Updated fdlibm/src to ${COMMIT}."
|
|
|
|
echo "### Remember to verify and commit the changes to source control!"
|
|
|
|
echo "###"
|