From patchwork Wed May 19 05:25:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 12314 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 29C52C31FF for ; Wed, 19 May 2021 05:25:35 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7619268918; Wed, 19 May 2021 07:25:34 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="HX1TiGBo"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id AE971602B0 for ; Wed, 19 May 2021 07:25:32 +0200 (CEST) Received: from pyrite.rasen.tech (unknown [IPv6:2400:4051:61:600:2c71:1b79:d06d:5032]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 1C9B645E; Wed, 19 May 2021 07:25:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1621401932; bh=U+ybMrsOeE/yIuENi86r1+GlyETFeL9vwa/7mElG8gs=; h=From:To:Cc:Subject:Date:From; b=HX1TiGBoVOaxmwumVBPuWL+E+/OpLbRcAy7APxLHKL/yxOq1q1ZKg1gJwv+f8xzzr rJY3BSWNyYWNOWzZD/2zg0uCzi3/Ab1f2dTX2oz9veLfR/dy/x3MXnlf1HIt9fj1Qh v6LiC0LR7HDaicGpabi2CFOJ7XSf8CXZJ18Mls28= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Wed, 19 May 2021 14:25:10 +0900 Message-Id: <20210519052510.899058-1-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] utils: update-mojo.sh: Add script for updating mojo X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add a script to ease updating mojo from a chromium source tree. Signed-off-by: Paul Elder Reviewed-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- Note that this script includes the little patch to template_expander.py to enable it to work with jinja2 3.0.0 (it still works with jinja2 2.10.x). --- utils/update-mojo.sh | 68 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 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..a57ea968 --- /dev/null +++ b/utils/update-mojo.sh @@ -0,0 +1,68 @@ +#!/bin/sh + +# SPDX-License-Identifier: GPL-2.0-or-later +# Update mojo copy from a chromium source tree + +if [ $# != 1 ] ; then + echo "Usage: $0 " + 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 ! test -z "$(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" + +last_dir="$(pwd)" +cd "${chromium_dir}" || exit +find "./mojo/public/tools" -type f \ + -not -path "*/generators/*" \ + -not -path "*/fuzzers/*" \ + -exec cp --parents "{}" "${ipc_dir}" ";" +cd "$last_dir" || exit + +# Update the README files +readme=$(cat < "${ipc_dir}/mojo/README" +echo "$readme" > "${ipc_dir}/tools/README" + +# Fix mojo support for jinja2 3.0.0 +template_expander="${ipc_dir}/mojo/public/tools/mojom/mojom/generate/template_expander.py" +sed -i "/py_compile=.*$/d" "${template_expander}" + +cat <