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.

68 lines
1.6 KiB

  1. @REM -----------------------------------------------------------------
  2. @REM
  3. @REM SkuSize.cmd - WadeLa
  4. @REM Calculate the size of the SKUs
  5. @REM
  6. @REM Copyright (c) Microsoft Corporation. All rights reserved.
  7. @REM
  8. @REM -----------------------------------------------------------------
  9. @perl -x "%~f0" %*
  10. @goto :EOF
  11. #!perl
  12. use strict;
  13. use lib $ENV{RAZZLETOOLPATH} . "\\PostBuildScripts";
  14. use lib $ENV{RAZZLETOOLPATH};
  15. use PbuildEnv;
  16. use ParseArgs;
  17. use cksku;
  18. sub Usage { print<<USAGE; exit(1) }
  19. Calculate CD sizes
  20. USAGE
  21. parseargs('?' => \&Usage);
  22. #
  23. # Get the skus we want
  24. #
  25. my @SkuList = grep {cksku::CkSku($_, $ENV{LANG}, $ENV{_BuildArch})} qw(PRO PER SRV BLA ADS );
  26. #
  27. # Read recursive dir into an array.
  28. # Then get rid everything except files.
  29. #
  30. my $StartPath=$ENV{_NTPostBld};
  31. my $PathRegex=quotemeta $StartPath;
  32. my $LogFile="$StartPath\\build_logs\\SkuSize.$ENV{_BuildBranch}.$ENV{_BuildArch}$ENV{_BuildType}.log";
  33. my $Destination="\\\\winwebshares\\warteam";
  34. if (-e $LogFile) {
  35. unlink $LogFile;
  36. }
  37. open OUTFILE , ">$LogFile";
  38. foreach my $Sku ( @SkuList ) {
  39. my @RecursiveDir= `dir /s $StartPath\\$Sku`;
  40. my $Path="";
  41. foreach my $DirLine (@RecursiveDir) {
  42. if ($DirLine =~ /^\d+\/\d+\/\d+\s+\d+:\d+\s+(?:AM|PM)\s+([\d,]+)\s+(.+)$/) {
  43. my $File=$2;
  44. my $Size=$1;
  45. $Size =~ tr/,//d;
  46. print OUTFILE ("$Sku,$Path$File,$Size\n");
  47. }
  48. elsif ($DirLine =~ /$PathRegex\\$Sku\\(.+)/i) {
  49. $Path="$1\\";
  50. }
  51. }
  52. }
  53. close OUTFILE;
  54. # 'copy $LogFile $Destination`;