From patchwork Tue May 25 10:07:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 12407 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 45DA0C3200 for ; Tue, 25 May 2021 10:08:05 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 6C2A96891F; Tue, 25 May 2021 12:08:04 +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="rqJ1xeYR"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 427D06050E for ; Tue, 25 May 2021 12:08:03 +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 0F3BD344; Tue, 25 May 2021 12:07:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1621937281; bh=ry3WEenX65yWALv1EALH75uSdwEUCMdURYqg6dwYSpA=; h=From:To:Cc:Subject:Date:From; b=rqJ1xeYR4x/r//M9GkMkjYEBoPn5zKCc4kVtQs9wbtN1SIxl5W3/E3TPsS2AEUuqW 1QBa7X3yHHU0lKMGnOQqvbWjVj7Z0axT4j//Gum3jK44Imww8HrelGBsY2KVkmrHSy hqH3CAB8vn0YRE415qbpKXi35q/P2OWz0jl8Ibfo= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Tue, 25 May 2021 19:07:49 +0900 Message-Id: <20210525100750.1239934-1-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 1/2] 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 --- 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 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 | 72 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 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..ebcf7836 --- /dev/null +++ b/utils/update-mojo.sh @@ -0,0 +1,72 @@ +#!/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 [ -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 < "${ipc_dir}/mojo/README" +echo "$readme" > "${ipc_dir}/tools/README" + +# Fix mojo support for jinja2 3.0.0 +# TODO: remove this after this is merged: +# https://chromium-review.googlesource.com/c/chromium/src/+/2908396 +template_expander="${ipc_dir}/mojo/public/tools/mojom/mojom/generate/template_expander.py" +sed -i "/py_compile=.*$/d" "${template_expander}" + +cat <