diff options
author | Khem Raj <raj.khem@gmail.com> | 2020-05-06 22:28:08 -0700 |
---|---|---|
committer | Armin Kuster <akuster808@gmail.com> | 2021-01-13 08:10:09 -0800 |
commit | 85f254c7444a3fa51556502b1c3f6efe1ad5e8a0 (patch) | |
tree | 0da494e078fd3a02171b33e3133a8fbce63b9bd3 | |
parent | 8f632dfbf9b8e6f51a4e83f84669003deb453cea (diff) | |
download | meta-openembedded-85f254c7444a3fa51556502b1c3f6efe1ad5e8a0.tar.gz |
nodejs: Fix build with icu 67.1
Remove soon-to-be removed getAllFieldPositions
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Cc: Andrej Valek <andrej.valek@siemens.com>
(cherry picked from commit 7910f2b64575dcd3352effd441accb3b56e3554d)
Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rw-r--r-- | meta-oe/recipes-devtools/nodejs/nodejs/0001-deps-V8-backport-3f8dc4b2e5ba.patch | 194 | ||||
-rw-r--r-- | meta-oe/recipes-devtools/nodejs/nodejs_12.14.1.bb | 1 |
2 files changed, 195 insertions, 0 deletions
diff --git a/meta-oe/recipes-devtools/nodejs/nodejs/0001-deps-V8-backport-3f8dc4b2e5ba.patch b/meta-oe/recipes-devtools/nodejs/nodejs/0001-deps-V8-backport-3f8dc4b2e5ba.patch new file mode 100644 index 0000000000..07dbdfe564 --- /dev/null +++ b/meta-oe/recipes-devtools/nodejs/nodejs/0001-deps-V8-backport-3f8dc4b2e5ba.patch | |||
@@ -0,0 +1,194 @@ | |||
1 | From 836311710ca8d49fdf4d619e3a738a445c413605 Mon Sep 17 00:00:00 2001 | ||
2 | From: Ujjwal Sharma <ryzokuken@disroot.org> | ||
3 | Date: Wed, 22 Apr 2020 12:20:17 +0530 | ||
4 | Subject: [PATCH] deps: V8: backport 3f8dc4b2e5ba | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=UTF-8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | Original commit message: | ||
10 | |||
11 | [intl] Remove soon-to-be removed getAllFieldPositions | ||
12 | |||
13 | Needed to land ICU67.1 soon. | ||
14 | |||
15 | Bug: v8:10393 | ||
16 | Change-Id: I3c7737ca600d6ccfdc46ffaddfb318ce60bc7618 | ||
17 | Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2136489 | ||
18 | Reviewed-by: Jakob Kummerow <jkummerow@chromium.org> | ||
19 | Commit-Queue: Frank Tang <ftang@chromium.org> | ||
20 | Cr-Commit-Position: refs/heads/master@{#67027} | ||
21 | |||
22 | Refs: https://github.com/v8/v8/commit/3f8dc4b2e5baf77b463334c769af85b79d8c1463 | ||
23 | |||
24 | PR-URL: https://github.com/nodejs/node/pull/32993 | ||
25 | Reviewed-By: Michaƫl Zasso <targos@protonmail.com> | ||
26 | Reviewed-By: Matheus Marchini <mat@mmarchini.me> | ||
27 | Reviewed-By: Steven R Loomis <srloomis@us.ibm.com> | ||
28 | Reviewed-By: Richard Lau <riclau@uk.ibm.com> | ||
29 | --- | ||
30 | common.gypi | 2 +- | ||
31 | deps/v8/src/objects/js-number-format.cc | 72 +++++++++++++------------ | ||
32 | 2 files changed, 38 insertions(+), 36 deletions(-) | ||
33 | |||
34 | diff --git a/common.gypi b/common.gypi | ||
35 | index b86e5e0..a7b37e6 100644 | ||
36 | --- a/common.gypi | ||
37 | +++ b/common.gypi | ||
38 | @@ -38,7 +38,7 @@ | ||
39 | |||
40 | # Reset this number to 0 on major V8 upgrades. | ||
41 | # Increment by one for each non-official patch applied to deps/v8. | ||
42 | - 'v8_embedder_string': '-node.16', | ||
43 | + 'v8_embedder_string': '-node.17', | ||
44 | |||
45 | ##### V8 defaults for Node.js ##### | ||
46 | |||
47 | diff --git a/deps/v8/src/objects/js-number-format.cc b/deps/v8/src/objects/js-number-format.cc | ||
48 | index d1e3ef4..757c665 100644 | ||
49 | --- a/deps/v8/src/objects/js-number-format.cc | ||
50 | +++ b/deps/v8/src/objects/js-number-format.cc | ||
51 | @@ -1252,42 +1252,31 @@ MaybeHandle<JSNumberFormat> JSNumberFormat::New(Isolate* isolate, | ||
52 | } | ||
53 | |||
54 | namespace { | ||
55 | -Maybe<icu::UnicodeString> IcuFormatNumber( | ||
56 | +Maybe<bool> IcuFormatNumber( | ||
57 | Isolate* isolate, | ||
58 | const icu::number::LocalizedNumberFormatter& number_format, | ||
59 | - Handle<Object> numeric_obj, icu::FieldPositionIterator* fp_iter) { | ||
60 | + Handle<Object> numeric_obj, icu::number::FormattedNumber* formatted) { | ||
61 | // If it is BigInt, handle it differently. | ||
62 | UErrorCode status = U_ZERO_ERROR; | ||
63 | - icu::number::FormattedNumber formatted; | ||
64 | if (numeric_obj->IsBigInt()) { | ||
65 | Handle<BigInt> big_int = Handle<BigInt>::cast(numeric_obj); | ||
66 | Handle<String> big_int_string; | ||
67 | ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, big_int_string, | ||
68 | BigInt::ToString(isolate, big_int), | ||
69 | - Nothing<icu::UnicodeString>()); | ||
70 | - formatted = number_format.formatDecimal( | ||
71 | + Nothing<bool>()); | ||
72 | + *formatted = number_format.formatDecimal( | ||
73 | {big_int_string->ToCString().get(), big_int_string->length()}, status); | ||
74 | } else { | ||
75 | double number = numeric_obj->Number(); | ||
76 | - formatted = number_format.formatDouble(number, status); | ||
77 | + *formatted = number_format.formatDouble(number, status); | ||
78 | } | ||
79 | if (U_FAILURE(status)) { | ||
80 | // This happen because of icu data trimming trim out "unit". | ||
81 | // See https://bugs.chromium.org/p/v8/issues/detail?id=8641 | ||
82 | - THROW_NEW_ERROR_RETURN_VALUE(isolate, | ||
83 | - NewTypeError(MessageTemplate::kIcuError), | ||
84 | - Nothing<icu::UnicodeString>()); | ||
85 | - } | ||
86 | - if (fp_iter) { | ||
87 | - formatted.getAllFieldPositions(*fp_iter, status); | ||
88 | + THROW_NEW_ERROR_RETURN_VALUE( | ||
89 | + isolate, NewTypeError(MessageTemplate::kIcuError), Nothing<bool>()); | ||
90 | } | ||
91 | - icu::UnicodeString result = formatted.toString(status); | ||
92 | - if (U_FAILURE(status)) { | ||
93 | - THROW_NEW_ERROR_RETURN_VALUE(isolate, | ||
94 | - NewTypeError(MessageTemplate::kIcuError), | ||
95 | - Nothing<icu::UnicodeString>()); | ||
96 | - } | ||
97 | - return Just(result); | ||
98 | + return Just(true); | ||
99 | } | ||
100 | |||
101 | } // namespace | ||
102 | @@ -1298,10 +1287,16 @@ MaybeHandle<String> JSNumberFormat::FormatNumeric( | ||
103 | Handle<Object> numeric_obj) { | ||
104 | DCHECK(numeric_obj->IsNumeric()); | ||
105 | |||
106 | - Maybe<icu::UnicodeString> maybe_format = | ||
107 | - IcuFormatNumber(isolate, number_format, numeric_obj, nullptr); | ||
108 | + icu::number::FormattedNumber formatted; | ||
109 | + Maybe<bool> maybe_format = | ||
110 | + IcuFormatNumber(isolate, number_format, numeric_obj, &formatted); | ||
111 | MAYBE_RETURN(maybe_format, Handle<String>()); | ||
112 | - return Intl::ToString(isolate, maybe_format.FromJust()); | ||
113 | + UErrorCode status = U_ZERO_ERROR; | ||
114 | + icu::UnicodeString result = formatted.toString(status); | ||
115 | + if (U_FAILURE(status)) { | ||
116 | + THROW_NEW_ERROR(isolate, NewTypeError(MessageTemplate::kIcuError), String); | ||
117 | + } | ||
118 | + return Intl::ToString(isolate, result); | ||
119 | } | ||
120 | |||
121 | namespace { | ||
122 | @@ -1414,12 +1409,18 @@ std::vector<NumberFormatSpan> FlattenRegionsToParts( | ||
123 | } | ||
124 | |||
125 | namespace { | ||
126 | -Maybe<int> ConstructParts(Isolate* isolate, const icu::UnicodeString& formatted, | ||
127 | - icu::FieldPositionIterator* fp_iter, | ||
128 | +Maybe<int> ConstructParts(Isolate* isolate, | ||
129 | + icu::number::FormattedNumber* formatted, | ||
130 | Handle<JSArray> result, int start_index, | ||
131 | Handle<Object> numeric_obj, bool style_is_unit) { | ||
132 | + UErrorCode status = U_ZERO_ERROR; | ||
133 | + icu::UnicodeString formatted_text = formatted->toString(status); | ||
134 | + if (U_FAILURE(status)) { | ||
135 | + THROW_NEW_ERROR_RETURN_VALUE( | ||
136 | + isolate, NewTypeError(MessageTemplate::kIcuError), Nothing<int>()); | ||
137 | + } | ||
138 | DCHECK(numeric_obj->IsNumeric()); | ||
139 | - int32_t length = formatted.length(); | ||
140 | + int32_t length = formatted_text.length(); | ||
141 | int index = start_index; | ||
142 | if (length == 0) return Just(index); | ||
143 | |||
144 | @@ -1428,13 +1429,14 @@ Maybe<int> ConstructParts(Isolate* isolate, const icu::UnicodeString& formatted, | ||
145 | // other region covers some part of the formatted string. It's possible | ||
146 | // there's another field with exactly the same begin and end as this backdrop, | ||
147 | // in which case the backdrop's field_id of -1 will give it lower priority. | ||
148 | - regions.push_back(NumberFormatSpan(-1, 0, formatted.length())); | ||
149 | + regions.push_back(NumberFormatSpan(-1, 0, formatted_text.length())); | ||
150 | |||
151 | { | ||
152 | - icu::FieldPosition fp; | ||
153 | - while (fp_iter->next(fp)) { | ||
154 | - regions.push_back(NumberFormatSpan(fp.getField(), fp.getBeginIndex(), | ||
155 | - fp.getEndIndex())); | ||
156 | + icu::ConstrainedFieldPosition cfp; | ||
157 | + cfp.constrainCategory(UFIELD_CATEGORY_NUMBER); | ||
158 | + while (formatted->nextPosition(cfp, status)) { | ||
159 | + regions.push_back( | ||
160 | + NumberFormatSpan(cfp.getField(), cfp.getStart(), cfp.getLimit())); | ||
161 | } | ||
162 | } | ||
163 | |||
164 | @@ -1456,7 +1458,7 @@ Maybe<int> ConstructParts(Isolate* isolate, const icu::UnicodeString& formatted, | ||
165 | Handle<String> substring; | ||
166 | ASSIGN_RETURN_ON_EXCEPTION_VALUE( | ||
167 | isolate, substring, | ||
168 | - Intl::ToString(isolate, formatted, part.begin_pos, part.end_pos), | ||
169 | + Intl::ToString(isolate, formatted_text, part.begin_pos, part.end_pos), | ||
170 | Nothing<int>()); | ||
171 | Intl::AddElement(isolate, result, index, field_type_string, substring); | ||
172 | ++index; | ||
173 | @@ -1476,14 +1478,14 @@ MaybeHandle<JSArray> JSNumberFormat::FormatToParts( | ||
174 | number_format->icu_number_formatter().raw(); | ||
175 | CHECK_NOT_NULL(fmt); | ||
176 | |||
177 | - icu::FieldPositionIterator fp_iter; | ||
178 | - Maybe<icu::UnicodeString> maybe_format = | ||
179 | - IcuFormatNumber(isolate, *fmt, numeric_obj, &fp_iter); | ||
180 | + icu::number::FormattedNumber formatted; | ||
181 | + Maybe<bool> maybe_format = | ||
182 | + IcuFormatNumber(isolate, *fmt, numeric_obj, &formatted); | ||
183 | MAYBE_RETURN(maybe_format, Handle<JSArray>()); | ||
184 | |||
185 | Handle<JSArray> result = factory->NewJSArray(0); | ||
186 | Maybe<int> maybe_format_to_parts = ConstructParts( | ||
187 | - isolate, maybe_format.FromJust(), &fp_iter, result, 0, numeric_obj, | ||
188 | + isolate, &formatted, result, 0, numeric_obj, | ||
189 | number_format->style() == JSNumberFormat::Style::UNIT); | ||
190 | MAYBE_RETURN(maybe_format_to_parts, Handle<JSArray>()); | ||
191 | |||
192 | -- | ||
193 | 2.26.2 | ||
194 | |||
diff --git a/meta-oe/recipes-devtools/nodejs/nodejs_12.14.1.bb b/meta-oe/recipes-devtools/nodejs/nodejs_12.14.1.bb index d468fb3ffa..9f9f320aa7 100644 --- a/meta-oe/recipes-devtools/nodejs/nodejs_12.14.1.bb +++ b/meta-oe/recipes-devtools/nodejs/nodejs_12.14.1.bb | |||
@@ -23,6 +23,7 @@ SRC_URI = "http://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz \ | |||
23 | file://0001-build-allow-passing-multiple-libs-to-pkg_config.patch \ | 23 | file://0001-build-allow-passing-multiple-libs-to-pkg_config.patch \ |
24 | file://0002-build-allow-use-of-system-installed-brotli.patch \ | 24 | file://0002-build-allow-use-of-system-installed-brotli.patch \ |
25 | file://mips-warnings.patch \ | 25 | file://mips-warnings.patch \ |
26 | file://0001-deps-V8-backport-3f8dc4b2e5ba.patch \ | ||
26 | " | 27 | " |
27 | SRC_URI_append_class-target = " \ | 28 | SRC_URI_append_class-target = " \ |
28 | file://0002-Using-native-binaries.patch \ | 29 | file://0002-Using-native-binaries.patch \ |