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.

160 lines
4.8 KiB

  1. REM ------------------------------------------------------------------
  2. REM
  3. REM WinfuseSFCGen.cmd
  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. # *** NEXT FEW LINES ARE TEMPLATE ***
  34. $ENV{"_CPCMAGIC"}++;exit(system($0)>>8);
  35. __END__
  36. :CPCBegin
  37. set _CPCMAGIC=
  38. setlocal ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
  39. REM *** BEGIN YOUR CMD SCRIPT BELOW ***
  40. set makecatcmd=makecat -n
  41. set asmsroot=%_NtPostBld%\asms\
  42. set cdfoutput=%tmp%\winfusesfc-cdfs.log
  43. if exist %cdfoutput% del /f /q %cdfoutput%
  44. set cdfoutputlog=%tmp%\winfuse-cdfprocesslog
  45. set buildtoolparams=
  46. if /i "%CDFS%" EQU "yes" set buildtoolparams=%buildtoolparams% -makecdfs
  47. if /i "%HASHES%" EQU "yes" set buildtoolparams=%buildtoolparams% -hashupdate
  48. if /i "%VERBOSE%" EQU "yes" set buildtoolparams=%buildtoolparams% -verbose
  49. if /i not "%lang%"=="usa" (goto End)
  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 The nice thing about this is that copy is smart about appending stuff into
  69. REM one big file.
  70. REM -------
  71. copy %SXS_BINPLACE_LOG% %SXS_BINPLACE_FINAL_LOG%
  72. REM -------
  73. REM Now call off to the buildtool to do whatever it wants over the binplace log
  74. REM that was generated.
  75. REM -------
  76. call logmsg.cmd "Processing %SXS_BINPLACE_FINAL_LOG% for side-by-side assemblies"
  77. call ExecuteCmd.cmd "%toolpath%fusionbuildtool -asmsroot %_NTTREE% -binplacelog %SXS_BINPLACE_FINAL_LOG% %buildtoolparams% -cdfpath %cdfoutput%"
  78. if exist %cdfoutput% (
  79. call logmsg.cmd "Generating catalogs over cdf files created"
  80. for /f %%f in (%cdfoutput%) do (
  81. if not "%%f" == "" (
  82. call logmsg.cmd "Creating catalog %%f
  83. pushd %%~dpf
  84. call ExecuteCmd.cmd "%makecatcmd% %%f > %cdfoutputlog%"
  85. for %%q in (%%~dpnf) do (
  86. call ExecuteCmd.cmd "ntsign.cmd %%~dpnq.cat > %cdfoutputlog%"
  87. )
  88. del %%f
  89. popd
  90. )
  91. )
  92. ) else (
  93. call logmsg.cmd "No catalogs generated in this pass - something may be wrong."
  94. )
  95. call logmsg.cmd "Nuking intermediate files %cdfoutput% and %cdfoutputlog%"
  96. if exist %cdfoutput% del /f /q %cdfoutput% > nul
  97. if exist %cdfoutputlog% del /f /q %cdfoutputlog% > nul
  98. REM -------
  99. REM Turn around and have the buildtool validate that every catalog/manifest that
  100. REM is present in the buildlogs actually was signed, and that every manifest
  101. REM in the staging area %_ntpostbld%\asms is present in the binplace log and
  102. REM that it has a catalog next to it. Paranoia here is warranted, since we
  103. REM now require that assemblies installed have catalogs next to them during
  104. REM OS-setup.
  105. REM -------
  106. REM
  107. REM -- First check to make sure all the manifests have catalogs next to them.
  108. REM
  109. set FoundAssemblies=
  110. set OkAssemblies=
  111. for /f %%f in ('dir /s /b %asmsroot%\*.man') do (
  112. set FoundAssemblies=%FoundAssemblies%.
  113. if exist %%~dpnf.cat (
  114. set OkAssemblies=%OkAssemblies%.
  115. ) else (
  116. call errmsg.cmd "%%f - missing corresponding %%~dpnf.cat - Installation of this build will FAIL!"
  117. )
  118. )
  119. if "%foundassemblies%"=="" (
  120. call errmsg.cmd "You haven't generated at least one assembly, WinFuse knows there must be at least one. Install (and winnt32) will FAIL!"
  121. goto :Eof
  122. )
  123. if not "%foundassemblies%"=="%okassemblies%" (
  124. goto :Eof
  125. )
  126. if /i "%SXSCOMPRESS%" EQU "Yes" (
  127. call compress-sxs.cmd %asmsroot%
  128. )
  129. goto :Eof