Message ID | 20210526033101.1251279-1-paul.elder@ideasonboard.com |
---|---|
State | Accepted |
Headers | show |
Series |
|
Related | show |
Hi Paul, Thanks for your work. On 2021-05-26 12:31:00 +0900, Paul Elder wrote: > Add a script to ease updating mojo from a chromium source tree. > > Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> This and 2/2 fix my jinja issues so for both 1/2 and 2/2: Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> > > --- > Changes in v3: > - remove the patch to template_expander.py > > Changes in v2: > - clean mojo/public/tools/* first > - use [ instead of test > - use scope instead of restoring cd > - add todo to remove the jinja2 3.0.0 patch > --- > utils/update-mojo.sh | 66 ++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 66 insertions(+) > create mode 100755 utils/update-mojo.sh > > diff --git a/utils/update-mojo.sh b/utils/update-mojo.sh > new file mode 100755 > index 00000000..fcbc81e7 > --- /dev/null > +++ b/utils/update-mojo.sh > @@ -0,0 +1,66 @@ > +#!/bin/sh > + > +# SPDX-License-Identifier: GPL-2.0-or-later > +# Update mojo copy from a chromium source tree > + > +if [ $# != 1 ] ; then > + echo "Usage: $0 <chromium dir>" > + exit 1 > +fi > + > +ipc_dir="$(dirname "$(realpath "$0")")/ipc" > +chromium_dir="$1" > + > +if [ ! -d "${chromium_dir}/mojo" ] ; then > + echo "Directory ${chromium_dir} doesn't contain mojo" > + exit 1 > +fi > + > +if [ ! -d "${chromium_dir}/.git" ] ; then > + echo "Directory ${chromium_dir} doesn't contain a git tree" > + exit 1 > +fi > + > +# Get the chromium commit id > +version=$(git -C "${chromium_dir}" rev-parse --short HEAD) > + > +# Reject dirty trees > +if [ -n "$(git -C "${chromium_dir}" status --porcelain)" ] ; then > + echo "Chromium tree in ${chromium_dir} is dirty" > + exit 1 > +fi > + > +# Copy the diagnosis file > +cp "${chromium_dir}/tools/diagnosis/crbug_1001171.py" "${ipc_dir}/tools/diagnosis" > + > +# Copy the rest of mojo > +cp "${chromium_dir}/mojo/public/LICENSE" "${ipc_dir}/mojo/public" > + > +rm -rf "${ipc_dir}/mojo/public/tools/*" > + > +( > + cd "${chromium_dir}" || exit > + find ./mojo/public/tools -type f \ > + -not -path "*/generators/*" \ > + -not -path "*/fuzzers/*" \ > + -exec cp --parents "{}" "${ipc_dir}" ";" > +) > + > +# Update the README files > +readme=$(cat <<EOF > +# SPDX-License-Identifier: CC0-1.0 > + > +Files in this directory are imported from ${version} of Chromium. Do not > +modify them manually. > +EOF > +) > + > +echo "$readme" > "${ipc_dir}/mojo/README" > +echo "$readme" > "${ipc_dir}/tools/README" > + > +cat <<EOF > +------------------------------------------------------------ > +mojo updated. Please review and up-port local changes before > +committing. > +------------------------------------------------------------ > +EOF > -- > 2.27.0 >
diff --git a/utils/update-mojo.sh b/utils/update-mojo.sh new file mode 100755 index 00000000..fcbc81e7 --- /dev/null +++ b/utils/update-mojo.sh @@ -0,0 +1,66 @@ +#!/bin/sh + +# SPDX-License-Identifier: GPL-2.0-or-later +# Update mojo copy from a chromium source tree + +if [ $# != 1 ] ; then + echo "Usage: $0 <chromium dir>" + exit 1 +fi + +ipc_dir="$(dirname "$(realpath "$0")")/ipc" +chromium_dir="$1" + +if [ ! -d "${chromium_dir}/mojo" ] ; then + echo "Directory ${chromium_dir} doesn't contain mojo" + exit 1 +fi + +if [ ! -d "${chromium_dir}/.git" ] ; then + echo "Directory ${chromium_dir} doesn't contain a git tree" + exit 1 +fi + +# Get the chromium commit id +version=$(git -C "${chromium_dir}" rev-parse --short HEAD) + +# Reject dirty trees +if [ -n "$(git -C "${chromium_dir}" status --porcelain)" ] ; then + echo "Chromium tree in ${chromium_dir} is dirty" + exit 1 +fi + +# Copy the diagnosis file +cp "${chromium_dir}/tools/diagnosis/crbug_1001171.py" "${ipc_dir}/tools/diagnosis" + +# Copy the rest of mojo +cp "${chromium_dir}/mojo/public/LICENSE" "${ipc_dir}/mojo/public" + +rm -rf "${ipc_dir}/mojo/public/tools/*" + +( + cd "${chromium_dir}" || exit + find ./mojo/public/tools -type f \ + -not -path "*/generators/*" \ + -not -path "*/fuzzers/*" \ + -exec cp --parents "{}" "${ipc_dir}" ";" +) + +# Update the README files +readme=$(cat <<EOF +# SPDX-License-Identifier: CC0-1.0 + +Files in this directory are imported from ${version} of Chromium. Do not +modify them manually. +EOF +) + +echo "$readme" > "${ipc_dir}/mojo/README" +echo "$readme" > "${ipc_dir}/tools/README" + +cat <<EOF +------------------------------------------------------------ +mojo updated. Please review and up-port local changes before +committing. +------------------------------------------------------------ +EOF