Skip to content

Commit 9bbc2c8

Browse files
authored
Merge pull request #260 from DavidVujic/3-5-8-for-all-platforms
Use ZooKeeper C Client v3.5.8 in all platforms
2 parents 8bb6abf + 7e91eb0 commit 9bbc2c8

18 files changed

+60
-262
lines changed

.gitignore

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ build
22
node_modules
33
npm-debug.log
44
.idea
5-
*.tgz
6-
deps/zookeeper*
7-
deps/apache-zookeeper-*/
5+
deps/zookeeper-client-c/
86
.DS_Store
97
package-lock.json

binding.gyp

+10-10
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,22 @@
1919
}],
2020
['OS=="mac"',{
2121
'include_dirs': [
22-
'<(module_root_dir)/deps/zookeeper/include',
23-
'<(module_root_dir)/deps/zookeeper/generated',
22+
'<(module_root_dir)/deps/zookeeper-client-c/include',
23+
'<(module_root_dir)/deps/zookeeper-client-c/generated',
2424
'<!(node -e "require(\'nan\')")'
2525
],
26-
'libraries': ['<(module_root_dir)/deps/zookeeper/.libs/libzookeeper_st.a'],
26+
'libraries': ['<(module_root_dir)/deps/zookeeper-client-c/.libs/libzookeeper_st.a'],
2727
'xcode_settings': {
2828
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
2929
'MACOSX_DEPLOYMENT_TARGET': '<!(sw_vers -productVersion)'
3030
}
3131
}],['OS=="linux"',{
3232
'include_dirs': [
33-
'<(module_root_dir)/deps/zookeeper/include',
34-
'<(module_root_dir)/deps/zookeeper/generated',
33+
'<(module_root_dir)/deps/zookeeper-client-c/include',
34+
'<(module_root_dir)/deps/zookeeper-client-c/generated',
3535
'<!(node -e "require(\'nan\')")'
3636
],
37-
'libraries': ['<(module_root_dir)/deps/zookeeper/.libs/libzookeeper_st.a'],
37+
'libraries': ['<(module_root_dir)/deps/zookeeper-client-c/.libs/libzookeeper_st.a'],
3838
}],['OS=="win"',{
3939
'defines': ['WIN32', 'USE_STATIC_LIB'],
4040
'msvs_settings': {
@@ -43,13 +43,13 @@
4343
}
4444
},
4545
'include_dirs': [
46-
'<(module_root_dir)/deps/zookeeper/include',
47-
'<(module_root_dir)/deps/zookeeper/generated',
46+
'<(module_root_dir)/deps/zookeeper-client-c/include',
47+
'<(module_root_dir)/deps/zookeeper-client-c/generated',
4848
'<!(node -e "require(\'nan\')")'
4949
],
5050
'libraries': [
51-
'<(module_root_dir)/deps/zookeeper/Debug/zookeeper.lib',
52-
'<(module_root_dir)/deps/zookeeper/Debug/hashtable.lib',
51+
'<(module_root_dir)/deps/zookeeper-client-c/Debug/zookeeper.lib',
52+
'<(module_root_dir)/deps/zookeeper-client-c/Debug/hashtable.lib',
5353
'msvcrt.lib',
5454
'msvcmrt.lib',
5555
'Ws2_32.lib',

deps/README.md

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
### Developer: updating the ZooKeeper Client C source code
2+
3+
This guide is extracted from the [official docs](https://github.com/apache/zookeeper/blob/master/zookeeper-client/zookeeper-client-c/README)
4+
5+
1 Download the source code
6+
2 Navigate to the root folder: run ant compile_jute
7+
3 Navigate to the zookeeper-client-c folder: run autoreconf -if
8+
4 compress the entire zookeeper-client-c folder and name it `zookeeper-client-c.tar.gz`
9+
* On Mac OS X: `COPYFILE_DISABLE=1 tar -czvf zookeeper-client-c.tar.gz zookeeper-client-c`
10+
5 replace the existing compressed file in the deps folder

deps/apache-zookeeper-3.5.6.tar.gz

-2.99 MB
Binary file not shown.

deps/zookeeper-client-c.tar.gz

860 KB
Binary file not shown.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
"type-declarations": "tsc --outFile ./lib/typedeclarations.d.ts"
6565
},
6666
"engines": {
67-
"node": ">=8.9.4"
67+
"node": ">=10.0.0"
6868
},
6969
"types": "./lib/typedeclarations.d.ts"
7070
}

patches/CMakeLists.txt

-69
This file was deleted.

patches/README.md

-19
This file was deleted.

patches/autoreconf.tar.gz

-671 KB
Binary file not shown.

prebuilds/README.md

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
### Prebuilds
2+
3+
Currently, there are prebuilt Node.js AddOns for Mac OS X and Windows.
4+
Each platform has prebuilds for Node.js 12 and 14.
5+
6+
7+
#### Creating prebuilds
8+
Create prebuilds for Mac OS X:
9+
10+
```bash
11+
npx prebuildify --arch x64 --platform darwin --target 12.18.4
12+
npx prebuildify --arch x64 --platform darwin --target 14.13.0
13+
```
14+
15+
Create prebuilds for Windows 10:
16+
17+
```bash
18+
npx prebuildify --arch x64 --platform win32 --target 12.13.0
19+
Npx prebuildify --arch x64 --platform win32 --target 14.13.0
20+
```

prebuilds/darwin-x64/node.abi72.node

15.1 KB
Binary file not shown.

prebuilds/darwin-x64/node.abi83.node

80 Bytes
Binary file not shown.

prebuilds/win32-x64/node.abi72.node

26.5 KB
Binary file not shown.

prebuilds/win32-x64/node.abi83.node

26.5 KB
Binary file not shown.

scripts/build.js

-18
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,6 @@ const shell = require('shelljs');
22
const env = require('./env.js');
33
const { exec } = require('./helper.js');
44

5-
function handleSunOS() {
6-
const uname = shell.exec('uname -v');
7-
8-
if (uname.match('joyent_.*')) {
9-
const res = shell.exec(`pkgin list | grep zookeeper-client-${env.zookeeperVersion}`);
10-
11-
if (res.code !== 0) {
12-
shell.echo('You must install zookeeper before installing this module. Try:');
13-
shell.echo(`pkgin install zookeeper-client-${env.zookeeperVersion}`);
14-
}
15-
}
16-
}
17-
18-
if (env.isSunOs) {
19-
handleSunOS();
20-
shell.exit(0);
21-
}
22-
235
if (env.isAlreadyBuilt) {
246
shell.echo('Zookeeper has already been built');
257
shell.exit(0);

scripts/env.js

+4-23
Original file line numberDiff line numberDiff line change
@@ -19,40 +19,21 @@ function checkIfAlreadyBuilt(env) {
1919
}
2020

2121
const isWindows = process.platform.toLowerCase().includes('win32');
22-
const isSunOs = process.platform.toLowerCase().includes('sunos');
2322
const rootFolder = setRoot({ isWindows });
2423

25-
let zookeeperVersion;
26-
let downloadedFolderName;
27-
let sha512sum;
28-
const suffix = '.tar.gz';
29-
let downloadedFileName;
30-
31-
if (isWindows) {
32-
zookeeperVersion = '3.4.14';
33-
downloadedFolderName = `zookeeper-${zookeeperVersion}`;
34-
downloadedFileName = `${downloadedFolderName}${suffix}`;
35-
sha512sum = `b2e03d95f8cf18b97a46e2f53871cef5a5da9d5d80b97009375aed7fb35368c440ca944c7e8b64efabbc065f6fb98bb86239f7c1491f0490efc71876d5a7f424 ${downloadedFileName}`;
36-
} else {
37-
zookeeperVersion = '3.5.6';
38-
downloadedFolderName = `apache-zookeeper-${zookeeperVersion}`;
39-
downloadedFileName = `${downloadedFolderName}${suffix}`;
40-
sha512sum = `7f45817cbbc42aec5a7817fa2ae99656128e666dc58ace23d86bcfc5ca0dc49e418d1a7d1f082ad80ccb916f9f1b490167d16f836886af1a56fbcf720ad3b9d0 ${downloadedFileName}`;
41-
}
24+
const zookeeperVersion = '3.5.8';
25+
const downloadedFolderName = 'zookeeper-client-c';
26+
const downloadedFileName = 'zookeeper-client-c.tar.gz';
4227

4328
const variables = {
4429
rootFolder,
4530
workFolder: `${rootFolder}/deps`,
4631
buildFolder: `${rootFolder}/build/zk`,
4732
zookeeperVersion,
48-
sha512sum,
4933
downloadedFolderName,
50-
sourceFolder: `${rootFolder}/deps/zookeeper`,
51-
patchesFolder: `${rootFolder}/patches`,
34+
sourceFolder: `${rootFolder}/deps/zookeeper-client-c`,
5235
downloadedFileName,
53-
downloadUrl: `http://archive.apache.org/dist/zookeeper/zookeeper-${zookeeperVersion}/${downloadedFileName}`,
5436
isWindows,
55-
isSunOs,
5637
isVerbose: !!process.env.ZK_INSTALL_VERBOSE,
5738
};
5839

scripts/helper.js

-16
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,6 @@ function exec(action) {
1111
return res.stdout;
1212
}
1313

14-
async function retry(func, ...args) {
15-
let res;
16-
17-
try {
18-
res = await func(...args);
19-
} catch (e) {
20-
shell.echo(e.message);
21-
shell.echo(`Retrying ${func.name}`);
22-
23-
res = await func(...args);
24-
}
25-
26-
return res;
27-
}
28-
2914
module.exports = {
3015
exec,
31-
retry,
3216
};

0 commit comments

Comments
 (0)