From d87fe9f4cbb7657bc091e115bd168025d7a2f13c Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Dec 03 2015 00:19:32 +0000 Subject: Update to 0.2.1 upstream release and patch for nodejs 4.2 --- diff --git a/.gitignore b/.gitignore index 1dba45c..095a897 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /i2c-0.1.3.tgz /i2c-0.1.4.tgz +/i2c-0.2.1.tgz diff --git a/nodejs-i2c-node4.patch b/nodejs-i2c-node4.patch new file mode 100644 index 0000000..8f25957 --- /dev/null +++ b/nodejs-i2c-node4.patch @@ -0,0 +1,55 @@ +From b0c06bccb4254221053bd2ce8a3270ffcfb58100 Mon Sep 17 00:00:00 2001 +From: Jan Deinhard +Date: Fri, 23 Oct 2015 12:54:12 +0200 +Subject: [PATCH] Make node-i2c compile with Node 4. + +* v8::Buffer::New returns an instance of v8::MaybeLocal<> +* an instance of v8::MaybeLocal needs to be asked for the actual local + by calling v8::MaybeLocal::ToLocalChecked() +--- + src/i2c.cc | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/src/i2c.cc b/src/i2c.cc +index c0b00fb..4dbdcd9 100644 +--- a/src/i2c.cc ++++ b/src/i2c.cc +@@ -159,19 +159,19 @@ void ReadBlock(const FunctionCallbackInfo& args) { + int32_t len = args[1]->Int32Value(); + uint8_t data[len]; + Local err = Local::New(isolate, Null(isolate)); +- Local buffer = node::Buffer::New(len); ++ MaybeLocal buffer = node::Buffer::New(isolate, len); + + while (fd > 0) { + if (i2c_smbus_read_i2c_block_data(fd, cmd, len, data) != len) { + err = Exception::Error(String::NewFromUtf8(isolate, "Error reading length of bytes")); + } + +- memcpy(node::Buffer::Data(buffer), data, len); ++ memcpy(node::Buffer::Data(buffer.ToLocalChecked()), data, len); + + if (args[3]->IsFunction()) { + const unsigned argc = 2; + Local callback = Local::Cast(args[3]); +- Local argv[argc] = { err, buffer }; ++ Local argv[argc] = { err, buffer.ToLocalChecked() }; + callback->Call(isolate->GetCurrentContext()->Global(), argc, argv); + } + +@@ -183,7 +183,7 @@ void ReadBlock(const FunctionCallbackInfo& args) { + } + } + +- args.GetReturnValue().Set(buffer); ++ args.GetReturnValue().Set(buffer.ToLocalChecked()); + } + + void Write(const FunctionCallbackInfo& args) { +@@ -290,4 +290,4 @@ void Init(Handle exports) { + NODE_SET_METHOD(exports, "readBlock", ReadBlock); + } + +-NODE_MODULE(i2c, Init) +\ No newline at end of file ++NODE_MODULE(i2c, Init) diff --git a/nodejs-i2c.spec b/nodejs-i2c.spec index ae33a48..e143b3a 100644 --- a/nodejs-i2c.spec +++ b/nodejs-i2c.spec @@ -2,8 +2,8 @@ %{?nodejs_find_provides_and_requires} Name: nodejs-i2c -Version: 0.1.4 -Release: 13%{?dist} +Version: 0.2.1 +Release: 1%{?dist} Summary: Node.js native bindings for i2c-dev %if 0%{?fedora} >= 19 @@ -21,8 +21,9 @@ ExclusiveArch: %{ix86} x86_64 %{arm} # src/i2c-dev.(cc|h) are GPLv2+, everything else is BSD License: BSD and GPLv2+ URL: https://github.com/korevec/node-i2c -Source0: http://registry.npmjs.org/i2c/-/i2c-%{version}.tgz -Source1: https://raw.github.com/tchollingsworth/node-i2c/0985179d03823cab1bf3c5072bf315b22a7171c8/LICENSE +Source0: https://registry.npmjs.org/i2c/-/i2c-%{version}.tgz +# https://github.com/kelly/node-i2c/pull/70 +Patch0: nodejs-i2c-node4.patch BuildRequires: nodejs-devel node-gyp @@ -33,14 +34,12 @@ Plays well with Raspberry Pi and Beaglebone. %prep %setup -q -n package +%patch0 -p1 %nodejs_fixdep coffee-script '~1.4' %nodejs_fixdep underscore "~1.4" %nodejs_fixdep bindings '~1.1' -#copy LICENSE file to %%{_builddir} so it works with %%doc -cp %{SOURCE1} . - %build node-gyp rebuild @@ -57,9 +56,14 @@ chmod 0755 %{buildroot}%{nodejs_sitelib}/i2c/build/Release/i2c.node %files %{nodejs_sitelib}/i2c -%doc README.md LICENSE examples +%doc README.md examples +%license LICENSE %changelog +* Wed Dec 2 2015 Tom Hughes - 0.2.1-1 +- Update to 0.2.1 upstream release +- Patch for nodejs 4.2 support + * Wed Jun 17 2015 Fedora Release Engineering - 0.1.4-13 - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild diff --git a/sources b/sources index c423e9a..e595464 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -d8533976c58e06da6842e49d283feb56 i2c-0.1.4.tgz +ce80e05074149dbb47f1e393b66be776 i2c-0.2.1.tgz