salt/pkg/windows/build.bat

84 lines
2.5 KiB
Batchfile
Raw Normal View History

2016-08-09 19:53:55 +00:00
@echo off
@echo Salt Windows Build Script
2016-08-09 20:11:45 +00:00
@echo ---------------------------------------------------------------------
2016-08-09 19:53:55 +00:00
@echo.
2016-02-12 18:37:49 +00:00
:: Make sure the script is run as Admin
2016-08-09 19:53:55 +00:00
@echo Administrative permissions required. Detecting permissions...
2016-08-09 20:11:45 +00:00
@echo ---------------------------------------------------------------------
2016-02-12 18:37:49 +00:00
net session >nul 2>&1
if %errorLevel%==0 (
echo ...Success: Administrative permissions confirmed.
2016-02-12 18:37:49 +00:00
) else (
echo ...Failure: This script must be run as Administrator
2016-02-12 18:37:49 +00:00
goto eof
)
@echo =====================================================================
2016-08-09 20:11:45 +00:00
@echo.
2016-02-12 18:37:49 +00:00
@echo Git required. Detecting git...
@echo ---------------------------------------------------------------------
where git >nul 2>&1
if %errorLevel%==0 (
echo ...Success: Git found.
) else (
echo ...Failure: This script needs to call git
goto eof
)
@echo =====================================================================
@echo.
2016-02-12 18:37:49 +00:00
:: Define Variables
2016-07-06 22:18:01 +00:00
@echo %0 :: Defining Variables...
2016-08-09 20:11:45 +00:00
@echo ---------------------------------------------------------------------
2016-02-12 18:37:49 +00:00
Set "PyDir=C:\Python27"
Set "CurDir=%~dp0"
Set PATH=%PATH%;C:\Python27;C:\Python27\Scripts
2016-02-12 18:37:49 +00:00
for /f "delims=" %%a in ('git rev-parse --show-toplevel') do @set "SrcDir=%%a"
2016-08-04 17:58:00 +00:00
:: Get the version from git if not passed
2016-02-12 18:37:49 +00:00
if [%1]==[] (
for /f "delims=" %%a in ('git describe') do @set "Version=%%a"
echo ... Version from git describe == %Version%
2016-02-12 18:37:49 +00:00
) else (
set "Version=%~1"
)
@echo =====================================================================
2016-08-09 20:11:45 +00:00
@echo.
2016-02-12 18:37:49 +00:00
2017-01-18 01:09:04 +00:00
:: Version must be set
if [%Version%]==[] (
echo Failure: Version must be set
goto eof
)
2016-02-12 18:37:49 +00:00
:: Create Build Environment
2016-08-09 20:11:45 +00:00
@echo %0 :: Create the Build Environment...
@echo ---------------------------------------------------------------------
PowerShell.exe -ExecutionPolicy RemoteSigned -File "%CurDir%build_env.ps1" -Silent
2016-02-12 18:37:49 +00:00
2016-07-06 22:18:01 +00:00
if not %errorLevel%==0 (
echo "%CurDir%build_env.ps1" returned errorlevel %errorLevel%. Aborting %0
goto eof
)
2016-08-09 20:11:45 +00:00
@echo.
2016-07-06 22:18:01 +00:00
2016-02-12 18:37:49 +00:00
:: Install Current Version of salt
2016-08-09 19:53:55 +00:00
@echo %0 :: Install Current Version of salt...
2016-08-09 20:11:45 +00:00
@echo ---------------------------------------------------------------------
"%PyDir%\python.exe" "%SrcDir%\setup.py" --quiet install --force
2016-08-09 20:11:45 +00:00
@echo.
2016-02-12 18:37:49 +00:00
:: Build the Salt Package
2016-08-09 19:53:55 +00:00
@echo %0 :: Build the Salt Package...
2016-08-09 20:11:45 +00:00
@echo ---------------------------------------------------------------------
2016-02-12 18:37:49 +00:00
call "%CurDir%build_pkg.bat" "%Version%"
2016-08-09 20:11:45 +00:00
@echo.
2016-02-12 18:37:49 +00:00
:eof
2016-08-09 20:11:45 +00:00
@echo.
@echo =====================================================================
2016-08-09 19:53:55 +00:00
@echo End of %0
2016-08-09 20:11:45 +00:00
@echo =====================================================================