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.

603 lines
18 KiB

  1. @echo off
  2. REM ------------------------------------------------------------------
  3. REM
  4. REM spupd.cmd - JeremyD
  5. REM Creates the update directory structure.
  6. REM
  7. REM Copyright (c) Microsoft Corporation. All rights reserved.
  8. REM
  9. REM ------------------------------------------------------------------
  10. perl -x "%~f0" %*
  11. goto :EOF
  12. #!perl
  13. use strict;
  14. use lib $ENV{RAZZLETOOLPATH} . "\\postbuildscripts";
  15. use lib $ENV{RAZZLETOOLPATH};
  16. use PbuildEnv;
  17. use ParseArgs;
  18. use File::Basename;
  19. use File::Copy;
  20. use File::Path;
  21. use Logmsg;
  22. use ParseTable;
  23. sub Usage { print<<USAGE; exit(1) }
  24. spupd [-l <language>] [-prs] [-cat] [-qfe <QFE number>]
  25. -l Specify a language to do
  26. -prs Package using PRS signed catalogs
  27. -cat Generate catalog, but do not package
  28. -qfe Make a QFE package
  29. Creates the update directory structure.
  30. USAGE
  31. sub Dependencies {
  32. if ( !open DEPEND, ">>$ENV{_NTPOSTBLD}\\..\\build_logs\\dependencies.txt" ) {
  33. errmsg("Unable to open dependency list file.");
  34. die;
  35. }
  36. print DEPEND<<DEPENDENCIES;
  37. \[$0\]
  38. IF { ... }
  39. ADD {
  40. update.inf
  41. idw\\srvpack\\update.exe
  42. idw\\srvpack\\spmsg.dll
  43. idw\\srvpack\\spcustom.dll
  44. idw\\srvpack\\spuninst.exe
  45. idw\\srvpack\\spmap.txt
  46. idw\\srvpack\\update.msi
  47. testroot.cer
  48. eulas\\standalone\\upd_std.txt
  49. sp1.cat
  50. }
  51. IF { dosnet.inf }
  52. ADD { realsign\\dosnet.inf }
  53. IF { layout.inf }
  54. ADD { realsign\\layout.inf }
  55. IF { txtsetup.sif }
  56. ADD { realsign\\txtsetup.sif }
  57. DEPENDENCIES
  58. close DEPEND;
  59. exit;
  60. }
  61. my $qfe;
  62. my $package_only;
  63. my $cat_only;
  64. parseargs('?' => \&Usage,
  65. 'prs' => \$package_only,
  66. 'cat' => \$cat_only,
  67. 'plan' => \&Dependencies,
  68. 'qfe:' => \$qfe);
  69. if ( -f "$ENV{_NTPOSTBLD}\\..\\build_logs\\skip.txt" ) {
  70. if ( !open SKIP, "$ENV{_NTPOSTBLD}\\..\\build_logs\\skip.txt" ) {
  71. errmsg("Unable to open skip list file.");
  72. die;
  73. }
  74. while (<SKIP>) {
  75. chomp;
  76. exit if lc$_ eq lc$0;
  77. }
  78. close SKIP;
  79. }
  80. my $sp = $qfe ? "Q$qfe":'SP1';
  81. my $map_file = "$ENV{_NTPOSTBLD}\\idw\\srvpack\\spmap.txt";
  82. my $list_file = "$ENV{_NTPOSTBLD}\\idw\\srvpack\\filelist.txt";
  83. my $comp_file = "$ENV{RAZZLETOOLPATH}\\sp\\data\\goldfiles\\$ENV{LANG}\\$ENV{_BUILDARCH}$ENV{_BUILDTYPE}\\dirlist.txt";
  84. my $dst_comp = "$ENV{_NTPOSTBLD}\\upd";
  85. my $dst_uncomp = "$ENV{_NTPOSTBLD}\\updtemp_uncomp";
  86. my $spcd = "$ENV{_NTPOSTBLD}\\spcd";
  87. my %infdirs = (
  88. "ip\\" => "",
  89. "ic\\" => "perinf\\",
  90. "is\\" => "srvinf\\",
  91. "ia\\" => "entinf\\",
  92. "id\\" => "dtsinf\\",
  93. "il\\" => "sbsinf\\",
  94. "ib\\" => "blainf\\",
  95. "lang\\"=> "lang\\",
  96. );
  97. my %lang_data;
  98. parse_table_file("$ENV{RAZZLETOOLPATH}\\codes.txt", \%lang_data);
  99. my @skus = ("pro");
  100. push @skus, "per" if defined $ENV{386};
  101. my $share;
  102. my $PrsSignedFlag;
  103. undef $PrsSignedFlag;
  104. if (defined $ENV{386}){
  105. $share="i386";
  106. }
  107. else {
  108. $share="ia64";
  109. }
  110. # Get a list of source paths from spmap.
  111. logmsg("creating update directory strucutre");
  112. my %spmap = ();
  113. open MAP, $map_file or die "unable to open map file: $!";
  114. while (<MAP>) {
  115. $_ = lc$_;
  116. my ($src, $dst) = /(\S+)\s+(\S+)/;
  117. my ($spath, $sfile) = $src=~/^(.*\\)?([^\\]*)$/;
  118. my ($dpath, $dfile) = $dst=~/^(.*\\)?([^\\]*)$/;
  119. $dst = "$dpath$dfile";
  120. if ($dfile =~ /\_$/) {
  121. $dfile =~ s/\_$/substr $sfile, -1/e;
  122. }
  123. my $key = "$dpath$dfile";
  124. $spmap{$key} = [ () ] if !exists $spmap{$key};
  125. push @{ $spmap{$key} }, [ ($src, $dst) ];
  126. }
  127. close MAP;
  128. # Figure out which files are compressed in the slipstream cd image.
  129. my %comp = ();
  130. open COMP, $comp_file or die "unable to open comp file: $!";
  131. while (<COMP>) {
  132. chomp;
  133. $comp{lc$_}++;
  134. }
  135. # Find symbols for all files (qfe only).
  136. if ($qfe) {
  137. load_symbol_paths("$ENV{_NTPOSTBLD}\\symbolcd\\symupd.txt");
  138. }
  139. #Deleting the asms dir. Else it leads to duplicate files compressed and uncompressed in xpsp1.exe.
  140. sys("rd /s /q $dst_comp\\$share\\asms") if (-d "$dst_comp\\$share\\asms");
  141. # Copy over all of the needed files.
  142. open LIST, $list_file or die "list file open failed: $!";
  143. while (<LIST>) {
  144. # Figure out the source and destination paths for each file.
  145. chomp;
  146. next if /^wow\\/i;
  147. my $updpath = lc $_;
  148. my $binpath;
  149. my ($path, $file) = $updpath=~/^(.*\\)?([^\\]*)$/;
  150. if ( exists $spmap{$updpath} ) {
  151. foreach my $copy ( @{ $spmap{$updpath} } ) {
  152. my $src = $copy->[0];
  153. my $dst = $copy->[1];
  154. if (!-e "$ENV{_NTPOSTBLD}\\$src") {
  155. wrnmsg("$ENV{_NTPOSTBLD}\\$src missing.");
  156. next;
  157. }
  158. my $upddir = dirname($dst);
  159. my $binname = basename($dst);
  160. if ($dst =~ /\_$/) {
  161. $binname =~ s/\_$/substr $src, -1/e;
  162. }
  163. if (!$qfe) {
  164. mkpath "$dst_comp\\$share\\$upddir";
  165. if ( $dst =~ /\_$/ ) { copyComp($src, $dst); }
  166. else { copyUncomp($src, $dst); }
  167. }
  168. mkpath "$dst_uncomp\\$share\\$upddir";
  169. logmsg("uncomp upd: copy $ENV{_NTPOSTBLD}\\$src $dst_uncomp\\$share\\$upddir\\$binname");
  170. copy("$ENV{_NTPOSTBLD}\\$src", "$dst_uncomp\\$share\\$upddir\\$binname");
  171. copy_symbol($src, "$upddir\\$binname") if $qfe;
  172. }
  173. } else {
  174. $binpath = $infdirs{$path} . $file;
  175. $binpath = $file if !-e "$ENV{_NTPOSTBLD}\\$binpath";
  176. if (!-e "$ENV{_NTPOSTBLD}\\$binpath") {
  177. wrnmsg("$ENV{_NTPOSTBLD}\\$binpath missing");
  178. next;
  179. }
  180. # Copy or compress to all of the necessary places.
  181. my $upddir = dirname($updpath);
  182. my $binname = basename($binpath);
  183. my $cname = compName($updpath);
  184. my $ucmfile = basename($updpath);
  185. $ucmfile = "lang\\$ucmfile" if $updpath =~ /^lang\\/i;
  186. my $cmpfile = compName($ucmfile);
  187. if (!$qfe) {
  188. mkpath "$dst_comp\\$share\\$upddir";
  189. copyComp($binpath, $cname) if exists $comp{$cmpfile};
  190. copyUncomp($binpath, $updpath) if exists $comp{$ucmfile};
  191. if ( !exists $comp{$cmpfile} and !exists $comp{$ucmfile} ) {
  192. if ( $updpath =~ /\\/ and $updpath !~ /\.cab$/i ) {
  193. copyComp($binpath, $cname);
  194. } else {
  195. copyUncomp($binpath, $updpath);
  196. }
  197. }
  198. }
  199. mkpath "$dst_uncomp\\$share\\$upddir";
  200. logmsg("uncomp upd: copy $ENV{_NTPOSTBLD}\\$binpath $dst_uncomp\\$share\\$upddir\\$binname");
  201. copy("$ENV{_NTPOSTBLD}\\$binpath", "$dst_uncomp\\$share\\$upddir\\$binname");
  202. copy_symbol($binpath, "$upddir\\$binname") if $qfe;
  203. }
  204. }
  205. close LIST;
  206. if ($share =~ /ia64/i) {
  207. sys("compdir /enustrd $ENV{_NTPOSTBLD}\\wowbins $dst_uncomp\\$share\\wow");
  208. sys("compdir /enustrd $ENV{_NTPOSTBLD}\\wowbins\\lang $dst_uncomp\\$share\\wow\\lang") if (-d "$ENV{_NTPOSTBLD}\\wowbins\\lang");
  209. if (!$qfe) {
  210. mkpath "$dst_comp\\$share\\wow\\lang";
  211. sys("compress -r -d -zx21 -s $dst_uncomp\\$share\\wow\\*.* $dst_comp\\$share\\wow");
  212. sys("compress -r -d -zx21 -s $dst_uncomp\\$share\\wow\\lang\\*.* $dst_comp\\$share\\wow\\lang");
  213. } else {
  214. sys("compdir /enustd $ENV{_NTPOSTBLD}\\wowbins\\symbols $dst_uncomp\\symbols\\wow6432") if (-d "$ENV{_NTPOSTBLD}\\wowbins\\symbols");
  215. sys("compdir /enustd $ENV{_NTPOSTBLD}\\wowbins\\symbols.pri $dst_uncomp\\symbols.pri\\wow6432") if (-d "$ENV{_NTPOSTBLD}\\wowbins\\symbols.pri");
  216. }
  217. }
  218. if ( IsPrsSigned() ) {
  219. if ( !$qfe ) {
  220. sys("md $dst_comp\\$share\\new") if !-d "$dst_comp\\$share\\new";
  221. copy("$ENV{_NTPOSTBLD}\\testroot.cer", "$dst_comp\\$share\\new\\testroot.cer");
  222. sys("md $dst_uncomp\\$share\\new") if !-d "$dst_uncomp\\$share\\new";
  223. copy("$ENV{_NTPOSTBLD}\\testroot.cer", "$dst_uncomp\\$share\\new\\testroot.cer");
  224. copy("$ENV{_NTPOSTBLD}\\testroot.cer", "$dst_comp\\$share\\testroot.cer") if !$qfe;
  225. }
  226. copy("$ENV{_NTPOSTBLD}\\testroot.cer", "$dst_uncomp\\$share\\testroot.cer");
  227. } else {
  228. sys ("del $dst_comp\\$share\\new\\testroot.cer") if (-e "$dst_comp\\$share\\new\\testroot.cer" ) ;
  229. sys ("del $dst_comp\\$share\\testroot.cer") if (-e "$dst_comp\\$share\\testroot.cer" ) ;
  230. sys ("del $dst_uncomp\\$share\\new\\testroot.cer") if (-e "$dst_uncomp\\$share\\new\\testroot.cer" ) ;
  231. sys ("del $dst_uncomp\\$share\\testroot.cer") if (-e "$dst_uncomp\\$share\\testroot.cer" ) ;
  232. }
  233. if (!$qfe) {
  234. maketag("$dst_comp\\$share\\cdtag.1");
  235. maketag("$dst_uncomp\\$share\\cdtag.1");
  236. maketag("$dst_comp\\$share\\tagfile.1");
  237. maketag("$dst_uncomp\\$share\\tagfile.1");
  238. maketag("$dst_comp\\$share\\root\\ip\\win51ip.$sp");
  239. maketag("$dst_uncomp\\$share\\root\\ip\\win51ip.$sp");
  240. maketag("$dst_comp\\$share\\root\\ic\\win51ic.$sp");
  241. maketag("$dst_uncomp\\$share\\root\\ic\\win51ic.$sp");
  242. }
  243. mkpath("$dst_comp\\$share\\update") if !$qfe;
  244. mkpath("$dst_uncomp\\$share\\update");
  245. my $update_bin_dir = "$ENV{_NTPOSTBLD}\\idw\\srvpack";
  246. copy("$update_bin_dir\\update.exe", "$dst_uncomp\\$share\\update\\update.exe");
  247. copy("$ENV{_NTPOSTBLD}\\update.inf", "$dst_uncomp\\$share\\update\\update.inf");
  248. copy("$update_bin_dir\\spcustom.dll", "$dst_uncomp\\$share\\update\\spcustom.dll");
  249. copy("$update_bin_dir\\spmsg.dll", "$dst_uncomp\\$share\\spmsg.dll");
  250. copy("$update_bin_dir\\spuninst.exe", "$dst_uncomp\\$share\\spuninst.exe");
  251. if (!$qfe) {
  252. copy("$update_bin_dir\\update.msi", "$dst_uncomp\\$share\\update\\update.msi");
  253. copy("$ENV{_NTPOSTBLD}\\eulas\\standalone\\upd_std.txt", "$dst_uncomp\\$share\\update\\eula.txt");
  254. copy("$update_bin_dir\\update.exe", "$dst_comp\\$share\\update\\update.exe");
  255. copy("$update_bin_dir\\spcustom.dll", "$dst_comp\\$share\\update\\spcustom.dll");
  256. copy("$update_bin_dir\\spmsg.dll", "$dst_comp\\$share\\spmsg.dll");
  257. copy("$update_bin_dir\\spuninst.exe", "$dst_comp\\$share\\spuninst.exe");
  258. copy("$update_bin_dir\\update.msi", "$dst_comp\\$share\\update\\update.msi");
  259. copy("$ENV{_NTPOSTBLD}\\eulas\\standalone\\upd_std.txt", "$dst_comp\\$share\\update\\eula.txt");
  260. copy("$ENV{_NTPOSTBLD}\\update.inf", "$dst_comp\\$share\\update\\update.inf");
  261. } else {
  262. copy("$ENV{RAZZLETOOLPATH}\\sp\\data\\empty.cat", "$dst_uncomp\\$share\\empty.cat");
  263. }
  264. my @uncomp_files;
  265. if (!$package_only) {
  266. @uncomp_files = dirlist("$dst_uncomp\\$share");
  267. push @uncomp_files,"update\\update.inf";
  268. makecdf("$dst_uncomp\\$share", @uncomp_files);
  269. sys("makecat $ENV{_NTPOSTBLD}\\$sp.cdf");
  270. sys("ntsign $ENV{_NTPOSTBLD}\\$sp.CAT");
  271. }
  272. copy("$ENV{_NTPOSTBLD}\\$sp.CAT", "$dst_comp\\$share\\update\\$sp.CAT") if !$qfe;
  273. copy("$ENV{_NTPOSTBLD}\\$sp.CAT", "$dst_uncomp\\$share\\update\\$sp.CAT");
  274. exit if $cat_only;
  275. if ( !system "findstr /bei \\\[sourcedisksfiles\\\] $dst_uncomp\\$share\\update\\update.inf >nul 2>nul" ) {
  276. sys("vertool.exe $dst_uncomp\\$share\\update\\update.inf /out:$ENV{_NTPOSTBLD}\\update.ver /files:$dst_uncomp\\$share");
  277. } else {
  278. sys("echo [SourceFileInfo]> $ENV{_NTPOSTBLD}\\update.ver");
  279. }
  280. copy("$ENV{_NTPOSTBLD}\\update.ver", "$dst_comp\\$share\\update\\update.ver") if !$qfe;
  281. copy("$ENV{_NTPOSTBLD}\\update.ver", "$dst_uncomp\\$share\\update\\update.ver");
  282. if ($qfe) {
  283. sys("rd /s/q $dst_comp") if -d $dst_comp;
  284. sys("move /y $dst_uncomp $dst_comp");
  285. sys("move /y $dst_comp\\symbols $dst_comp\\$share\\symbols") if -d "$dst_comp\\symbols";
  286. }
  287. my $cab;
  288. if (!$qfe) {
  289. $cab = "xp$sp";
  290. } else {
  291. $cab = "$sp";
  292. }
  293. makeddf($cab, "$dst_comp\\$share", dirlist("$dst_comp\\$share"));
  294. sys("makecab /f $ENV{_NTPOSTBLD}\\$cab.ddf");
  295. my $sfxstub = "$ENV{RazzleToolPath}\\x86\\sfxcab.exe";
  296. if (lc $ENV{LANG} ne 'usa') {
  297. $sfxstub = "$ENV{RazzleToolPath}\\x86\\loc\\$ENV{LANG}\\sfxcab.exe";
  298. }
  299. sys("makesfx $ENV{_NTPOSTBLD}\\$cab.cab $ENV{_NTPOSTBLD}\\$cab.exe /RUN /Stub $sfxstub");
  300. if (!$qfe) {
  301. # continue to place these files in upd for now to keep automated installations working
  302. copy("$ENV{_NTPOSTBLD}\\testroot.cer", "$dst_comp\\testroot.cer");
  303. copy("$ENV{RAZZLETOOLPATH}\\$ENV{_BUILDARCH}\\certmgr.exe", "$dst_comp\\certmgr.exe");
  304. #copy("$ENV{RAZZLETOOLPATH}\\sp\\xpspinst.cmd.txt", "$dst_comp\\xpspinst.cmd");
  305. makeXpspInst("$dst_comp\\xpspinst.cmd");
  306. ## Compressing the assemblies for slipstream case only. As update will be using older version of sxs.dll
  307. ## it cannot install the compress assemblies.
  308. compressAssemblies("$dst_comp\\$share\\asms");
  309. # done with this temporary directory, remove it to save space
  310. sys("rd /s/q $dst_uncomp");
  311. } else {
  312. sys("move /y $dst_comp\\symbols.pri $dst_comp\\$share\\symbols.pri") if -d "$dst_comp\\symbols.pri";
  313. }
  314. sub dirlist {
  315. my ($root, $dir) = @_;
  316. my $full = $dir ? "$root\\$dir" : $root;
  317. my @return;
  318. opendir DIR, $full or die "$!: $full";
  319. my @stuff = readdir DIR;
  320. closedir DIR;
  321. for my $file (@stuff) {
  322. next if $file =~ /^\.\.?$/;
  323. if (-d "$full\\$file") {
  324. push @return, dirlist($root, ($dir ? "$dir\\$file" : $file));
  325. }
  326. else {
  327. push @return, $dir ? "$dir\\$file" : $file;
  328. }
  329. }
  330. return @return;
  331. }
  332. sub sys {
  333. my $cmd = shift;
  334. logmsg("Running: $cmd");
  335. system($cmd);
  336. if ($?) {
  337. die "ERROR: $cmd ($?)\n";
  338. }
  339. }
  340. sub makecdf {
  341. my $path = shift;
  342. my @files = @_;
  343. open CDF, ">$ENV{_NTPOSTBLD}\\$sp.cdf" or die $!;
  344. print CDF <<HEADER;
  345. [CatalogHeader]
  346. Name=$ENV{_NTPOSTBLD}\\$sp.cat
  347. PublicVersion=0x0000001
  348. EncodingType=0x00010001
  349. CATATTR1=0x10010001:OSAttr:2:5.1
  350. HEADER
  351. if ( $qfe ) {
  352. my $date = "";
  353. my $temp;
  354. $temp = `echo \%DATE\%`;
  355. $temp =~ /\S*\s+(\d\d)\/(\d\d)\/(\d\d\d\d)/;
  356. $date .= "$3$1$2";
  357. $temp = `echo \%TIME\%`;
  358. $temp =~ /(\d\d)\:(\d\d)\:(\d\d)\./;
  359. $date .= "$1$2$3";
  360. print CDF "CATATTR2=0x10010001:SPLevel:2\n";
  361. print CDF "CATATTR3=0x10010001:SPAttr:$date\n";
  362. }
  363. print CDF "\n[CatalogFiles]\n";
  364. for (@files) {
  365. if (!/\.cat$/i){
  366. print CDF "<hash>$path\\$_=$path\\$_\n";
  367. }
  368. }
  369. close CDF;
  370. }
  371. sub makeddf {
  372. my $cab = shift;
  373. my $path = shift;
  374. my @files = @_;
  375. open DDF,">$ENV{_NTPOSTBLD}\\$cab.ddf";
  376. print DDF <<HEADER;
  377. .option explicit
  378. .set DiskDirectoryTemplate=$ENV{_NTPOSTBLD}
  379. .set CabinetName1=$cab.cab
  380. .set SourceDir=$path
  381. .set RptFileName=nul
  382. .set InfFileName=nul
  383. .set MaxDiskSize=999948288
  384. .set Compress=off
  385. .set Cabinet=on
  386. .set CompressionType=LZX
  387. .set CompressionMemory=21
  388. HEADER
  389. my (@compress, @update);
  390. for (@files) {
  391. if (/^update\\/i) {
  392. push @update, $_;
  393. }
  394. elsif (/.*_$/ ) {
  395. print DDF "$_ $_\n";
  396. }
  397. else {
  398. push @compress, $_;
  399. }
  400. }
  401. print DDF ".set Compress=on\n";
  402. for (@compress){
  403. print DDF "$_ $_\n";
  404. }
  405. print DDF ".set DestinationDir=\"update\"\n";
  406. print DDF ".New Folder \n";
  407. for (@update) {
  408. if (/\\update\.exe$/i) {
  409. print DDF qq("$_" /RUN\n);
  410. }
  411. else {
  412. print DDF qq("$_"\n);
  413. }
  414. }
  415. close DDF;
  416. }
  417. sub maketag {
  418. my $tag = shift;
  419. mkpath dirname($tag);
  420. open FILE, ">$tag" or die "can't create tag file $tag: $!";
  421. print FILE "\n";
  422. close FILE;
  423. }
  424. sub compressAssemblies {
  425. my $path = shift;
  426. my @files=dirlist($path);
  427. # Deleting the already compressed dlls and cat files. Else it could lead to a race condn
  428. # where we end up with missing dlls and cat files.
  429. foreach (@files) {
  430. sys( " del $path\\$_") if ( /_$/ ) ;
  431. }
  432. @files=dirlist($path);
  433. foreach (@files) {
  434. if ( !(/\.man$/) ) {
  435. sys ("compress -zx21 -s -r $path\\$_");
  436. sys("del $path\\$_");
  437. }
  438. }
  439. }
  440. sub makeXpspInst {
  441. my $file = shift;
  442. my $flag;
  443. open XPSPINST,">$file";
  444. print XPSPINST "set SP_UPDATE_LOG_CABBUILD=%windir%\\updatedebug.log \n";
  445. if ( IsPrsSigned() ) {
  446. print XPSPINST "%~dp0\\certmgr -add %~dp0\\testroot.cer -r localMachine -s root \n";
  447. }
  448. print XPSPINST "%~dp0\\..\\spcd\\xpsp1.exe %* \n";
  449. close XPSPINST;
  450. }
  451. sub IsPrsSigned {
  452. if ( defined $PrsSignedFlag ) {
  453. return $PrsSignedFlag;
  454. }
  455. return !$package_only if !open LAYOUT,"$ENV{_NTPOSTBLD}\\layout.inf";
  456. my @lines=<LAYOUT>;
  457. close LAYOUT;
  458. $PrsSignedFlag=0;
  459. foreach (@lines) {
  460. if (/^testroot\.cer/) {
  461. $PrsSignedFlag++;
  462. last;
  463. }
  464. }
  465. return $PrsSignedFlag;
  466. }
  467. sub copyComp {
  468. my ($binpath, $dest) = @_;
  469. logmsg("upd: compress -s -d -zx21 $ENV{_NTPOSTBLD}\\$binpath $dst_comp\\$share\\$dest");
  470. system("compress -s -d -zx21 $ENV{_NTPOSTBLD}\\$binpath $dst_comp\\$share\\$dest");
  471. }
  472. sub copyUncomp {
  473. my ($binpath, $updpath) = @_;
  474. logmsg("upd: copy $ENV{_NTPOSTBLD}\\$binpath $dst_comp\\$share\\$updpath");
  475. copy("$ENV{_NTPOSTBLD}\\$binpath", "$dst_comp\\$share\\$updpath");
  476. }
  477. sub compName {
  478. my $file = shift;
  479. return $file if $file =~ /\_$/;
  480. $file = $1 if $file =~ /^(.*\...).$/;
  481. $file .= "." if $file !~ /\...?$/;
  482. $file .= "_";
  483. return $file;
  484. }
  485. {
  486. my %sym;
  487. sub load_symbol_paths {
  488. my $binp_file = shift;
  489. if ( !open BINP, $binp_file ) {
  490. errmsg "open failed $binp_file: $!";
  491. die;
  492. }
  493. while (<BINP>) {
  494. chomp;
  495. my ($bin, $pri, $pub) = split /\,/;
  496. if ($pub or $pri) {
  497. $pub = "" if !$pub;
  498. $pri = "" if !$pri;
  499. $sym{lc $bin} = lc "$pub $pri";
  500. }
  501. }
  502. close BINP;
  503. my $nosym = "$ENV{RAZZLETOOLPATH}\\symdontship.txt";
  504. if ( !open DONTSHIP, $nosym ) {
  505. errmsg "open failed $nosym: $!";
  506. die;
  507. }
  508. while (<DONTSHIP>) {
  509. s/\s*(\;.*)?\s*$//;
  510. my $bin = lc $_;
  511. undef $sym{lc $bin};
  512. }
  513. close DONTSHIP;
  514. }
  515. sub copy_a_symbol {
  516. my ($sym) = @_;
  517. my ($dir,$file) = $sym=~/^(.*\\)?[^\\]*$/;
  518. $dir =~ s/^(.*)(symbols(?:.pri)?\\)/\2\1/i;
  519. $dir =~ s/\\$//;
  520. logmsg("sym upd: copy $ENV{_NTPOSTBLD}\\$sym $dst_uncomp\\$dir\\$file");
  521. sys("md $dst_uncomp\\$dir") if !-d "$dst_uncomp\\$dir";
  522. copy("$ENV{_NTPOSTBLD}\\$sym", "$dst_uncomp\\$dir\\$file");
  523. }
  524. sub copy_symbol {
  525. my ($src, $dst) = @_;
  526. $src = lc $src;
  527. return if !defined $sym{$src};
  528. $src = $sym{$src};
  529. my ($pub, $pri) = split(/ /, $src);
  530. copy_a_symbol($pub) if defined $pub and $pub ne "";
  531. copy_a_symbol($pri) if defined $pri and $pri ne "";
  532. }
  533. }