aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-qt/qt5/qtwebengine/chromium/0013-chromium-Fix-bison-3.7.patch
blob: 3272b727fbc6ba0370e157b98c96532dd1cbe6d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
From 3ccc10f378ca26c35104e39e08771c053ae5b19e Mon Sep 17 00:00:00 2001
From: Allan Sandfeld Jensen <allan.jensen@qt.io>
Date: Fri, 14 Aug 2020 16:38:48 +0200
Subject: [PATCH] chromium: Fix bison 3.7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Do a replace run inspired by newer versions of the script.

Fixes: QTBUG-86018
Change-Id: Ib1dc771e22a662aff0fae842d135ad58fad08bc1
Reviewed-by: Michael Brüning <michael.bruning@qt.io>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
---
 .../renderer/build/scripts/rule_bison.py      | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/chromium/third_party/blink/renderer/build/scripts/rule_bison.py b/chromium/third_party/blink/renderer/build/scripts/rule_bison.py
index f75e25fd23f..7e0767e951a 100755
--- a/chromium/third_party/blink/renderer/build/scripts/rule_bison.py
+++ b/chromium/third_party/blink/renderer/build/scripts/rule_bison.py
@@ -45,6 +45,19 @@ from utilities import abs
 
 from blinkbuild.name_style_converter import NameStyleConverter
 
+def modify_file(path, prefix_lines, suffix_lines, replace_list=[]):
+    prefix_lines = map(lambda s: s + '\n', prefix_lines)
+    suffix_lines = map(lambda s: s + '\n', suffix_lines)
+    with open(path, 'r') as f:
+        old_lines = f.readlines()
+    for i in range(len(old_lines)):
+        for src, dest in replace_list:
+            old_lines[i] = old_lines[i].replace(src, dest)
+    new_lines = prefix_lines + old_lines + suffix_lines
+    with open(path, 'w') as f:
+        f.writelines(new_lines)
+
+
 assert len(sys.argv) == 4 or len(sys.argv) == 5
 
 inputFile = abs(sys.argv[1])
@@ -115,3 +128,9 @@ print >>outputHFile, '#define %s' % headerGuard
 print >>outputHFile, outputHContents
 print >>outputHFile, '#endif  // %s' % headerGuard
 outputHFile.close()
+
+common_replace_list = [(inputRoot + '.hh',
+                        inputRoot + '.h')]
+modify_file(
+    outputCpp, [], [],
+    replace_list=common_replace_list)