Skip to content

Commit

Permalink
Merge PR #891 for building staging binaries on Windows (Danilo Silva)
Browse files Browse the repository at this point in the history
  • Loading branch information
cjbj committed Jun 5, 2018
1 parent dc2cb3f commit 422c9a7
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
- Added support to `fetchAsString` and `fetchInfo` for fetching RAW
columns as STRING (hex-encoded).

- Added Windows support for building binary packages for self-hosting
on internal networks. PR #891 (Danilo Silva).

- Eliminated a memory leak when binding LOBs as `oracledb.BIND_INOUT`.

- Added an error message indicating that `batchErrors` and
Expand Down
65 changes: 64 additions & 1 deletion package/MAKEPKG.BAT
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ REM ****************************************************************************

REM
REM usage: MAKEPKG.BAT [<cmd>]
REM : Possible values for <cmd> are: CLEANUP and CREATEBINARY
REM : Possible values for <cmd> are: CLEANUP, CREATEBINARY
REM and CREATESTAGEBINARY
REM
REM expected to run this batch file from package sub-directory,
REM where a fresh clone is created.
Expand All @@ -38,6 +39,7 @@ if "%1" == "" GOTO usage
REM jump to appropriate sections based on <cmd>
if "%1" == "CLEANUP" GOTO cleanup
if "%1" == "CREATEBINARY" GOTO createbinary
if "%1" == "CREATESTAGEBINARY" GOTO createstagebinary
goto usage

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


REM compile, package to gz file
:createstagebinary
echo "createstagebinary section"

REM Append SHA to LICENSE.MD
git checkout ..\LICENSE.md
setlocal enabledelayedexpansion
REM compose a string with commands to execute one by one

REM start with empty string
set CONCAT_STR=
REM capture SHA
FOR /F "tokens=* USEBACKQ" %%F IN (`git --git-dir=..\.git rev-parse HEAD`) DO (
SET CONCAT_STR=%%F
)

set DATE_STR=
FOR /F "tokens=* USEBACKQ" %%F IN (`DATE /T`) DO ( SET DATE_STR=%%F )

REM append output of other commands
set CMD_STR="git --git-dir=..\odpi\.git rev-parse HEAD && node --version"
for /f %%i in ('%CMD_STR%') do set "CONCAT_STR=!CONCAT_STR! %%i"
set CONCAT_STR=!CONCAT_STR! !DATE_STR!
echo !CONCAT_STR! >> ..\LICENSE.MD

REM Compile node-oracledb
cd ..
CALL npm install
echo "NODE oracledb compiled"
cd package
echo "==> Staging Binary package created for Node.js "

Set "hostname=%NODE_ORACLEDB_PACKAGE_HOSTNAME%"
Set "pathname=%NODE_ORACLEDB_PACKAGE_URL_PATH%"
Set "newname=%NODE_PKG_HOSTNAME%"
echo ON
echo %hostname%
echo %pathname%
echo %newname%

sed "s/github.com/%hostname%/g" oracledbinstall.js
sed "s/oracle\/node-oracledb\/releases\/download\//%pathname%/g" oracledbinstall.js

del /S *.gz

node createpackage.js
xcopy /Y "package.json" "../package.json"
npm pack
Setlocal enabledelayedexpansion

Set "Pattern=oracledb"
Set "Replace=oracledb-staging"

For %%a in (*.gz) Do (
Set "File=%%~a"
Ren "%%a" "!File:%Pattern%=%Replace%!"
)

goto exit

REM compile, package to gz file
:createbinary
echo "createbinary section"
Expand Down
4 changes: 4 additions & 0 deletions package/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ Installation is described in [INSTALL](https://oracle.github.io/node-oracledb/IN
Remember to do `npm config delete strict-ssl` and unset the
environment variable when not testing.

- On Windows, MAKEPKG.BAT has command options to create binaries, and
also to create staged binaries and the main packages.

- At install time, setting the environment variable
`NODE_ORACLEDB_TRACE_INSTALL` to `TRUE` will cause `npm install` to
display more tracing information.
Expand All @@ -108,4 +111,5 @@ Installation is described in [INSTALL](https://oracle.github.io/node-oracledb/IN
- TODO

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

0 comments on commit 422c9a7

Please sign in to comment.