Leaked source code of windows server 2003
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.

151 lines
4.8 KiB

  1. @REM -----------------------------------------------------------------
  2. @REM
  3. @REM WinfuseSFCGen.cmd - SXSCore
  4. @REM Generates catalogs for signed assemblies, updates manifest file
  5. @REM member hashes, and validates that everything was built properly.
  6. @REM
  7. @REM Copyright (c) Microsoft Corporation. All rights reserved.
  8. @REM
  9. @REM -----------------------------------------------------------------
  10. @if defined _CPCMAGIC goto CPCBegin
  11. @perl -x "%~f0" %*
  12. @goto :EOF
  13. #!perl
  14. use strict;
  15. use lib $ENV{RAZZLETOOLPATH} . "\\PostBuildScripts";
  16. use lib $ENV{RAZZLETOOLPATH};
  17. use PbuildEnv;
  18. use ParseArgs;
  19. sub Usage { print<<USAGE; exit(1) }
  20. WinFuseSFCGen [-?] [-hashes:yes] [-cdfs:yes] [-verbose:yes]
  21. Twiddles Side-by-side assemblies to create .cdf files, add SHA hashes of member files,
  22. and any other last-second junk that has to happen to make SxS work right.
  23. -? this message
  24. -hashes injects hashes into manifests
  25. -cdfs sets the CDF logging depot
  26. -verbose turns on verbose operation
  27. USAGE
  28. parseargs('?' => \&Usage,
  29. 'cdfs:' => \$ENV{CDFS},
  30. 'hashes:' => \$ENV{HASHES},
  31. 'verbose:' => \$ENV{VERBOSE},
  32. 'compress:' => \$ENV{SXSCOMPRESS} );
  33. # *** TEMPLATE CODE ***
  34. $ENV{"_CPCMAGIC"}++;exit(system($0)>>8);
  35. __END__
  36. @:CPCBegin
  37. @set _CPCMAGIC=
  38. @setlocal ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
  39. @if not defined DEBUG echo off
  40. @REM *** CMD SCRIPT BELOW ***
  41. set makecatcmd=makecat
  42. set asmsroot=%_NtPostBld%\asms\
  43. set cdfoutput=%tmp%\winfusesfc-cdfs.log
  44. if exist %cdfoutput% del /f /q %cdfoutput%
  45. set cdfoutputlog=%tmp%\winfuse-cdfprocesslog
  46. set buildtoolparams=
  47. if /i "%CDFS%" EQU "yes" set buildtoolparams=%buildtoolparams% -makecdfs
  48. if /i "%HASHES%" EQU "yes" set buildtoolparams=%buildtoolparams% -hashupdate
  49. if /i "%VERBOSE%" EQU "yes" set buildtoolparams=%buildtoolparams% -verbose
  50. set SXS_BINPLACE_LOG=%_NtPostBld%\build_logs\binplace*.log-sxs
  51. set SXS_BINPLACE_FINAL_LOG=%_NtPostBld%\build_logs\sxs-binplaced-assemblies.log
  52. set toolpath=
  53. REM set toolpath=g:\nt\base\win32\fusion\tools\buildtool\obj\i386\
  54. REM -------
  55. REM Generate the overall log of all the legal sxs assemblies that were
  56. REM either built or copied from the buildlab into
  57. REM %_NtPostBld%\build_logs\sxs-binplaced-assemblies.log
  58. REM
  59. REM We'll use this file as the one that we run the buildtool over, and
  60. REM it'll act as the master list of assemblies that should be on the
  61. REM release share after the buildtool step.
  62. REM -------
  63. if not exist %SXS_BINPLACE_LOG% (
  64. call errmsg.cmd "You don't have a %SXS_BINPLACE_LOG%, can't %~f0"
  65. goto :EOF
  66. )
  67. REM -------
  68. REM Now call off to the buildtool to do whatever it wants over the binplace log
  69. REM that was generated.
  70. REM -------
  71. call logmsg.cmd "Processing %SXS_BINPLACE_FINAL_LOG% for side-by-side assemblies"
  72. call ExecuteCmd.cmd "%toolpath%mt.exe -asmsroot %_NTPOSTBLD% -binplacelog %SXS_BINPLACE_FINAL_LOG% %buildtoolparams% -cdfpath %cdfoutput%"
  73. if exist %cdfoutput% (
  74. call logmsg.cmd "Generating catalogs over cdf files created"
  75. for /f %%f in (%cdfoutput%) do (
  76. if not "%%f" == "" (
  77. call logmsg.cmd "Creating catalog %%f
  78. pushd %%~dpf
  79. call ExecuteCmd.cmd "%makecatcmd% %%f > %cdfoutputlog%"
  80. for %%q in (%%~dpnf) do (
  81. call ExecuteCmd.cmd "ntsign.cmd %%~dpnq.cat > %cdfoutputlog%"
  82. )
  83. del %%f
  84. popd
  85. )
  86. )
  87. ) else (
  88. call logmsg.cmd "No catalogs generated in this pass - something may be wrong."
  89. )
  90. call logmsg.cmd "Nuking intermediate files %cdfoutput% and %cdfoutputlog%"
  91. if exist %cdfoutput% del /f /q %cdfoutput% > nul
  92. if exist %cdfoutputlog% del /f /q %cdfoutputlog% > nul
  93. REM -------
  94. REM Turn around and have the buildtool validate that every catalog/manifest that
  95. REM is present in the buildlogs actually was signed, and that every manifest
  96. REM in the staging area %_ntpostbld%\asms is present in the binplace log and
  97. REM that it has a catalog next to it. Paranoia here is warranted, since we
  98. REM now require that assemblies installed have catalogs next to them during
  99. REM OS-setup.
  100. REM -------
  101. REM
  102. REM -- First check to make sure all the manifests have catalogs next to them.
  103. REM
  104. set FoundAssemblies=
  105. set OkAssemblies=
  106. for /f %%f in ('dir /s /b %asmsroot%\*.man') do (
  107. set FoundAssemblies=%FoundAssemblies%.
  108. if exist %%~dpnf.cat (
  109. set OkAssemblies=%OkAssemblies%.
  110. ) else (
  111. call errmsg.cmd "%%f - missing corresponding %%~dpnf.cat - Installation of this build will FAIL!"
  112. )
  113. )
  114. if "%foundassemblies%"=="" (
  115. call errmsg.cmd "You haven't generated at least one assembly, WinFuse knows there must be at least one. Install (and winnt32) will FAIL!"
  116. goto :Eof
  117. )
  118. if not "%foundassemblies%"=="%okassemblies%" (
  119. goto :Eof
  120. )
  121. if /i "%SXSCOMPRESS%" EQU "Yes" (
  122. call sxs_compress.cmd %asmsroot%
  123. )
  124. goto :Eof