gecko-dev/modules/fdlibm/update.sh
André Bargull 1ce1fec25f Bug 1564117 - Part 2: Allow to reimport a specific fdlibm commit. r=arai
This makes it easier to test if modified patch files still apply.

Additionally "--no-backup-if-mismatch" was added to the `patch` command to
avoid generating ".orig" files.

Depends on D37256

Differential Revision: https://phabricator.services.mozilla.com/D37257

--HG--
extra : moz-landing-system : lando
2019-07-08 16:52:47 +00:00

41 lines
1.1 KiB
Bash
Executable File

#!/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
get_commit() {
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"])'
}
get_date() {
curl -s "${API_BASE_URL}/commits/${COMMIT}" \
| python -c 'import json, sys; print(json.loads(sys.stdin.read())["commit"]["committer"]["date"])'
}
mv ./src/moz.build ./src_moz.build
rm -rf src
if [ "$#" -eq 0 ]; then
COMMIT=$(get_commit)
else
COMMIT="$1"
fi
sh ./import.sh "${COMMIT}"
mv ./src_moz.build ./src/moz.build
COMMITDATE=$(get_date)
for FILE in $(ls patches/*.patch | sort); do
echo "Applying ${FILE} ..."
patch -p3 --no-backup-if-mismatch < ${FILE}
done
hg add src
perl -p -i -e "s/\[commit [0-9a-f]{40} \(.{1,100}\)\]/[commit ${COMMIT} (${COMMITDATE})]/" README.mozilla
echo "###"
echo "### Updated fdlibm/src to ${COMMIT}."
echo "### Remember to verify and commit the changes to source control!"
echo "###"