[nodejs-sqlite3] Initial import of nodejs-sqlite3
Tom Hughes
tomh at fedoraproject.org
Mon Mar 4 13:55:13 UTC 2013
commit c08109687e5bb8f5f52d1b0023394147da416730
Author: Tom Hughes <tom at compton.nu>
Date: Mon Mar 4 13:54:33 2013 +0000
Initial import of nodejs-sqlite3
.gitignore | 1 +
nodejs-sqlite3-async.patch | 34 ++++++++++++++++
nodejs-sqlite3-libraries.patch | 13 ++++++
nodejs-sqlite3-paths.patch | 8 ++++
nodejs-sqlite3-uv.patch | 85 ++++++++++++++++++++++++++++++++++++++++
nodejs-sqlite3.spec | 75 +++++++++++++++++++++++++++++++++++
sources | 1 +
7 files changed, 217 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..34283d8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/sqlite3-2.1.5.tgz
diff --git a/nodejs-sqlite3-async.patch b/nodejs-sqlite3-async.patch
new file mode 100644
index 0000000..5bc8c83
--- /dev/null
+++ b/nodejs-sqlite3-async.patch
@@ -0,0 +1,34 @@
+commit 34d93863ba21d81a14dd26f78809d183d188393d
+Author: Tom Hughes <tom at compton.nu>
+Date: Sun Feb 24 11:42:21 2013 +0000
+
+ Don't write to Async objects after we've deleted them
+
+ The handle here is actually the uv_async_t object named watcher that
+ is part of the Async object so we shouldn't try and write to it after
+ the Async object has been freed.
+
+diff --git a/src/async.h b/src/async.h
+index 49b9dbc..37b4248 100644
+--- a/src/async.h
++++ b/src/async.h
+@@ -50,7 +50,6 @@ public:
+ assert(handle->data != NULL);
+ Async* async = static_cast<Async*>(handle->data);
+ delete async;
+- handle->data = NULL;
+ }
+
+ void finish() {
+diff --git a/src/statement.cc b/src/statement.cc
+index b42fc91..382d8e3 100644
+--- a/src/statement.cc
++++ b/src/statement.cc
+@@ -647,7 +647,6 @@ void Statement::CloseCallback(uv_handle_t* handle) {
+ assert(handle->data != NULL);
+ Async* async = static_cast<Async*>(handle->data);
+ delete async;
+- handle->data = NULL;
+ }
+
+ void Statement::AsyncEach(uv_async_t* handle, int status) {
diff --git a/nodejs-sqlite3-libraries.patch b/nodejs-sqlite3-libraries.patch
new file mode 100644
index 0000000..8019e50
--- /dev/null
+++ b/nodejs-sqlite3-libraries.patch
@@ -0,0 +1,13 @@
+--- binding.gyp.libraries 2012-04-23 23:47:08.000000000 +0100
++++ binding.gyp 2013-02-10 16:43:47.409835382 +0000
+@@ -7,8 +7,8 @@
+ 'src/node_sqlite3.cc',
+ 'src/statement.cc'
+ ],
+- 'dependencies': [
+- 'deps/sqlite3/binding.gyp:sqlite3'
++ 'libraries': [
++ '-lsqlite3',
+ ]
+ }
+ ]
diff --git a/nodejs-sqlite3-paths.patch b/nodejs-sqlite3-paths.patch
new file mode 100644
index 0000000..ba485cd
--- /dev/null
+++ b/nodejs-sqlite3-paths.patch
@@ -0,0 +1,8 @@
+--- lib/sqlite3.js.paths 2013-02-10 16:42:25.169281320 +0000
++++ lib/sqlite3.js 2013-02-10 16:42:28.316379054 +0000
+@@ -1,4 +1,4 @@
+-var sqlite3 = module.exports = exports = require('../build/Release/node_sqlite3.node');
++var sqlite3 = module.exports = exports = require('../build/node_sqlite3.node');
+ var path = require('path');
+ var util = require('util');
+ var EventEmitter = require('events').EventEmitter;
diff --git a/nodejs-sqlite3-uv.patch b/nodejs-sqlite3-uv.patch
new file mode 100644
index 0000000..e2c12de
--- /dev/null
+++ b/nodejs-sqlite3-uv.patch
@@ -0,0 +1,85 @@
+commit a43948478bf5cbf0dad9f64bf985ec7c8c003ced
+Author: Tom Hughes <tom at compton.nu>
+Date: Mon Feb 11 17:50:02 2013 +0000
+
+ Updated for libuv changes in node 0.10
+
+diff --git a/package.json b/package.json
+index 0a53f96..c5b6b6a 100644
+--- a/package.json
++++ b/package.json
+@@ -32,7 +32,7 @@
+ "expresso": "*"
+ },
+ "engines": {
+- "node": ">= 0.6.13 && < 0.9.0"
++ "node": ">= 0.6.13 && < 0.11.0"
+ },
+ "scripts": {
+ "test": "expresso -I lib test/*.test.js"
+diff --git a/src/database.cc b/src/database.cc
+index 33d3992..4d4351a 100644
+--- a/src/database.cc
++++ b/src/database.cc
+@@ -138,7 +138,7 @@ Handle<Value> Database::New(const Arguments& args) {
+
+ void Database::Work_BeginOpen(Baton* baton) {
+ int status = uv_queue_work(uv_default_loop(),
+- &baton->request, Work_Open, Work_AfterOpen);
++ &baton->request, Work_Open, (uv_after_work_cb)Work_AfterOpen);
+ assert(status == 0);
+ }
+
+@@ -221,7 +221,7 @@ void Database::Work_BeginClose(Baton* baton) {
+
+ baton->db->RemoveCallbacks();
+ int status = uv_queue_work(uv_default_loop(),
+- &baton->request, Work_Close, Work_AfterClose);
++ &baton->request, Work_Close, (uv_after_work_cb)Work_AfterClose);
+ assert(status == 0);
+ }
+
+@@ -500,7 +500,7 @@ void Database::Work_BeginExec(Baton* baton) {
+ assert(baton->db->handle);
+ assert(baton->db->pending == 0);
+ int status = uv_queue_work(uv_default_loop(),
+- &baton->request, Work_Exec, Work_AfterExec);
++ &baton->request, Work_Exec, (uv_after_work_cb)Work_AfterExec);
+ assert(status == 0);
+ }
+
+@@ -569,7 +569,7 @@ void Database::Work_BeginLoadExtension(Baton* baton) {
+ assert(baton->db->handle);
+ assert(baton->db->pending == 0);
+ int status = uv_queue_work(uv_default_loop(),
+- &baton->request, Work_LoadExtension, Work_AfterLoadExtension);
++ &baton->request, Work_LoadExtension, (uv_after_work_cb)Work_AfterLoadExtension);
+ assert(status == 0);
+ }
+
+diff --git a/src/macros.h b/src/macros.h
+index d5c91fd..dbd14d0 100644
+--- a/src/macros.h
++++ b/src/macros.h
+@@ -136,7 +136,7 @@ const char* sqlite_authorizer_string(int type);
+ baton->stmt->locked = true; \
+ baton->stmt->db->pending++; \
+ int status = uv_queue_work(uv_default_loop(), \
+- &baton->request, Work_##type, Work_After##type); \
++ &baton->request, Work_##type, (uv_after_work_cb)Work_After##type); \
+ assert(status == 0);
+
+ #define STATEMENT_INIT(type) \
+diff --git a/src/statement.cc b/src/statement.cc
+index 382d8e3..2a5f318 100644
+--- a/src/statement.cc
++++ b/src/statement.cc
+@@ -118,7 +118,7 @@ void Statement::Work_BeginPrepare(Database::Baton* baton) {
+ assert(baton->db->open);
+ baton->db->pending++;
+ int status = uv_queue_work(uv_default_loop(),
+- &baton->request, Work_Prepare, Work_AfterPrepare);
++ &baton->request, Work_Prepare, (uv_after_work_cb)Work_AfterPrepare);
+ assert(status == 0);
+ }
+
diff --git a/nodejs-sqlite3.spec b/nodejs-sqlite3.spec
new file mode 100644
index 0000000..b402b93
--- /dev/null
+++ b/nodejs-sqlite3.spec
@@ -0,0 +1,75 @@
+%global enable_tests 0
+
+Name: nodejs-sqlite3
+Version: 2.1.5
+Release: 2%{?dist}
+Summary: Asynchronous, non-blocking SQLite3 bindings for Node.js
+
+License: BSD
+URL: https://github.com/developmentseed/node-sqlite3
+Source0: http://registry.npmjs.org/sqlite3/-/sqlite3-%{version}.tgz
+# Link against system libraries
+Patch0: nodejs-sqlite3-libraries.patch
+# Fix path for binary object to match packaging guidelines
+Patch1: nodejs-sqlite3-paths.patch
+# Offered upstream - https://github.com/developmentseed/node-sqlite3/pull/117
+Patch2: nodejs-sqlite3-async.patch
+# Will offer upstream when node 0.10 is released
+Patch3: nodejs-sqlite3-uv.patch
+
+BuildRequires: nodejs-devel
+BuildRequires: node-gyp
+BuildRequires: sqlite-devel
+
+%if 0%{?enable_tests}
+BuildRequires: npm(expresso)
+BuildRequires: npm(step)
+%endif
+
+%description
+%summary
+
+
+%prep
+%setup -q -n package
+%patch0 -p0 -b .libraries
+%patch1 -p0
+%patch2 -p1 -b .async
+%patch3 -p1 -b .uv
+rm -rf deps node_modules
+
+
+%build
+export CXXFLAGS="%{optflags}"
+node-gyp rebuild
+
+
+%if 0%{?enable_tests}
+%check
+ln -s Release/node_sqlite3.node build/node_sqlite3.node
+%{__nodejs} test/support/createdb.js
+mkdir test/tmp
+%{nodejs_sitelib}/expresso/bin/expresso test/*.test.js
+%endif
+
+
+%install
+mkdir -p %{buildroot}/%{nodejs_sitearch}/sqlite3
+cp -pr package.json lib %{buildroot}/%{nodejs_sitearch}/sqlite3
+mkdir -p %{buildroot}/%{nodejs_sitearch}/sqlite3/build
+install -p -D -m0755 build/Release/node_sqlite3.node %{buildroot}%{nodejs_sitearch}/sqlite3/build
+%nodejs_symlink_deps
+
+
+%files
+%doc LICENSE README.md examples
+%{nodejs_sitearch}/sqlite3
+
+
+%changelog
+* Sat Mar 2 2013 Tom Hughes <tom at compton.nu> - 2.1.5-2
+- Fix permissions on node_sqite3.node
+- Improve description
+
+* Sun Feb 10 2013 Tom Hughes <tom at compton.nu> - 2.1.5-1
+- Initial build of 2.1.5
diff --git a/sources b/sources
index e69de29..499e94a 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+130336370ebcbf205244d8b02aa9c7e1 sqlite3-2.1.5.tgz
More information about the scm-commits
mailing list