source: tol/windows/build_tools/_uptol.bat @ 9db164f

1941-docker-image-to-testdevel
Last change on this file since 9db164f was 820edff, checked in by Jorge Pérez <josp.jorge@…>, 14 years ago

despues de compilar invoco TolPackage::Client::_.DefaultFetch(?)

git-svn-id: ​https://www.tol-project.org/svn/tolp/trunk@4647 be4846ae-f051-483a-831f-b64e7d08527f

  • Property mode set to 100644
File size: 13.6 KB
Line 
1@Rem Author: Jorge <josp.jorge@gmail.com>
2
3rem @Echo Off
4Rem Compila tol y toltcl, el postbuild se encarga de copiar los binarios
5Rem Copia stdlib hacia ActiveTOL
6Rem Copia tolbase\toltklib\byswidget, tolbase\lib\ hacia ActiveTOL
7
8rem SetLocal enableextensions enabledelayedexpansion
9Rem Validacion de argumentos
10
11Rem procesamiento de opciones de linea de comandos
12Set _rebuild=0
13Set _jup=0
14Set _pnsis=0
15Set _dotests=0
16Set _dodist=0
17Set _plog=!CD!\log2clog.exe
18Set _fbody=!CD!\test_status\BODY.txt
19
20If Not Exist test_status\nul (
21  Md test_status
22)
23
24Rem !!!!!!!!!!!!!!!!!!!!!!!
25
26Set _url_bin_=https://www.tol-project.org/win32
27
28Set tdt_subject="UPTOL works fine"
29Set tdt_body=%_fbody%
30Set tdt_attach=""
31
32     
33:READ_OPTS
34If "%1"=="" Goto END_OPTS
35If "%1"=="/?" Goto SHOW_HELP
36If "%1"=="/no_update" (
37  Goto NEXT_OPTS
38)
39If "%1"=="/smartbuild" (
40  Set _rebuild=0
41  Goto NEXT_OPTS
42)
43If "%1"=="/rebuild" (
44  Set _rebuild=1
45  Goto NEXT_OPTS
46)
47If "%1"=="/jup" (
48  Set _jup=1
49  Goto NEXT_OPTS
50)
51If "%1"=="/pnsis" (
52  Set _pnsis=1
53  Goto NEXT_OPTS
54)
55If "%1"=="/tests" (
56  Set _dotests=1
57  Goto NEXT_OPTS
58)
59If "%1"=="/no_tests" (
60  Set _dotests=0
61  Goto NEXT_OPTS
62)
63If "%1"=="/dist" (
64  Set _dodist=1
65  Goto NEXT_OPTS
66)
67Set _msg_error=Opcion invalida %1
68Goto ERROR
69:NEXT_OPTS
70Shift
71Goto READ_OPTS
72:END_OPTS
73
74Rem Goto TMP
75Rem Goto DODIST
76
77
78If "%_rebuild%"=="1" (
79  Set _rbopt=/rebuild
80)
81
82Set ATOLDIR=!CD!\..\ActiveTol\bin
83
84Goto BEGIN
85
86Rem Ayuda de uso
87:SHOW_HELP
88@more README
89Goto END
90
91Rem Codigo de error
92:ERROR
93If Not Defined _msg_error (
94  Echo Error invocado sin mensage
95) else (
96  Echo %_msg_error%
97  Set tdt_subject="UPTOL works badly"
98  Echo %_msg_error% >> %_fbody%
99)
100Pause
101Goto END
102
103Rem Codigo de retorno generico
104:RET
105If Defined _ret (
106  Goto %_ret%
107) Else (
108  Set _msg_error=Error interno! Punto de retorno no definido.
109  Goto ERROR
110)
111
112Rem Actualiza scripts en ActiveTOL, recibe como argumento
113Rem   - _dir_src,  directorio origen
114Rem   - _dir_dest,  directorio destino
115:UP_SCRIPTS
116If Exist %_dir_dest%\nul (
117  Echo Borrando scripts antiguos de %_dir_dest%
118  Rmdir /S /Q %_dir_dest%
119)
120Echo Copiando scripts nuevos de %_dir_src% a %_dir_dest%
121xcopy %_dir_src% %_dir_dest% /S /F /Y /I /EXCLUDE:exclude.lst
122If errorlevel 1  (
123  Set _msg_error=Error copiando %_dir_src% hacia %_dir_dest%
124  Goto ERROR
125)
126Goto RET
127
128Rem Codigo generico de compilacion
129:COMPILE
130Rem Verifico que ejecutemos desde el SDK
131If Not Defined MSSdk (
132  Set _msg_error=Solo se puede compilar desde una consola Microsoft Platform SDK
133  Goto ERROR
134)
135If Not Defined _mod (
136  Set _msg_error=Error interno! variable _mod no definida en COMPILE
137  Goto ERROR
138)
139If Not Exist ..\..\%_mod%\nul (
140  Set _msg_error=Error interno! el directorio %_mod% debia existir cuando se ha solicitado su compilacion.
141  Goto ERROR
142)
143If Not Defined _sln (
144  Set _msg_error=Error interno variable _sln no definida en COMPILE
145  Goto ERROR
146)
147If Not Exist ..\..\%_mod%\%winSrc%\%_sln% (
148  Set _msg_error=No se puede compilar, el archivo %_mod%\%winSrc%\%_sln% no existe
149  Goto ERROR
150)
151If "%_vsvars32%"=="" (
152  If Defined VSCOMNTOOLS (
153    call "%VSCOMNTOOLS%vsvars32"
154    If errorlevel 1 (
155      Set _msg_error=No se pudo ejecutar vsvars32
156      Goto ERROR
157    )
158    Set _vsvars32=1
159  ) else (
160    Echo VSCOMNTOOLS no esta definida intentanto vsvars32 desde el PATH
161    call vsvars32
162    If errorlevel 1 (
163      Set _msg_error=No se pudo ejecutar vsvars32
164      Goto ERROR
165    )
166  )
167) else  (
168  Echo vsvars32 ya ha sido invocado
169)
170Rem Verifico postbuild.bat: aseguro que existe. postbuild copia la compilacion a ActiveTOL
171If Not Exist ..\..\%_mod%\%winSrc%\postbuild.bat (
172  xcopy /F /Y postbuild.bat %_mod%\%winSrc%
173)
174vcbuild %_rbopt% /useenv ..\..\%_mod%\%winSrc%\%_sln% "Release|Win32"
175If errorlevel 1 (
176  Set _msg_error=Fallo en vcbuild con la solucion %_sln%
177  Goto ERROR
178)
179Goto RET
180
181:CHECK_VARS
182For %%v in %_vars% do (
183  If Not defined %%v (
184    Echo La variable %%v debe estar definida para compilar %_mod%
185    If Not Defined _msg_extra Goto END
186    If "%_msg_extra%"=="" Goto END
187    Echo %_msg_extra%
188    Pause
189    Goto END
190  )
191)
192Goto RET
193
194:BEGIN
195
196Rem Compilacion de TOL
197Set _mod=tol
198Set _sln=gnutol.sln
199Set _ret=RET_TOLCC
200Goto COMPILE
201:RET_TOLCC
202
203Rem Compilacion de TOLTCL
204Rem Verifico que las variable de entorno de TOLTCL esten definidas
205Set _vars=(TCL_INCLUDE TCL_LIB)
206Set _msg_extra=TCL_INCLUDE debe apuntar a los include de Tcl. TCL_LIB debe apuntar a las librerias de Tcl.
207Set _ret=RET_VARTT
208Goto CHECK_VARS
209:RET_VARTT
210Set _mod=toltcl
211Set _sln=toltcl.sln
212Set _ret=RET_TTCC
213Goto COMPILE
214:RET_TTCC
215
216Rem Compilacion de VBTOL
217If "%_jup%"=="1" Goto RET_VBCC
218Set _mod=vbtol
219Set _sln=vbtol.sln
220Set _ret=RET_VBCC
221Goto COMPILE
222:RET_VBCC
223
224Rem Compilacion de TOLSH
225If "%_jup%"=="1" Goto RET_TSHCC
226PushD ..\..\tolsh
227call build
228xcopy /F /Y tolsh.exe !ATOLDIR!
229PopD
230:RET_TSHCC
231
232If "%_jup%"=="1" Goto END
233
234Rem Copio scripts TOL y TCL hacia ActiveTOL
235If Not Exist ..\ActiveTOL\nul (
236  Echo Directorio ActiveTOL no existente. No se copiaran scripts.
237  Pause
238  Goto END
239)
240
241Rem Copia de stdlib
242Set _dir_src=..\..\tol\stdlib
243Set _dir_dest=..\ActiveTOL\bin\stdlib
244Set _ret=RET_CPTL
245Goto UP_SCRIPTS
246:RET_CPTL
247Rem copiamos pkgIndex.tcl de toltcl
248xcopy ..\..\toltcl\pkgIndex.tcl ..\ActiveTOL\lib\toltcl\ /F /Y /I
249xcopy ..\..\toltcl\library\toltcl.tcl ..\ActiveTOL\lib\toltcl\ /F /Y /I
250If errorlevel 1 (
251  Set _msg_error=Error copiando toltcl\pkgIndex.tcl hacia ActiveTOL
252  Goto ERROR
253)
254
255Rem Copia de scripts tcl: autoscroll, byswidget, markupparser, markupviewer,
256Rem mimetex, mkWidgets1.3 ndbmanager, notebookdb, renderpane, rmtps_client,
257Rem toltk, trycatch, wtree
258
259For %%x in (autoscroll byswidget markupparser markupviewer mimetex mkWidgets1.3 nbdbmanager notebookdb renderpane toltk trycatch wtree) do (
260  Set _dir_src=..\..\tolbase\lib\%%x
261  Set _dir_dest=..\ActiveTOL\lib\%%x
262
263  If Exist !_dir_dest!\nul (
264    Echo Borrando scripts antiguos de !_dir_dest!
265    Rmdir /S /Q !_dir_dest%!
266  )
267  Echo Copiando scripts nuevos de !_dir_src! a !_dir_dest!
268  xcopy !_dir_src! !_dir_dest! /S /F /Y /I /EXCLUDE:exclude.lst
269  If errorlevel 1  (
270    Set _msg_error=Error copiando !_dir_src! hacia !_dir_dest!
271    Goto ERROR
272  )
273)
274
275Rem Recupero ficheros perdidos por cualquier causa
276If Not Exist ..\ActiveTOL\bin\tol.exe (
277  Echo Recuperando ejecutable perdido ..\ActiveTOL\bin\tol.exe
278  copy ..\..\tol\%winSrc%\release\tol.exe ..\ActiveTOL\bin\tol.exe
279)
280If Not Exist ..\ActiveTOL\bin\tol.dll (
281  Echo Recuperando librería perdida ..\ActiveTOL\bin\tol.dll
282  copy ..\..\tol\%winSrc%\release\tol.dll ..\ActiveTOL\bin\tol.dll
283)
284If Not Exist ..\ActiveTOL\bin\tolodbc*.dll (
285  Echo Recuperando librería perdida ..\ActiveTOL\bin\tolodbc*.dll
286  copy ..\..\tol\%winSrc%\libtolodbc\Release\*.dll ..\ActiveTOL\bin
287) 
288If Not Exist ..\ActiveTOL\bin\tolmysql*.dll (
289  Echo Recuperando librería perdida ..\ActiveTOL\bin\tolmysql*.dll
290  copy ..\..\tol\%winSrc%\libtolmysql\Release\*.dll ..\ActiveTOL\bin
291) 
292If Not Exist ..\ActiveTOL\bin\tolpgsql*.dll (
293  Echo Recuperando librería perdida ..\ActiveTOL\bin\tolpgsql*.dll
294  copy ..\..\tol\%winSrc%\libtolpgsql\Release\*.dll ..\ActiveTOL\bin
295) 
296If Not Exist ..\ActiveTOL\lib\toltcl\toltcl.dll (
297  Echo Recuperando librería perdida ..\ActiveTOL\lib\toltcl\toltcl.dll
298  copy ..\..\toltcl\%winSrc%\Release\toltcl.dll ..\ActiveTOL\lib\toltcl\toltcl.dll
299)
300If Not Exist ..\ActiveTOL\bin\vbtol.dll (
301  Echo Recuperando librería perdida ..\ActiveTOL\bin\vbtol.dll
302  copy ..\..\vbtol\%winSrc%\Release\vbtol.dll ..\ActiveTOL\bin\vbtol.dll
303)
304
305Rem descargo paquetes que se distriburan por omision con TOL
306Rem Real TolPackage::Client::_.DefaultFetch(?);
307..\ActiveTOL\bin\tolsh.exe -c "TolPackage::Client::_.DefaultFetch(?)"
308
309Rem Ejecuto los tests si me lo han pedido
310:DO_TESTS
311If "%_dodist%"=="1" (
312  If "%_dotests%"=="0" (
313    Echo "Forzando los test de tol debido a que se ha solicitado /dist"
314    Set _dotests=1
315  )
316)
317
318If "%_dotests%"=="1" (
319  If Exist ..\ActiveTOL\bin\tol.exe (
320    If Not Exist test_status (
321      Md test_status
322    ) Else (
323      Del /Q test_status\*.*
324    )
325    Set _tst_cd=!CD!\test_status
326    PushD ..\ActiveTOL\bin
327    Echo Ejecutando Tol standard tests ...
328        echo %CD%\\test_status\
329       
330    tol.exe -v -c"Text DupTestIndicatorPath=\"%CD%\\test_status\"" "..\\..\\..\\tol_tests\\tol\\_tolTester.tol">!_tst_cd!\init.log
331    PopD
332    If Exist test_status\FAIL.txt (
333      Set test_status=FAIL
334      Set tdt_subject="ERROR ejecutando TOL_TESTS"
335      Set tdt_body="La ejecucion de TOL_TESTS genero el archivo de estado FAIL.txt. No se ha actualizado Tolbase en %_url_bin_%."
336      Set tdt_attach=test_status\FAIL.txt
337    ) Else If Exist test_status\WARNING.txt (
338      Set test_status=WARNING
339      Set tdt_subject="Version %_branchid% actualizada, WARNING ejecutando TOL_TESTS"
340      Set tdt_body=test_status\BODY.txt
341      Set tdt_attach=test_status\WARNING.txt
342    ) Else If Exist test_status\OK.txt (
343      Set test_status=OK
344      Set tdt_subject="Version %_branchid% actualizada, OK ejecutando TOL_TESTS"
345      Set tdt_body=test_status\BODY.txt
346      Set tdt_attach=test_status\OK.txt
347    ) Else (
348      Set test_status=FAIL
349      Set tdt_subject="ERROR ejecutando TOL_TEST"
350      Echo TOL_TEST no genero archivo de estado, verifique manualmente /tests>>%_fbody%
351      Echo.>>%_fbody%
352      Echo COMPUTERNAME  = %COMPUTERNAME%>>%_fbody%
353      Echo USERNAME      = %USERNAME%>>%_fbody%
354      Echo BRANCHID      = ""RAMA SVN"
355      Echo.>>%_fbody%
356      Echo Se ha adjuntado el log de inicializacion de TOL.>>%_fbody%
357      Set tdt_body=test_status\BODY.txt
358      Set tdt_attach=test_status\init.log
359    )
360  ) Else (
361    Set _msg_error=No se encuentra ..ºActiveTOL\bin\tol.exe necesario para ejecutar los tests de TOL
362    Goto ERROR
363  )
364)
365If "%test_status%"=="FAIL" (
366  Echo TOL_TESTS finalizo con errores, chequee %CD%\test_status
367  Goto SENDMAIL
368)
369
370
371Rem empaco la distribucion de tolbase si me lo han pedido
372If "%_dodist%"=="1" (
373  If Not Exist ..\NSIS\Tolbase*.exe (
374    Echo ..\NSIS\Tolbase*.exe no existe
375    If Not "%_pnsis%"=="1" (
376      Echo Habilitando /pnsis para poder hacer /dist
377      Set _pnsis=1
378    )
379  )
380)
381Set _cwd=%CD%
382If "%_pnsis%"=="1" (
383
384  Echo Generando el archivo de creación del instalador de tolbase ...
385  ..\ActiveTOL\bin\tol -v ..\NSIS\Tolbase.nsi.generate.tol
386  If Not Exist ..\NSIS\Tolbase.nsi (
387    Set _msg_error=El empaquetado de tolbase ..ºNSIS\Tolbase.nsi no existe.
388    Goto ERROR
389  )
390  If Exist ..\NSIS\Tolbase*.exe (
391    Del /Q ..\NSIS\Tolbase*.exe
392  )
393  Echo Creando instalador de tolbase ...
394  makensis /V2 /X"SetCompressor /FINAL /SOLID lzma" ..\NSIS\Tolbase.nsi
395  If Exist ..\NSIS\Tolbase*.exe (
396    Echo El instalador de Tolbase ha sido creado en "%_cwd%\..\NSIS"
397  ) Else (
398    Set _msg_error=No se ha encontrado el resultado de ejecutar makensis
399    Goto ERROR
400  )
401)
402
403:DODIST
404Rem envio el empaquetado hacia www.tol-project.org si se ha pedido
405Echo status es %test_status%
406If "%_dodist%"=="1" (
407  If Exist ..\NSIS\Tolbase*.exe (
408    For %%f In (..\NSIS\Tolbase*.exe) Do (
409      Echo encontrado %%~nxf
410      Set _fbin=%%~nxf
411    )
412    REM echo Creando el tag automatico correspondiente al empaquetado
413    cd ..\NSIS
414    REM ..\ActiveTOL\bin\tol -v create_tag_build.tol
415    REM call create_tag_build.bat
416    REM Echo copiando last_official_tol_release_win.txt hacia www.tol-project.org
417    REM ..\ActiveTOL\bin\tol -v -c"Text WriteFile(\"last_official_tol_release_win.txt\",Version);"
418    REM pscp last_official_tol_release_win.txt toldevel@tolp.localbayes.es:.
419    Echo copiando Tolbase hacia www.tol-project.org
420    pscp Tolbase*.exe toldevel@tolp.localbayes.es:/var/www/packages/win32/.
421    If "%_branchid%"=="REMtrunkREM" (
422      Echo copiando tolbase-%_versionNumber%-setup.exe como tolbase-cvstrunk-setup.exe en www.tol-project.org
423      plink tdt@cvs.tol-project.org "cp /home/bayes/pub/bin/win/tolbase-%_versionNumber%-setup.exe /home/bayes/pub/bin/win/tolbase-cvstrunk-setup.exe"
424    )
425    REM Echo Moviendo el empaquetado a la carpeta de almacenamiento historico
426    REM ..\ActiveTOL\bin\tol -v store_history.tol
427    cd..
428        GOTO END
429    REM Echo Nueva version %_branchid% disponible en %_url_bin_%/!_fbin!>test_status\BODY.txt
430    Echo.>>%_fbody%
431    Echo El resultado de tol_tests esta disponible en el archivo adjunto.>>%_fbody%
432    Echo.>>%_fbody%
433  ) Else (
434    Echo No se puede enviar Tolbase hacia www.tol-project.exe pues no existe en NSIS
435    Set _msg_error=Utilice /pnsis para construirlo
436    Goto ERROR
437  ) 
438) Else (
439  Goto END
440)
441
442GOTO END
443
444:MAILTDT
445If Not Defined _lastup (
446  Echo.>>%_fbody%
447  Echo Variable interna _lastup con la fecha de la ultima actualizacion no esta definida.>>%_fbody%
448  Echo No se podra generar el reporte de cambios.>>%_fbody%
449  Echo Verifique .cvsopts.bat>>%_fbody%
450  Goto SENDMAIL
451)
452Echo Los cambios desde la fecha %_lastup% son los siguientes:>>%_fbody%
453Rem Log de TOL
454Set _mod=tol
455Set _ret=RET_TOLLOG
456Goto CVS_GENLOG
457:RET_TOLLOG
458Rem Log de TOLTCL
459Set _mod=toltcl
460Set _ret=RET_TTLOG
461Goto CVS_GENLOG
462:RET_TTLOG
463Rem Log de VBTOL
464Set _mod=vbtol
465Set _ret=RET_VBLOG
466Goto CVS_GENLOG
467:RET_VBLOG
468Rem Log de TOLBASE
469Set _mod=tolbase
470Set _ret=RET_TBLOG
471Goto CVS_GENLOG
472:RET_TBLOG
473Rem Log de TOL_TESTS
474Set _mod=tol_tests
475Set _ret=RET_TTSTLOG
476Goto CVS_GENLOG
477:RET_TTSTLOG
478Rem Actualizo la fecha de ultima actualizacion exitosa
479Echo Set _lastup=%DATE:~6,4%-%DATE:~3,2%-%DATE:~0,2%>>.cvsopts.bat
480
481:SENDMAIL
482mailtdt %tdt_subject% %tdt_body% %tdt_attach%
483:END
484Rem Limpia variables d entorno
485EndLocal
Note: See TracBrowser for help on using the repository browser.