Skip to content

Commit 422c9a7

Browse files
committed
Merge PR #891 for building staging binaries on Windows (Danilo Silva)
1 parent dc2cb3f commit 422c9a7

File tree

3 files changed

+71
-1
lines changed

3 files changed

+71
-1
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
- Added support to `fetchAsString` and `fetchInfo` for fetching RAW
1717
columns as STRING (hex-encoded).
1818

19+
- Added Windows support for building binary packages for self-hosting
20+
on internal networks. PR #891 (Danilo Silva).
21+
1922
- Eliminated a memory leak when binding LOBs as `oracledb.BIND_INOUT`.
2023

2124
- Added an error message indicating that `batchErrors` and

package/MAKEPKG.BAT

+64-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ REM ****************************************************************************
2626

2727
REM
2828
REM usage: MAKEPKG.BAT [<cmd>]
29-
REM : Possible values for <cmd> are: CLEANUP and CREATEBINARY
29+
REM : Possible values for <cmd> are: CLEANUP, CREATEBINARY
30+
REM and CREATESTAGEBINARY
3031
REM
3132
REM expected to run this batch file from package sub-directory,
3233
REM where a fresh clone is created.
@@ -38,6 +39,7 @@ if "%1" == "" GOTO usage
3839
REM jump to appropriate sections based on <cmd>
3940
if "%1" == "CLEANUP" GOTO cleanup
4041
if "%1" == "CREATEBINARY" GOTO createbinary
42+
if "%1" == "CREATESTAGEBINARY" GOTO createstagebinary
4143
goto usage
4244

4345
REM cleanup section, remove file(s) created by this batch file
@@ -47,6 +49,67 @@ del ..\package-lock.json
4749
del SHASUMS256.txt oracledb-v*-node-*.gz
4850
goto exit
4951

52+
53+
REM compile, package to gz file
54+
:createstagebinary
55+
echo "createstagebinary section"
56+
57+
REM Append SHA to LICENSE.MD
58+
git checkout ..\LICENSE.md
59+
setlocal enabledelayedexpansion
60+
REM compose a string with commands to execute one by one
61+
62+
REM start with empty string
63+
set CONCAT_STR=
64+
REM capture SHA
65+
FOR /F "tokens=* USEBACKQ" %%F IN (`git --git-dir=..\.git rev-parse HEAD`) DO (
66+
SET CONCAT_STR=%%F
67+
)
68+
69+
set DATE_STR=
70+
FOR /F "tokens=* USEBACKQ" %%F IN (`DATE /T`) DO ( SET DATE_STR=%%F )
71+
72+
REM append output of other commands
73+
set CMD_STR="git --git-dir=..\odpi\.git rev-parse HEAD && node --version"
74+
for /f %%i in ('%CMD_STR%') do set "CONCAT_STR=!CONCAT_STR! %%i"
75+
set CONCAT_STR=!CONCAT_STR! !DATE_STR!
76+
echo !CONCAT_STR! >> ..\LICENSE.MD
77+
78+
REM Compile node-oracledb
79+
cd ..
80+
CALL npm install
81+
echo "NODE oracledb compiled"
82+
cd package
83+
echo "==> Staging Binary package created for Node.js "
84+
85+
Set "hostname=%NODE_ORACLEDB_PACKAGE_HOSTNAME%"
86+
Set "pathname=%NODE_ORACLEDB_PACKAGE_URL_PATH%"
87+
Set "newname=%NODE_PKG_HOSTNAME%"
88+
echo ON
89+
echo %hostname%
90+
echo %pathname%
91+
echo %newname%
92+
93+
sed "s/github.com/%hostname%/g" oracledbinstall.js
94+
sed "s/oracle\/node-oracledb\/releases\/download\//%pathname%/g" oracledbinstall.js
95+
96+
del /S *.gz
97+
98+
node createpackage.js
99+
xcopy /Y "package.json" "../package.json"
100+
npm pack
101+
Setlocal enabledelayedexpansion
102+
103+
Set "Pattern=oracledb"
104+
Set "Replace=oracledb-staging"
105+
106+
For %%a in (*.gz) Do (
107+
Set "File=%%~a"
108+
Ren "%%a" "!File:%Pattern%=%Replace%!"
109+
)
110+
111+
goto exit
112+
50113
REM compile, package to gz file
51114
:createbinary
52115
echo "createbinary section"

package/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ Installation is described in [INSTALL](https://oracle.github.io/node-oracledb/IN
9898
Remember to do `npm config delete strict-ssl` and unset the
9999
environment variable when not testing.
100100

101+
- On Windows, MAKEPKG.BAT has command options to create binaries, and
102+
also to create staged binaries and the main packages.
103+
101104
- At install time, setting the environment variable
102105
`NODE_ORACLEDB_TRACE_INSTALL` to `TRUE` will cause `npm install` to
103106
display more tracing information.
@@ -108,4 +111,5 @@ Installation is described in [INSTALL](https://oracle.github.io/node-oracledb/IN
108111
- TODO
109112

110113
- oracledbinstall.js should cache SHASUMS256.txt so it doesn't have to be fetched twice.
114+
- Add support for proxies that require authentication
111115
- Improve oracledbinstall.js `no_proxy` support for domain names and wildcards.

0 commit comments

Comments
 (0)