From 422c9a7fddc4b47ffe4e457750aeb47521c43687 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Tue, 5 Jun 2018 18:31:29 +1000 Subject: [PATCH] Merge PR #891 for building staging binaries on Windows (Danilo Silva) --- CHANGELOG.md | 3 +++ package/MAKEPKG.BAT | 65 ++++++++++++++++++++++++++++++++++++++++++++- package/README.md | 4 +++ 3 files changed, 71 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ec8a6539..25aa6a64c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/package/MAKEPKG.BAT b/package/MAKEPKG.BAT index 94f86d47f..84599b482 100644 --- a/package/MAKEPKG.BAT +++ b/package/MAKEPKG.BAT @@ -26,7 +26,8 @@ REM **************************************************************************** REM REM usage: MAKEPKG.BAT [] -REM : Possible values for are: CLEANUP and CREATEBINARY +REM : Possible values for 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. @@ -38,6 +39,7 @@ if "%1" == "" GOTO usage REM jump to appropriate sections based on 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 @@ -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" diff --git a/package/README.md b/package/README.md index 22309c2b5..1a98c46cc 100644 --- a/package/README.md +++ b/package/README.md @@ -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. @@ -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.