Commit e05aca13 authored by Ben Wagner's avatar Ben Wagner Committed by Commit Bot

Create roll script for third_party/expat.

This makes it much easier to roll expat. It automates calling rolldep,
updating the README.chromium, updating the expat_config.h
configuration header, and adds the OWNERS to the review.

Bug: chromium:1004341
Change-Id: I9e19e0016cedc12b1f2079cd54b95bd7e3d3f25a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1829677Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Commit-Queue: Ben Wagner <bungeman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#702869}
parent 8f0dc968
......@@ -2,9 +2,11 @@ Name: Expat XML Parser
Short Name: expat
URL: https://github.com/libexpat/libexpat
Version: R_2_2_8-5-g4f23e05
Date: 20190925
Revision: 4f23e05a33a66c5962589a32c87df4fe68144fce
Security Critical: yes
License: MIT
License File: src/expat/COPYING
Security Critical: yes
Description:
This is Expat XML parser - very lightweight C library for parsing XML.
......@@ -22,6 +24,9 @@ Roll process:
cd $CHROMIUM_SRC/third_party/expat
patch -p3 < 0001-Do-not-claim-getrandom.patch
Then update the README.chromium and BUILD.gn as needed.
This can usually by handled by running roll-expat.sh from $CHROMIUM_SRC.
Patches:
0001-Do-not-claim-getrandom.patch:
* Not all platforms have getrandom.
......
#!/bin/bash
roll_deps() {
STEP="roll-deps" &&
REVIEWERS=$(grep -E -v "^$|#" third_party/expat/OWNERS | paste -s -d, -)
roll-dep -r "${REVIEWERS}" --roll-to origin/upstream/master "$@" src/third_party/expat/src/
}
update_readme() {
STEP="update README.chromium" &&
EXPAT_VERSION=$(git -C third_party/expat/src/ describe --long) &&
EXPAT_COMMIT=$(git -C third_party/expat/src/ rev-parse HEAD) &&
EXPAT_DATE=$(date "+%Y%m%d")
sed -i'' -e "s/^Version: .*\$/Version: ${EXPAT_VERSION}/" third_party/expat/README.chromium &&
sed -i'' -e "s/^Revision: .*\$/Revision: ${EXPAT_COMMIT}/" third_party/expat/README.chromium &&
sed -i'' -e "s/^Date: .*\$/Date: ${EXPAT_DATE}/" third_party/expat/README.chromium &&
git add third_party/expat/README.chromium
}
previous_rev() {
STEP="previous revision" &&
PREVIOUS_EXPAT_REV=$(git grep "'libexpat_revision':" HEAD~1 -- DEPS | grep -Eho "[0-9a-fA-F]{32}")
}
check_added_deleted_files() {
previous_rev &&
STEP="check for added or deleted files since last libexpat revision" &&
ADDED_FILES=$(git -C third_party/expat/src/ diff --diff-filter=A --name-only ${PREVIOUS_EXPAT_REV} -- src/ | paste -s -d, -) &&
DELETED_FILES=$(git -C third_party/expat/src/ diff --diff-filter=D --name-only ${PREVIOUS_EXPAT_REV} -- src/ | paste -s -d, -) &&
RENAMED_FILES=$(git -C third_party/expat/src/ diff --diff-filter=R --name-only ${PREVIOUS_EXPAT_REV} -- src/ | paste -s -d, -) &&
if [ -n "$ADDED_FILES" ]; then echo "Added files detected: " $ADDED_FILES; fi &&
if [ -n "$DELETED_FILES" ]; then echo "Deleted files detected" $DELETED_FILES; fi &&
if [ -n "$RENAMED_FILES" ]; then echo "Renamed files detected" $RENAMED_FILES; fi &&
if [ -n "$ADDED_FILES" ] || [ -n "$DELETED_FILES" ] || [ -n "$RENAMED_FILES" ]; then echo -e "\nPlease update src/third_party/expat/BUILD.gn before continuing."; fi
}
commit() {
STEP="commit" &&
git commit --quiet --amend --no-edit
}
update_expat_config_h() {
STEP="update expat config.h" &&
( cd third_party/expat/src/expat &&
./buildconf.sh &&
./configure) &&
cp third_party/expat/src/expat/expat_config.h third_party/expat/include/expat_config/ &&
patch -d third_party/expat -p3 < third_party/expat/0001-Do-not-claim-getrandom.patch &&
git add third_party/expat/include/expat_config/expat_config.h
}
roll_deps "$@" &&
update_readme &&
update_expat_config_h &&
check_added_deleted_files &&
commit ||
{ echo "Failed step ${STEP}"; exit 1; }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment