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.

764 lines
22 KiB

  1. #----------------------------------------------------------------//
  2. # Script: copylang.pl
  3. #
  4. # (c) 2000 Microsoft Corporation. All rights reserved.
  5. #
  6. # Purpose: This script copy the files between Source Tree and
  7. # Loc Tree listed in $ENV{RazzleToolPath}\intlsrc.txt.
  8. #
  9. # Version: <1.00> 06/30/2000 : Suemiao Rossognol
  10. #----------------------------------------------------------------//
  11. ###-----Set current script Name/Version.----------------//
  12. package copylang;
  13. $VERSION = '1.10';
  14. $ENV{script_name} = 'copylang.pl';
  15. ###-----Require section and extern modual.---------------//
  16. require 5.003;
  17. use strict;
  18. use lib $ENV{ "RazzleToolPath" };
  19. use lib $ENV{ "RazzleToolPath" } . "\\PostBuildScripts";
  20. no strict 'vars';
  21. no strict 'subs';
  22. no strict 'refs';
  23. use File::Basename;
  24. use GetParams;
  25. use Logmsg;
  26. use cklang;
  27. use cktarg;
  28. use HashText;
  29. use comlib;
  30. use vars (qw($DEBUG));
  31. %hashCodes=();
  32. &HashText::Read_Text_Hash( 0, $ENV{RazzleToolPath}."\\Codes.txt", \%hashCodes );
  33. # Delete everything that's not international
  34. delete $hashCodes{RO};
  35. delete $hashCodes{CA};
  36. delete $hashCodes{CHP};
  37. delete $hashCodes{PSU};
  38. delete $hashCodes{MIR};
  39. delete $hashCodes{TST};
  40. my ( $infsSrcTree, $unfsLocTree, $isNtsetup );
  41. my ( $syncOnly, $syncTime );
  42. #------------------------------------------------------------------//
  43. #Function: main
  44. #Parameter: (1) Language
  45. # (2) Root of the Source Tree
  46. # (3) Root of the Localized Tree
  47. # (4) Incremental Flag
  48. # (5) Powerless Flag
  49. #------------------------------------------------------------------//
  50. my $EXECUTE = { "USA" => \&CopyUSAToLocalized ,
  51. "PSU" => \&GenNoOp ,
  52. "MIR" => \&GenNoOp ,
  53. "FE" => \&GenNoOp ,
  54. "-" => \&CopyLocToBuild
  55. };
  56. sub CopyUSAToLocalized{
  57. }
  58. sub main
  59. {
  60. my ( $pLang, $pSrcRoot, $pLocRoot, $pIsIncr, $pIsPowerless ) = @_;
  61. if( $pLang eq "USA" )
  62. {
  63. $theFromTree = "SourceTree";
  64. $theFromRoot = $pSrcRoot;
  65. $theFromFile = "SourceFilename";
  66. $theToTree = "LocTree";
  67. $theToRoot = $pLocRoot;
  68. $theToFile = "LocTreeFilename";
  69. }else
  70. {
  71. $theFromTree = "LocTree";
  72. $theFromRoot = $pLocRoot;
  73. $theFromFile = "LocTreeFilename";
  74. $theToTree = "SourceTree";
  75. $theToRoot = $pSrcRoot;
  76. $theToFile = "SourceFilename";
  77. }
  78. # my $OldLang = "-" if cklang::FieldByName($pLang, "OLD_LANG") and !defined( $EXECUTE->{$pLang});
  79. # my $status = (defined( $EXECUTE->{$OldLang})) ?
  80. # $EXECUTE->{$OldLang}->() : -1;
  81. # pending
  82. ###---Set xcopy flag.--------------------------------//
  83. my $copyOpt = "/V /F /R /Y";
  84. if( $pIsPowerless )
  85. {
  86. $copyOpt .= " /L /D";
  87. }
  88. else
  89. {
  90. if( $pIsIncr ){ $copyOpt .= " /D"; }
  91. }
  92. ###---Get Hash value from intlsrc.txt file.----------//
  93. my @srcHash=();
  94. &HashText::Read_Text_Hash( 1, "$ENV{\"RazzleToolPath\"}\\intlsrc.txt", \@srcHash );
  95. @theHashKey = ("Target", "SourceFilename", "SourceTree", "LocTree","LocTreeFilename" , "Lang", "Comments");
  96. %tmp=();
  97. my @filtered = ();
  98. for $line( @srcHash){
  99. &logmsg("Skipping " .
  100. $line->{ "LocTree"} .
  101. "\\".
  102. $line->{ "LocTreeFilename" } .
  103. " for ".
  104. $pLang ) and
  105. next if $line->{ "Lang" } =~ /\~$pLang/i;
  106. push @filtered, $line;
  107. }
  108. $#srcHash= -1;
  109. push @srcHash, @filtered;
  110. # poor man fix of the language filter
  111. for $line( @srcHash)
  112. {
  113. for $curKey ( @theHashKey )
  114. {
  115. if( $line->{ $curKey } =~ /^(.*)(\$\(LANG\))(.*)$/ )
  116. {
  117. $line->{ $curKey } = $1 . lc($pLang) .$3;
  118. }
  119. if( $line->{ $curKey } =~ /^(.*)([c|h])(\$\(PRIMARY_LANG_ID\))(.*)$/ )
  120. {
  121. if( $pLang eq "CHT" || $pLang eq "CHS" )
  122. {
  123. $LCID = substr( $hashCodes{uc($pLang)}->{LCID}, 2, length($hashCodes{uc($pLang)}->{LCID})-2);
  124. $line->{ $curKey } = "prf" . $2 . $LCID .$4;
  125. }
  126. else
  127. {
  128. $priLangID = "0". substr( $hashCodes{uc($pLang)}->{PriLangID}, 2, length($hashCodes{uc($pLang)}->{PriLangID})-2);
  129. $line->{ $curKey } = $1 . $2. $priLangID .$4;
  130. }
  131. }
  132. }
  133. $to = $theToRoot."\\". $line->{ $theToTree };
  134. if( !exists $tmp{$to} ){ $tmp{$to}=(); }
  135. }
  136. if( $pLang eq "USA" )
  137. {
  138. for( keys %tmp )
  139. {
  140. &CkCleanDir( $_, $pIsIncr, $pIsPowerless );
  141. }
  142. }
  143. ###---Perform Copy now.------------------------------//
  144. &dbgmsg("Read targets from intlsrc.txt: \n");
  145. for $line ( @srcHash )
  146. {
  147. &dbgmsg($line->{ $theFromTree },"\n");
  148. if( $pLang ne "USA" )
  149. {
  150. next if( !&cktarg::CkTarg( $line->{'Target'}, uc($pLang) ) );
  151. }
  152. next if(&IsTargInfsNtsetup( $line, $pLang,$pSrcRoot, $pLocRoot, $pIsIncr, $pIsPowerless, $copyOpt));
  153. $from = $theFromRoot ."\\". $line->{ $theFromTree }."\\".$line->{ $theFromFile};
  154. if( $pLang ne "USA" )
  155. {
  156. if( $line->{ $theFromFile } eq ".")
  157. {
  158. $from = $theFromRoot ."\\". $line->{ $theFromTree }."\\".$line->{ $theToFile };
  159. }
  160. }
  161. $to = $theToRoot."\\". $line->{ $theToTree }. "\\".$line->{ $theToFile };
  162. &PerformCopy( $line->{Target}, $from, $to, $copyOpt);
  163. }
  164. exit( !&comlib::CheckError( $ENV{ERRFILE}, "Copy Successfully" ) );
  165. }
  166. #------------------------------------------------------------------//
  167. #Function: IsTargInfsNtsetup
  168. #Parameter: (1) Line from intlsrc.txt
  169. # (2) Language
  170. # (3) Root of the Source Tree
  171. # (4) Root of the Localized Tree
  172. # (5) Incremental Flag
  173. # (6) Powerless Flag
  174. # (7) xcopy optional flags
  175. #------------------------------------------------------------------//
  176. sub IsTargInfsNtsetup
  177. {
  178. my( $pLine, $pLang, $pSrcRoot, $pLocRoot, $pIsIncr, $pIsPowerless,$pCopyOpt )= @_;
  179. my( $from, $to );
  180. return 0 if( $pLine->{Target} ne "INFS_NTSETUP" && $pLine->{Target} ne "INFS_FIXPRNSV"
  181. && $pLine->{Target} ne "INFS_COMPDATA" && $pLine->{Target} ne "INFS_FAXSRV" );
  182. if( $pLine->{Target} eq "INFS_NTSETUP" )
  183. {
  184. $isNtsetup=1;
  185. }
  186. else
  187. {
  188. $isNtsetup=0;
  189. }
  190. $infsSrcTree = "$pSrcRoot\\$pLine->{SourceTree}";
  191. $infsLocTree = "$pLocRoot\\$pLine->{LocTree}";
  192. ### Drop the ending path of "\$(LANG)" from SourceTree
  193. $infsSrcTree =~ s/^(.+)\\$pLang$/$1/i;
  194. if( $pLang eq "USA")
  195. {
  196. ###(1)Copy $infsSrcTree\\*.inx => infs\setup
  197. $from = "$infsSrcTree\\*\.inx";
  198. $to = "$infsLocTree\\.";
  199. &CkCleanDir( $to, $pIsIncr, $pIsPowerless );
  200. &PerformCopy( $line->{Target}, $from, $to, $pCopyOpt);
  201. ###(2)Copy $infsSrcTree\\usa\* => $infsLocTree\usa_all
  202. $from = "$infsSrcTree\\usa\\*";
  203. $to = "$infsLocTree\\usa_all";
  204. &CkCleanDir( $to, $pIsIncr, $pIsPowerless );
  205. &PerformCopy( $line->{Target}, $from, "$to\\.", $pCopyOpt);
  206. }
  207. ###(3)If copylang.pl -l:usa, precompile MergedComponents\SetupInfs\usa => to infs\setup\$lang
  208. ### for all $lang's in codes.txt.
  209. ### This step is necessary to make LocStudio load the unlocalized text files,
  210. ### as LS does not understand if statements.
  211. ###
  212. ###(1)Otherwise, copy loc\res\$lang\windows\sources\infs\setup => MergedComponents\SetupInfs\$lang
  213. ### for the localizable txt files, and
  214. ### copy MergedComponents\SetupInfs\usa => MergedComponents\SetupInfs\$lang
  215. ### for the unlocalizable txt files.
  216. ### In the end, MergedComponents\SetupInfs\$lang will have the same list of files as
  217. ### MergedComponents\SetupInfs\usa.
  218. &ClSrc( $pLine->{Target}, $pLang, $pSrcRoot, $pLocRoot, $pIsIncr,$pIsPowerless, $pCopyOpt );
  219. return 1;
  220. }
  221. #------------------------------------------------------------------//
  222. #Function: ClSrc
  223. #Parameter: (1) Language
  224. # (2) Root of the Source Tree
  225. # (3) Root of the Localized Tree
  226. # (4) Incremental Flag
  227. # (5) Powerless Flag
  228. # (6) xcopy optional flags
  229. #------------------------------------------------------------------//
  230. sub ClSrc
  231. {
  232. my( $pTarget, $pLang, $pSrcRoot, $pLocRoot,$pIsIncr, $pIsPowerless, $pCopyOpt )=@_;
  233. ###---Get LCID from codes.txt.---------------------------------//
  234. my $srcDir = "$infsSrcTree\\usa";
  235. my @srcFiles = `dir /on /b $srcDir`;
  236. chomp @srcFiles;
  237. if( $pLang eq "USA")
  238. {
  239. my @myLang = sort keys %hashCodes;
  240. for( my $i=0; $i < @myLang; $i++)
  241. {
  242. $destDir = "$infsLocTree\\$myLang[$i]";
  243. &CkCleanDir( $destDir, $pIsIncr, $pIsPowerless );
  244. &PerformCompile( $myLang[$i], \@srcFiles, $srcDir, $destDir, $pIsPowerless, $pCopyOpt);
  245. }
  246. return 1;
  247. }
  248. ###(1)Copy $infsLocTree\* $infsSrcTree\<LANG>
  249. $destDir = "$infsSrcTree\\$pLang";
  250. &CkCleanDir( $destDir, $pIsIncr, $pIsPowerless );
  251. $locDir = $infsLocTree;
  252. @locFiles = `dir /on /b $locDir`;
  253. chomp @locFiles;
  254. for( my $i=0; $i < @locFiles; $i++)
  255. {
  256. &PerformCopy( $pTarget, "$locDir\\$locFiles[$i]", "$destDir\\.", $pCopyOpt);
  257. }
  258. ###Sepcial case for chh
  259. if( lc($pLang) eq "cht" && $isNtsetup )
  260. {
  261. $destDir =~ /(.*)cht$/ || $destDir =~ /(.*)CHT$/;
  262. {
  263. $tmpDestDir = "$1chh";
  264. }
  265. &PerformCopy( $pTarget, "$locDir\\chh\\hivesft\.txt", "$tmpDestDir\\.", $pCopyOpt) ;
  266. }
  267. ###(2)Precompile the files in srcDir but not in locDir=>destDir
  268. %tmp=();
  269. for ( @locFiles ){ $tmp{lc($_)}=1;}
  270. @srcFiles = map( { exists $tmp{lc($_)}?():lc($_)} @srcFiles);
  271. &PerformCompile( $pLang, \@srcFiles, $srcDir, $destDir, $pIsPowerless, $pCopyOpt);
  272. return 1;
  273. }
  274. #------------------------------------------------------------------//
  275. #Function: PerformCompile
  276. #Parameter: (1) Language
  277. # (2) Source File name
  278. # (3) Source File Path
  279. # (4) Target File Path
  280. # (5) Powerless Flag
  281. # (6) xcopy optional flags
  282. #------------------------------------------------------------------//
  283. sub PerformCompile
  284. {
  285. my( $pLang, $pSrcFiles, $pSrcDir, $pDestDir, $pIsPowerless, $pCopyOpt)=@_;
  286. my $PREFLAGS ="";
  287. for ( my $i=0; $i < @$pSrcFiles; $i++)
  288. {
  289. my $from = "$pSrcDir\\$pSrcFiles->[$i]";
  290. my $to = "$pDestDir\\$pSrcFiles->[$i]";
  291. if( lc($pSrcFiles->[$i]) eq "intl\.txt" )
  292. {
  293. &PerformCopy( "INFS_NTSETUP", $from, $to, $pCopyOpt);
  294. next;
  295. }
  296. ###Special CHH case for hivesft.txt
  297. if( lc($pSrcFiles->[$i]) eq "hivesft\.txt" && lc($pLang) eq "chh" )
  298. {
  299. $PREFLAGS = "/DLANGUAGE_ID=0xc04 /EP";
  300. }
  301. else
  302. {
  303. $PREFLAGS = "/DLANGUAGE_ID=$hashCodes{uc($pLang)}->{LCID} /EP";
  304. }
  305. $cmdLine="cl /nologo $PREFLAGS $from 1\>$to";
  306. # if ( !$pIsPowerless and !$synconly)
  307. # BUG the compiler is executed even if "synconly" was requested.
  308. if ( !$pIsPowerless)
  309. {
  310. # Sync
  311. if( $syncOnly && lc $ENV{lang} ne "usa")
  312. {
  313. &SdCmds( $from, $to, "revert" );
  314. &SdCmds( $from, $to, "sync" );
  315. next;
  316. }
  317. # Edit
  318. &SdCmds( $from, $to, "edit" )if( lc $ENV{lang} ne "usa" );
  319. # Copy files
  320. &comlib::ExecuteSystem( $cmdLine );
  321. # Revert file if no different
  322. &SdCmds( $from, $to, "revert" )if( lc $ENV{lang} ne "usa" );
  323. }
  324. else
  325. {
  326. if ( not $synconly){
  327. print "$cmdLine\n";
  328. }
  329. else {
  330. print "SUPPRESSED IN SYNC ONLY MODE:\n$cmdLine\n\n";
  331. }
  332. }
  333. }
  334. }
  335. #------------------------------------------------------------------//
  336. #Function: CkCleanDir
  337. #Parameter: (1) Directory to be checked and cleaned
  338. # (2) Incremental flag
  339. # (3) Powerless flag
  340. #------------------------------------------------------------------//
  341. sub CkCleanDir
  342. {
  343. my ( $pDir, $pIsIncr, $pIsPowerless )=@_;
  344. if( !$pIsIncr && !$pIsPowerless )
  345. {
  346. if( -e $pDir ){
  347. #&comlib::ExecuteSystem( "rd /S /Q $pDir" );
  348. }
  349. }
  350. if( !(-e $pDir) ){
  351. &comlib::ExecuteSystem( "md $pDir");
  352. }
  353. }
  354. #------------------------------------------------------------------//
  355. #Function: PerformCopy
  356. #Parameter: (1) Any String - information purpose, it could be NULL.
  357. # (2) Source of the xcopy
  358. # (3) Target of the xcopy
  359. # (4) xcopy optional flags
  360. #------------------------------------------------------------------//
  361. sub PerformCopy
  362. {
  363. my( $pTarg, $pFrom, $pTo, $pCopyOpt )=@_;
  364. # Sync only
  365. if( $syncOnly && lc $ENV{lang} ne "usa"){
  366. &SdCmds( $pFrom, $pTo, "revert" );
  367. return &SdCmds( $pFrom, $pTo, "sync" );
  368. }
  369. # Do SD update from Loc depot to Source Tree
  370. # Open file for Edit
  371. &SdCmds( $pFrom, $pTo, "edit" ) if( lc $ENV{lang} ne "usa");
  372. # Copy files
  373. &comlib::ExecuteSystem( "echo F|xcopy $pCopyOpt $pFrom $pTo", "$pTarg:");
  374. # Revert file with no different
  375. &SdCmds( $pFrom, $pTo, "revert" ) if( lc $ENV{lang} ne "usa" );
  376. return 1;
  377. }
  378. #------------------------------------------------------------------//
  379. #Function: SdCmds
  380. #Parameter: (1) Source of the xcopy
  381. # (2) Target of the xcopy
  382. #------------------------------------------------------------------//
  383. sub SdCmds
  384. {
  385. my( $pFrom, $pTo, $pCmd )=@_;
  386. my @sdEdit;
  387. $pTo =~ /^(.+)\\([^\\]+)$/;
  388. my $toDir = $1;
  389. my $toBase = $2;
  390. my $fromDir;
  391. if( -d $pFrom )
  392. {
  393. $pFrom =~ /^(.+)\\([^\\]+)$/;
  394. $fromDir = $1;
  395. return if( "compdata" eq lc $2 || "chh" eq lc $2);
  396. my @tmp = `dir /s /b $pFrom`;
  397. chomp( @tmp );
  398. for my $file ( @tmp )
  399. {
  400. my $tailStr;
  401. while(1)
  402. {
  403. $file =~ /^(.+)\\([^\\]+)$/;
  404. if( $tailStr ){ $tailStr = "$2\\$tailStr";}
  405. else { $tailStr = $2; }
  406. last if ( lc $fromDir eq lc $1 );
  407. $file = $1;
  408. }
  409. push( @sdEdit, "$toDir\\$tailStr" );
  410. }
  411. $fromDir=$pFrom;
  412. }
  413. else
  414. {
  415. $pFrom =~ /^(.+)\\([^\\]+)$/;
  416. $fromDir = $1;
  417. if( $toBase eq "." )
  418. {
  419. push( @sdEdit, basename($pFrom) );
  420. }
  421. elsif( $toBase eq "*" )
  422. {
  423. @sdEdit = `dir /b $toDir`;
  424. }
  425. else
  426. {
  427. push( @sdEdit, $toBase );
  428. }
  429. }
  430. chomp( @sdEdit );
  431. for my $theFile ( @sdEdit )
  432. {
  433. # Sync
  434. if( $pCmd =~ /sync/i )
  435. {
  436. if( !(-e "$toDir\\$theFile" ) )
  437. {
  438. &comlib::ExecuteSystem(" copy $fromDir\\$theFile $toDir\\$theFile" );
  439. }
  440. &comlib::ExecuteSystem( "cd /d $toDir& sd sync -f $theFile$syncTime" );
  441. next;
  442. }
  443. # Revert
  444. if( $pCmd =~ /revert/i )
  445. {
  446. if ($syncOnly){
  447. # omit -a flag
  448. # print STDERR "this is the file name! ", $theFile if $theFile =~ /\\/i;
  449. &comlib::ExecuteSystem( "cd /d $toDir& sd revert $theFile" );
  450. }
  451. else {
  452. &comlib::ExecuteSystem( "cd /d $toDir& sd revert -a $theFile" );
  453. }
  454. next;
  455. }
  456. # Edit
  457. my $tmp = `cd /d $toDir& sd have $theFile`;
  458. if( !$tmp )
  459. {
  460. &comlib::ExecuteSystem(" copy $fromDir\\$theFile $toDir\\$theFile" );
  461. &comlib::ExecuteSystem( "cd /d $toDir& sd add $theFile" );
  462. }
  463. else
  464. {
  465. &comlib::ExecuteSystem( "cd /d $toDir& sd edit $theFile" );
  466. }
  467. }
  468. }
  469. #------------------------------------------------------------------//
  470. #Function: Usage
  471. #-----------------------------------------------------------------//
  472. sub Usage
  473. {
  474. print <<USAGE;
  475. Perform files copy between the source and localization trees as
  476. described in tools\\intlsrc.txt.
  477. Usage:
  478. $0 -l:<lang> [-x:<SourcePath>] [-y:<LocPath>] [-i] [-p] [-s]
  479. -l Language.
  480. -x Root path of the SourceTree.
  481. Defaults to $ENV{_NTBINDIR}.
  482. -y Root path of the LocTree.
  483. Defaults to $ENV{_NTBINDIR}\\usasrc when language is usa.
  484. Defaults to $ENV{_NTBINDIR}\\loc\\res\\<lang>\\windows\\sources otherwise.
  485. -i Incremental. This flag is used for incremental copy.
  486. -t Timestamp for syncing loc files in the source tree.
  487. Default is latest.
  488. This only applied to non-usa languages.
  489. -u Update via sd resolve and submit operations.
  490. Default to update the loc files in the source tree as the following:
  491. (1) Enlist according to the project view intlview.txt (*)
  492. (2) Open the loc files in the source tree for edit according
  493. to intlsrc.txt (+)
  494. (3) Copy the loc files from the loc depot to the source tree
  495. according to intlsrc.txt (+)
  496. (4) Precompile the files using the timestamped public headers
  497. according to intlsrc.txt (+)
  498. (5) Revert the files with no changes (?)
  499. (6) Submit the files (+)
  500. -s Sync the loc files in the source tree only.
  501. The policy to update when the -s flag set is:
  502. (1) Enlist according to the project view intlview.txt (*)
  503. (2) Sync the collection of files and dirs defined in project
  504. view intlview.txt to the USA build timestamp (*)
  505. (3) Sync the collection of files and dirs defined in project
  506. view intlsrc.txt to current (+)
  507. * assumed to have happened in INTL razzle, driven by intlsdop.cmd and intlmap.pl
  508. + currently used
  509. - currently is missing or implicit
  510. -p Powerless. Only lists the files that would get used.
  511. /? Displays usage.
  512. Examples:
  513. $0 -l:usa -x:\\\\ntbld03\\sources -y:\\\\intlnt\\2500.x86.src
  514. Copies sources from the usa build machines for localization.
  515. $0 -l:usa -y:\\\\intlnt\\2500.x86.src
  516. Copies sources from local machines for localization.
  517. $0 -l:jpn -i -p
  518. Queries which localized sources would get copied from the
  519. localization tree to the source tree for jpn.
  520. USAGE
  521. exit(1);
  522. }
  523. #--------------------------------------------------------//
  524. #Cmd entry point for script.
  525. #--------------------------------------------------------//
  526. if (eval("\$0 =~ /" . __PACKAGE__ . "\\.pl\$/i"))
  527. {
  528. # <run perl.exe GetParams.pm /? to get the complete usage for GetParams.pm>
  529. &GetParams ('-n', 'l:','-o', 'x:y:t:ips', '-p', 'lang srcroot locroot synctime isincr ispowerless synconly', @ARGV);
  530. $syncOnly = $synconly;
  531. $syncTime = $synctime;
  532. if( $syncTime && ( $syncTime !~ /^([@#].+)$/ )){ $syncTime = "\@".$syncTime; }
  533. #Validate or Set default
  534. $lang = uc($lang);
  535. if( !&ValidateParams( $lang, \$srcroot, \$locroot ) ) {exit(1); }
  536. $ENV{lang}=$lang;
  537. exit( !&copylang::main( $lang, $srcroot,$locroot, $isincr, $ispowerless ) );
  538. }
  539. #--------------------------------------------------------//
  540. #Function: ValidateParams
  541. #--------------------------------------------------------//
  542. sub ValidateParams
  543. {
  544. my ( $pLang, $pSrcRoot, $pLocRoot ) = @_;
  545. if ( !&cklang::CkLang( uc($pLang) ) ) {
  546. $ENV{LOGFILE} = "copylang.log";
  547. $ENV{ERRFILE} = "copylang.err";
  548. errmsg("Invalid language $pLang.");
  549. return 0;
  550. }
  551. #Create log/err file
  552. if( !( -e "$ENV{_NTTREE}\\$lang\\build_logs") )
  553. {
  554. &comlib::ExecuteSystem( "md \"$ENV{_NTTREE}\\$lang\\build_logs\"");
  555. }
  556. $ENV{LOGFILE} = "$ENV{_NTTREE}\\$lang\\build_logs\\copylang.log";
  557. $ENV{ERRFILE} = "$ENV{_NTTREE}\\$lang\\build_logs\\copylang.err";
  558. &comlib::ExecuteSystem( "del $ENV{LOGFILE}" ) if( -e $ENV{LOGFILE} );
  559. &comlib::ExecuteSystem( "del $ENV{ERRFILE}" ) if( -e $ENV{ERRFILE} );
  560. if( !${$pSrcRoot} )
  561. {
  562. $$pSrcRoot = "$ENV{_NTBINDIR}";
  563. }
  564. if( !${$pLocRoot} )
  565. {
  566. if( $pLang eq "USA" )
  567. {
  568. $$pLocRoot = "$ENV{_NTBINDIR}\\usasrc";
  569. }
  570. else
  571. {
  572. $$pLocRoot = "$ENV{_NTBINDIR}\\loc\\res\\$pLang\\windows\\sources";
  573. }
  574. }
  575. return 1;
  576. }
  577. #----------------------------------------------------------------//
  578. #Function: GetParams
  579. #----------------------------------------------------------------//
  580. sub GetParams
  581. {
  582. use GetParams;
  583. #Call pm getparams with specified arguments
  584. &GetParams::getparams(@_);
  585. #Call the usage if specified by /?
  586. if ($HELP){ &Usage();}
  587. }
  588. ###------------------------------------------------------//
  589. 1;
  590. __END__
  591. =head1 NAME
  592. B<Copylang> - Perform Files copy
  593. =head1 SYNOPSIS
  594. =head1 DESCRIPTION
  595. =head1 INSTANCES
  596. =head2 <myinstances>
  597. <Description of myinstances>
  598. =head1 METHODS
  599. =head2 <mymathods>
  600. <Description of mymathods>
  601. =head1 SEE ALSO
  602. __END__
  603. =head1 AUTHOR
  604. <Suemiao Rossignol <[email protected]>>
  605. <Serguei Kouzmine <[email protected]>
  606. =head1 CHANGES
  607. Rearranging the logic to separate sd update - sd sync - no sd.
  608. This rearrangement will involve intlbld.pl, copylang.pl, intlsdop.cmd
  609. Please read the usage for all these.
  610. Q: Is there the way to do it safe and incremental?
  611. A: Yes. Possibly.
  612. Step 1.
  613. add copylang.pl "sync only" functionality to intlsdop.cmd
  614. Step 2.
  615. add intlmap.pl "selective enlist" functionality to intlsdop.cmd
  616. and copylang/intlbld
  617. add intlsdop.cmd "sync" functionality to copylang/intlbld
  618. Step 3.
  619. do a cleanup of redundant code. Define logic in mapping files
  620. Q: Files involved?
  621. intlbld.txt
  622. intlsrc.txt
  623. intlview.txt
  624. codes.txt
  625. prodskus.txt
  626. copylang.pl
  627. intlbld.pl
  628. intlsdop.cmd
  629. intlbld.mak