2021-09-27 19:11:09 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
HB_GIT_REPO=https://chromium.googlesource.com/external/github.com/harfbuzz/harfbuzz.git
|
|
|
|
HB_GIT_REF=origin/upstream/main
|
|
|
|
HB_GIT_DIR=third_party/externals/harfbuzz
|
|
|
|
HB_BUILD_DIR=$(dirname -- "$0")
|
|
|
|
|
|
|
|
previousrev() {
|
|
|
|
STEP="original revision" &&
|
|
|
|
HB_PREVIOUS_REV=$(git grep "${HB_GIT_REPO}" HEAD~1 -- DEPS | sed 's!.*'${HB_GIT_REPO}'@\([[:xdigit:]]\{40\}\).*!\1!')
|
|
|
|
}
|
|
|
|
|
|
|
|
nextrev() {
|
|
|
|
STEP="next revision" &&
|
|
|
|
git -C ${HB_GIT_DIR} fetch &&
|
|
|
|
HB_NEXT_REV=$(git -C ${HB_GIT_DIR} rev-parse ${HB_GIT_REF})
|
|
|
|
}
|
|
|
|
|
|
|
|
rolldeps() {
|
|
|
|
STEP="roll-deps" &&
|
|
|
|
sed -i'' -e "s!${HB_GIT_REPO}@${HB_PREVIOUS_REV}!${HB_GIT_REPO}@${HB_NEXT_REV}!" DEPS &&
|
|
|
|
tools/git-sync-deps &&
|
|
|
|
git add DEPS
|
|
|
|
}
|
|
|
|
|
|
|
|
check_all_files_are_categorized() {
|
|
|
|
#for each file name in ${HB_GIT_DIR}/src/hb-*.{cc,h,hh}
|
|
|
|
# if the file name is not present in BUILD.gn
|
|
|
|
# should be added to BUILD.gn (in 'unused_sources' if unwanted)
|
|
|
|
|
|
|
|
#for each file name \"src/.*\" in BUILD.gn
|
|
|
|
# if the file name does not exist
|
|
|
|
# should be removed from BUILD.gn
|
|
|
|
|
|
|
|
STEP="Updating BUILD.gn" &&
|
|
|
|
HB_BUILD_DIR_REL=$(realpath --relative-to=${HB_GIT_DIR} ${HB_BUILD_DIR})
|
|
|
|
( # Create subshell for IFS, CDPATH, and cd.
|
|
|
|
# This implementation doesn't handle '"' or '\n' in file names.
|
|
|
|
IFS=$'\n' &&
|
|
|
|
CDPATH= &&
|
|
|
|
cd -- "${HB_GIT_DIR}" &&
|
|
|
|
|
|
|
|
HB_SOURCE_MISSING=false &&
|
2022-01-12 22:04:19 +00:00
|
|
|
find src -type f \( -name "hb-*.cc" -o -name "hb-*.h" -o -name "hb-*.hh" \) | while read HB_SOURCE
|
2021-09-27 19:11:09 +00:00
|
|
|
do
|
|
|
|
if ! grep -qF "$HB_SOURCE" ${HB_BUILD_DIR_REL}/BUILD.gn; then
|
|
|
|
if ! ${HB_SOURCE_MISSING}; then
|
|
|
|
echo "Is in src/hb-*.{cc,h,hh} but not in BUILD.gn:"
|
|
|
|
HB_SOURCE_MISSING=true
|
|
|
|
fi
|
|
|
|
echo " \"\$_${HB_SOURCE}\","
|
|
|
|
fi
|
|
|
|
done &&
|
|
|
|
|
|
|
|
GN_SOURCE_MISSING=false &&
|
|
|
|
grep -oE "\"\\\$_src/[^\"]+\"" ${HB_BUILD_DIR_REL}/BUILD.gn | sed 's/^...\(.*\).$/\1/' | while read GN_SOURCE
|
|
|
|
do
|
|
|
|
if [ ! -f "${GN_SOURCE}" ]; then
|
|
|
|
if ! ${GN_SOURCE_MISSING}; then
|
|
|
|
echo "Is referenced in BUILD.gn but does not exist:" &&
|
|
|
|
GN_SOURCE_MISSING=true
|
|
|
|
fi
|
|
|
|
echo "\"${GN_SOURCE}\""
|
|
|
|
fi
|
2021-09-28 14:29:18 +00:00
|
|
|
done &&
|
|
|
|
|
|
|
|
GN_SOURCE_DUPLICATES=$(sort ${HB_BUILD_DIR_REL}/BUILD.gn | uniq -d | grep -oE "\"\\\$_src/[^\"]+\"")
|
|
|
|
if [ ! -z ${GN_SOURCE_DUPLICATES} ]; then
|
|
|
|
echo "Is listed more than once in BUILD.gn:" &&
|
|
|
|
echo ${GN_SOURCE_DUPLICATES}
|
|
|
|
fi
|
2021-09-27 19:11:09 +00:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
commit() {
|
|
|
|
STEP="commit" &&
|
|
|
|
HB_PREVIOUS_REV_SHORT=$(expr substr "${HB_PREVIOUS_REV}" 1 8) &&
|
|
|
|
HB_NEXT_REV_SHORT=$(expr substr "${HB_NEXT_REV}" 1 8) &&
|
|
|
|
HB_COMMIT_COUNT=$(git -C ${HB_GIT_DIR} rev-list --count ${HB_PREVIOUS_REV}..${HB_NEXT_REV}) &&
|
2021-11-24 21:41:15 +00:00
|
|
|
git commit -m"Roll HarfBuzz from ${HB_PREVIOUS_REV_SHORT} to ${HB_NEXT_REV_SHORT} (${HB_COMMIT_COUNT} commits)
|
2021-09-27 19:11:09 +00:00
|
|
|
|
2021-09-28 19:30:17 +00:00
|
|
|
${HB_GIT_REPO}/+log/${HB_PREVIOUS_REV}..${HB_NEXT_REV}
|
|
|
|
|
|
|
|
Disable: treat-URL-as-trailer"
|
2021-09-27 19:11:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
previousrev &&
|
|
|
|
nextrev &&
|
|
|
|
rolldeps "$@" &&
|
|
|
|
check_all_files_are_categorized &&
|
|
|
|
commit &&
|
|
|
|
true || { echo "Failed step ${STEP}"; exit 1; }
|