From 0bfedd13a916b24e0b8d69e045aded62cc1595c6 Mon Sep 17 00:00:00 2001 From: Bartosz Sosnowski Date: Thu, 24 Mar 2016 10:53:42 -0700 Subject: [PATCH] win,build: add creation of zip and 7z package Add a step in vcbuild.bat to create a minimal package including node and npm that can be used as an alternative to the MSI. Compress the node.pdb file as zip and 7z. All files are uploaded as part of build-release. Reviewed-By: Joao Reis Reviewed-By: Rod Vagg Reviewed-By: Alexis Campailla PR-URL: https://github.com/nodejs/node/pull/5995 Fixes: https://github.com/nodejs/build/issues/299 Fixes: https://github.com/nodejs/node/issues/5696 --- vcbuild.bat | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 57 insertions(+), 2 deletions(-) diff --git a/vcbuild.bat b/vcbuild.bat index 14c65fdcdb..b5844c817f 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -21,6 +21,7 @@ set nobuild= set nosign= set nosnapshot= set test_args= +set package= set msi= set upload= set licensertf= @@ -66,6 +67,7 @@ if /i "%1"=="test-pummel" set test_args=%test_args% pummel&goto arg-ok if /i "%1"=="test-all" set test_args=%test_args% sequential parallel message gc internet pummel&set buildnodeweak=1&set jslint=1&goto arg-ok if /i "%1"=="test-known-issues" set test_args=%test_args% known_issues --expect-fail&goto arg-ok if /i "%1"=="jslint" set jslint=1&goto arg-ok +if /i "%1"=="package" set package=1&goto arg-ok if /i "%1"=="msi" set msi=1&set licensertf=1&set download_arg="--download=all"&set i18n_arg=small-icu&goto arg-ok if /i "%1"=="build-release" set build_release=1&goto arg-ok if /i "%1"=="upload" set upload=1&goto arg-ok @@ -87,6 +89,7 @@ goto next-arg if defined build_release ( set config=Release + set package=1 set msi=1 set licensertf=1 set download_arg="--download=all" @@ -206,11 +209,59 @@ if errorlevel 1 echo Failed to sign exe&goto exit :licensertf @rem Skip license.rtf generation if not requested. -if not defined licensertf goto msi +if not defined licensertf goto package %config%\node tools\license2rtf.js < LICENSE > %config%\license.rtf if errorlevel 1 echo Failed to generate license.rtf&goto exit +:package +if not defined package goto msi +echo Creating package... +cd Release +mkdir node-v%FULLVERSION%-win-%target_arch% > nul 2> nul +mkdir node-v%FULLVERSION%-win-%target_arch%\node_modules > nul 2>nul + +copy /Y node.exe node-v%FULLVERSION%-win-%target_arch%\ > nul +if errorlevel 1 echo Cannot copy node.exe && goto package_error +copy /Y ..\LICENSE node-v%FULLVERSION%-win-%target_arch%\ > nul +if errorlevel 1 echo Cannot copy LICENSE && goto package_error +copy /Y ..\README.md node-v%FULLVERSION%-win-%target_arch%\ > nul +if errorlevel 1 echo Cannot copy README.md && goto package_error +copy /Y ..\CHANGELOG.md node-v%FULLVERSION%-win-%target_arch%\ > nul +if errorlevel 1 echo Cannot copy CHANGELOG.md && goto package_error +robocopy /e ..\deps\npm node-v%FULLVERSION%-win-%target_arch%\node_modules\npm > nul +if errorlevel 8 echo Cannot copy npm package && goto package_error +copy /Y ..\deps\npm\bin\npm node-v%FULLVERSION%-win-%target_arch%\ > nul +if errorlevel 1 echo Cannot copy npm && goto package_error +copy /Y ..\deps\npm\bin\npm.cmd node-v%FULLVERSION%-win-%target_arch%\ > nul +if errorlevel 1 echo Cannot copy npm.cmd && goto package_error + +echo Creating node-v%FULLVERSION%-win-%target_arch%.7z +del node-v%FULLVERSION%-win-%target_arch%.7z > nul 2> nul +7z a -r -mx9 -t7z node-v%FULLVERSION%-win-%target_arch%.7z node-v%FULLVERSION%-win-%target_arch% > nul +if errorlevel 1 echo Cannot create node-v%FULLVERSION%-win-%target_arch%.7z && goto package_error + +echo Creating node-v%FULLVERSION%-win-%target_arch%.zip +del node-v%FULLVERSION%-win-%target_arch%.zip > nul 2> nul +7z a -r -mx9 -tzip node-v%FULLVERSION%-win-%target_arch%.zip node-v%FULLVERSION%-win-%target_arch% > nul +if errorlevel 1 echo Cannot create node-v%FULLVERSION%-win-%target_arch%.zip && goto package_error + +echo Creating node_pdb.7z +del node_pdb.7z > nul 2> nul +7z a -mx9 -t7z node_pdb.7z node.pdb > nul + +echo Creating node_pdb.zip +del node_pdb.zip > nul 2> nul +7z a -mx9 -tzip node_pdb.zip node.pdb > nul + +cd .. +echo Package created! +goto package_done +:package_error +cd .. +exit /b 1 +:package_done + :msi @rem Skip msi generation if not requested if not defined msi goto run @@ -236,8 +287,12 @@ if not defined STAGINGSERVER set STAGINGSERVER=node-www ssh -F %SSHCONFIG% %STAGINGSERVER% "mkdir -p nodejs/%DISTTYPEDIR%/v%FULLVERSION%/win-%target_arch%" scp -F %SSHCONFIG% Release\node.exe %STAGINGSERVER%:nodejs/%DISTTYPEDIR%/v%FULLVERSION%/win-%target_arch%/node.exe scp -F %SSHCONFIG% Release\node.lib %STAGINGSERVER%:nodejs/%DISTTYPEDIR%/v%FULLVERSION%/win-%target_arch%/node.lib +scp -F %SSHCONFIG% Release\node_pdb.zip %STAGINGSERVER%:nodejs/%DISTTYPEDIR%/v%FULLVERSION%/win-%target_arch%/node_pdb.zip +scp -F %SSHCONFIG% Release\node_pdb.7z %STAGINGSERVER%:nodejs/%DISTTYPEDIR%/v%FULLVERSION%/win-%target_arch%/node_pdb.7z +scp -F %SSHCONFIG% Release\node-v%FULLVERSION%-win-%target_arch%.7z %STAGINGSERVER%:nodejs/%DISTTYPEDIR%/v%FULLVERSION%/node-v%FULLVERSION%-win-%target_arch%.7z +scp -F %SSHCONFIG% Release\node-v%FULLVERSION%-win-%target_arch%.zip %STAGINGSERVER%:nodejs/%DISTTYPEDIR%/v%FULLVERSION%/node-v%FULLVERSION%-win-%target_arch%.zip scp -F %SSHCONFIG% node-v%FULLVERSION%-%target_arch%.msi %STAGINGSERVER%:nodejs/%DISTTYPEDIR%/v%FULLVERSION%/ -ssh -F %SSHCONFIG% %STAGINGSERVER% "touch nodejs/%DISTTYPEDIR%/v%FULLVERSION%/node-v%FULLVERSION%-%target_arch%.msi.done nodejs/%DISTTYPEDIR%/v%FULLVERSION%/win-%target_arch%.done && chmod -R ug=rw-x+X,o=r+X nodejs/%DISTTYPEDIR%/v%FULLVERSION%/node-v%FULLVERSION%-%target_arch%.msi* nodejs/%DISTTYPEDIR%/v%FULLVERSION%/win-%target_arch%*" +ssh -F %SSHCONFIG% %STAGINGSERVER% "touch nodejs/%DISTTYPEDIR%/v%FULLVERSION%/node-v%FULLVERSION%-%target_arch%.msi.done nodejs/%DISTTYPEDIR%/v%FULLVERSION%/node-v%FULLVERSION%-win-%target_arch%.zip.done nodejs/%DISTTYPEDIR%/v%FULLVERSION%/node-v%FULLVERSION%-win-%target_arch%.7z.done nodejs/%DISTTYPEDIR%/v%FULLVERSION%/win-%target_arch%.done && chmod -R ug=rw-x+X,o=r+X nodejs/%DISTTYPEDIR%/v%FULLVERSION%/node-v%FULLVERSION%-%target_arch%.* nodejs/%DISTTYPEDIR%/v%FULLVERSION%/win-%target_arch%*" :run @rem Run tests if requested.