Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
2.1 KiB

  1. @echo off
  2. REM first, the usual cmd script headers
  3. if defined verbose echo on
  4. setlocal EnableDelayedExpansion
  5. REM assume %BuildName% = 2197.x86fre.main.000107-1856
  6. REM assume %CopyDir% = Symbols.pri or whatever
  7. REM assume %BuildShare% = \\ntbldtest01\release\2197.x86fre.main.000107-1856
  8. REM assume %ReleasePath% = D:\release\usa\2197.x86fre.main.000107-1856
  9. REM read in the command line
  10. REM the definition of SCRIPT_NAME is for the logmsg.cmd logging function
  11. REM as is LOGFILE
  12. set Language=%1
  13. set BuildName=%2
  14. set CopyDir=%3
  15. set BuildShare=%4
  16. set ReleasePath=%5
  17. set LOGFILE=%6
  18. set SCRIPT_NAME=%0.%CopyDir%
  19. echo Language = %Language%
  20. echo BuildName = %BuildName%
  21. echo CopyDir = %CopyDir%
  22. echo BuildShare = %BuildShare%
  23. echo ReleasePath = %ReleasePath%
  24. echo LOGFILE = %LOGFILE%
  25. echo SCRIPT_NAME = %SCRIPT_NAME%
  26. REM wait for master script to start waiting
  27. perl cmdevt.pl -h %Language%.%BuildName%.%CopyDir%
  28. call logmsg.cmd "Beginning ..."
  29. REM set our xcopy options ... if we're copying the flat share,
  30. REM we do not want a recursive copy !
  31. set XCopyOpts=dehikr
  32. if /i "%CopyDir%" == "." set XCopyOpts=dhikr
  33. REM make the first pass with a /c (no exit codes returned by xcopy)
  34. xcopy /c%XCopyOpts% %BuildShare%\%CopyDir% %ReleasePath%\%CopyDir%
  35. REM now loop up to twice without the /c to see if there were errors
  36. REM initialize our counter and exit code
  37. set /a Counter=0
  38. set /a ExitCode=0
  39. :StartCopyLoop
  40. REM increment the counter
  41. set /a Counter=%Counter% + 1
  42. REM perform the copy
  43. call logmsg.cmd "xcopy from %BuildShare%\%CopyDir% to %ReleasePath%\%CopyDir%"
  44. xcopy /%XCopyOpts% %BuildShare%\%CopyDir% %ReleasePath%\%CopyDir% 2>>%LOGFILE%
  45. set LastErrorLevel=!ErrorLevel!
  46. echo Last Error Level was %LastErrorLevel%
  47. if "%LastErrorLevel%" == "0" goto :Finished
  48. REM if not, loop back a second time
  49. if "%Counter%" LSS "2" (
  50. call logmsg.cmd "WARNING: xcopy of %CopyDir% failed, retrying ..."
  51. goto :StartCopyLoop
  52. )
  53. REM if we're already on the second pass, exit with an error.
  54. set /a ExitCode=1
  55. call errmsg.cmd "xcopy of %CopyDir% failed, please investigate or rerun."
  56. :Finished
  57. perl cmdevt.pl -s %Language%.%BuildName%.%CopyDir%
  58. call logmsg.cmd "Finished."
  59. seterror.exe "%ExitCode%"
  60. endlocal