From 23f9e1fb63426d86a9b664e7af7ef56c3679a7fa Mon Sep 17 00:00:00 2001 From: cherry530 Date: Fri, 10 Feb 2023 17:11:21 +0800 Subject: [PATCH] fix test error Signed-off-by: cherry530 --- fix-addon-test-for-Node.js-12-and-v8.patch | 35 ++++++++++++++++++++++ node-gyp.spec | 7 +++-- 2 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 fix-addon-test-for-Node.js-12-and-v8.patch diff --git a/fix-addon-test-for-Node.js-12-and-v8.patch b/fix-addon-test-for-Node.js-12-and-v8.patch new file mode 100644 index 0000000..f599ffa --- /dev/null +++ b/fix-addon-test-for-Node.js-12-and-v8.patch @@ -0,0 +1,35 @@ +From e6699d13cdcd6abe543b250f4297808912a4a188 Mon Sep 17 00:00:00 2001 +From: Richard Lau +Date: Tue, 2 Apr 2019 19:42:13 +0100 +Subject: [PATCH] test: fix addon test for Node.js 12 and V8 7.4 + +V8 7.4 removes some API functions. Replace those with their NAN +counterparts. + +PR-URL: https://github.com/nodejs/node-gyp/pull/1705 +Reviewed-By: Refael Ackermann +Reviewed-By: Ben Noordhuis +--- + test/node_modules/hello_world/hello.cc | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +diff --git a/test/node_modules/hello_world/hello.cc b/test/node_modules/hello_world/hello.cc +index 89bfd7ac04..ea724e896c 100644 +--- a/test/node_modules/hello_world/hello.cc ++++ b/test/node_modules/hello_world/hello.cc +@@ -1,12 +1,11 @@ + #include + +-void Method(const Nan::FunctionCallbackInfo& info) { ++NAN_METHOD(Method) { + info.GetReturnValue().Set(Nan::New("world").ToLocalChecked()); + } + +-void Init(v8::Local exports) { +- exports->Set(Nan::New("hello").ToLocalChecked(), +- Nan::New(Method)->GetFunction()); ++NAN_MODULE_INIT(Init) { ++ Nan::SetMethod(target, "hello", Method); + } + + NODE_MODULE(hello, Init) diff --git a/node-gyp.spec b/node-gyp.spec index 8c0c32f..812500a 100644 --- a/node-gyp.spec +++ b/node-gyp.spec @@ -1,7 +1,7 @@ %{?nodejs_find_provides_and_requires} Name: node-gyp Version: 3.6.0 -Release: 5 +Release: 6 Summary: Node.js native addon build tool License: MIT URL: https://github.com/nodejs/node-gyp @@ -11,7 +11,7 @@ Patch1: node-gyp-addon-gypi.patch Patch2: node-gyp-system-gyp.patch Patch3: node-gyp-python.patch Patch4: node-gyp-python3.patch -Patch5: node-gyp-node12.patch +Patch5: fix-addon-test-for-Node.js-12-and-v8.patch BuildArch: noarch ExclusiveArch: %{nodejs_arches} noarch Requires: gyp nodejs-devel libuv-devel http-parser-devel gcc-c++ @@ -53,6 +53,9 @@ rm -f test/test-download.js %{_bindir}/node-gyp %changelog +* Fri Feb 10 2023 xu_ping - 3.6.0-6 +- fix test error + * Tue Jul 05 2022 wangkai - 3.6.0-5 - Remove test-download -- Gitee