From 4cab815bc52b02b75390c84cb5a2ade37df1d543 Mon Sep 17 00:00:00 2001 From: zmf <279822581@qq.com> Date: Thu, 23 Nov 2023 12:13:33 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=8C=E6=AC=A1gclinet?= =?UTF-8?q?=20sync=E6=97=B6=EF=BC=8C=E5=BA=94=E7=94=A8patch=E6=8A=A5?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zmf <279822581@qq.com> --- DEPS | 9 +++++ attachment/scripts/ohos_reverse_patch.py | 46 ++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 attachment/scripts/ohos_reverse_patch.py diff --git a/DEPS b/DEPS index b98a7a467b..afa9c770f3 100644 --- a/DEPS +++ b/DEPS @@ -838,6 +838,15 @@ recursedeps = [ 'src/third_party/vulkan-deps', ] +pre_deps_hooks = [ + { + # Generate the ohos compile environment + 'name': 'ohos_reverse', + 'pattern': 'src/flutter/attachment/scripts/.*\\.py', + 'action': ['python3', 'src/flutter/attachment/scripts/ohos_reverse_patch.py'], + }, +] + hooks = [ { # Generate the Dart SDK's .dart_tool/package_confg.json file. diff --git a/attachment/scripts/ohos_reverse_patch.py b/attachment/scripts/ohos_reverse_patch.py new file mode 100644 index 0000000000..f9a147c7a9 --- /dev/null +++ b/attachment/scripts/ohos_reverse_patch.py @@ -0,0 +1,46 @@ +# Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#!/usr/bin/python +import json +import excute_util +from operator import itemgetter + +""" +在gclient中pre_deps_hooks中配置执行,用于在sync前回滚patch +职责如下: +1.解析config.json,并按顺序倒序排序 +2.回滚路径的patch +""" +ROOT = './src/flutter/attachment' + +def apply_reverse_patch(task): + file_path = task['file_path'] + target_path = task['target'] + excute_util.excuteArr(['git', 'apply', '-R', file_path], target_path) + pass + +def doTask(task): + if (task['type'] == 'patch'): + apply_reverse_patch(task) + +def parse_config(config_file="{}/scripts/config.json".format(ROOT)): + with open(config_file) as json_file: + data = json.load(json_file) + data = sorted(data, key=itemgetter('name'), reverse=True) + for task in data: + doTask(task) + +if __name__ == "__main__": + parse_config() + \ No newline at end of file -- Gitee From 54590b5fb548282eab1e1f1bee4238c20bcd8616 Mon Sep 17 00:00:00 2001 From: zmf <279822581@qq.com> Date: Thu, 23 Nov 2023 12:17:51 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zmf <279822581@qq.com> --- attachment/scripts/ohos_reverse_patch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/attachment/scripts/ohos_reverse_patch.py b/attachment/scripts/ohos_reverse_patch.py index f9a147c7a9..2930711e75 100644 --- a/attachment/scripts/ohos_reverse_patch.py +++ b/attachment/scripts/ohos_reverse_patch.py @@ -20,7 +20,7 @@ from operator import itemgetter 在gclient中pre_deps_hooks中配置执行,用于在sync前回滚patch 职责如下: 1.解析config.json,并按顺序倒序排序 -2.回滚路径的patch +2.回滚目录下的patch """ ROOT = './src/flutter/attachment' -- Gitee From 399e517ce9ea390a7895af3f7cf5ace9ca425636 Mon Sep 17 00:00:00 2001 From: zmf <279822581@qq.com> Date: Thu, 23 Nov 2023 12:20:12 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zmf <279822581@qq.com> --- DEPS | 1 - 1 file changed, 1 deletion(-) diff --git a/DEPS b/DEPS index afa9c770f3..454b4c3052 100644 --- a/DEPS +++ b/DEPS @@ -840,7 +840,6 @@ recursedeps = [ pre_deps_hooks = [ { - # Generate the ohos compile environment 'name': 'ohos_reverse', 'pattern': 'src/flutter/attachment/scripts/.*\\.py', 'action': ['python3', 'src/flutter/attachment/scripts/ohos_reverse_patch.py'], -- Gitee