os/kernelhwsrv/kerneltest/f32test/group/check.bat
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 @rem
     2 @rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 @rem All rights reserved.
     4 @rem This component and the accompanying materials are made available
     5 @rem under the terms of the License "Eclipse Public License v1.0"
     6 @rem which accompanies this distribution, and is available
     7 @rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 @rem
     9 @rem Initial Contributors:
    10 @rem Nokia Corporation - initial contribution.
    11 @rem
    12 @rem Contributors:
    13 @rem
    14 @rem Description:
    15 @rem
    16 
    17 @perl -x check.bat
    18 @goto end
    19 #!perl
    20 
    21 require Cwd;
    22 $cwd=Cwd::getcwd();
    23 #print "cwd: ",$cwd,"\n";
    24 $cwd =~ s/\//\\/;
    25 $cwd =~ /^(\w:)?([\\|\/]\S+[\\|\/])/isx;
    26 $drive=$1;
    27 $prjroot=$2;
    28 #print "drive ",$drive,"\n";
    29 #print "project root: ",$prjroot,"\n";
    30 @cpps=();
    31 @mmps=();
    32 @mmpflags=();
    33 %sources=();
    34 %sourceusers=();
    35 ls ($prjroot);
    36 #print "CPP files:\n";
    37 #foreach $entry (@cpps)
    38 #	{
    39 #	print $entry,"\n";
    40 #	}
    41 #print "MMP files:\n";
    42 $count=0;
    43 $countz=0;
    44 $countsrc=0;
    45 foreach $entry (@mmps)
    46 	{
    47 #	print $entry,"\n";
    48 	$srclist=$sources{$entry};
    49 	$mmpflags[$count]=0;
    50 	++$count;
    51 	++$countz if (scalar(@$srclist)==0);
    52 	$countsrc += scalar(@$srclist);
    53 	foreach $src (@$srclist)
    54 		{
    55 		$uselist=$sourceusers{$src};
    56 		$sourceusers{$src}=$uselist." ".$entry;
    57 #		print "\t",$src,"\n";
    58 		}
    59 	}
    60 $hashsize=scalar(%sources);
    61 #print $hashsize;
    62 #print "Count=",$count,"\n";
    63 #print "CountZ=",$countz,"\n";
    64 #print "CountSrc=",$countsrc,"\n";
    65 
    66 foreach $entry (@cpps)
    67 	{
    68 	$uses=$sourceusers{$entry};
    69 	print "File ",$entry," not referenced by any .MMP file\n" unless $uses;
    70 	}
    71 
    72 parsebldinf();
    73 
    74 $i=0;
    75 foreach $entry (@mmps)
    76 	{
    77 	next if $mmpflags[$i++];
    78 	print "\n",$entry,".MMP does not appear in BLD.INF\n";
    79 	print "\t Source files:\n";
    80 	$srclist=$sources{$entry};
    81 	foreach $src (@$srclist)
    82 		{
    83 		print "\t",$src,"\n";
    84 		}
    85 	}
    86 end;
    87 
    88 sub ls
    89 	{
    90 	my $dir=@_[0];
    91 	$dir =~ s/\//\\/;
    92 #	print $dir,"\n";
    93 	opendir(DIR,$dir);
    94 	my @dir=readdir(DIR);
    95 	closedir(DIR);
    96 	my $entry;
    97 	my $fullentry;
    98 	foreach $entry (@dir)
    99 		{
   100 		$entry=~s/\//\\/;
   101 		next if (($entry eq ".") or ($entry eq ".."));
   102 		$fullentry=$dir.$entry;
   103 		if (-d $fullentry)
   104 			{
   105 			ls($fullentry."\\");
   106 			}
   107 		else
   108 			{
   109 			push @cpps, uc($fullentry) if ($entry =~ /\S+\.cpp/isx);
   110 			if ($entry =~ /(\S+)\.mmp/isx)
   111 				{
   112 				push @mmps, uc($1);
   113 				parsemmp($fullentry,\%sources);
   114 				}
   115 #			print $fullentry,"\n";
   116 			}
   117 		}
   118 	}
   119 
   120 sub parsemmp
   121 	{
   122 	my $mmpfile=@_[0];
   123 	my $array=@_[1];
   124 	my $project;
   125 	my $subproject;
   126 #	print "ParseMMP ",$mmpfile,"\n";
   127 	open(MMP,$mmpfile);
   128 	my @sources=();
   129 	while(<MMP>)
   130 		{
   131 		if (/^PROJECT\s+(\S+)/isx)
   132 			{
   133 			$project=uc($1);
   134 #			print "Project ",$project,"\n";
   135 			}
   136 		elsif (/^SUBPROJECT\s+(\S+)/isx)
   137 			{
   138 			$subproject=uc($1);
   139 #			print "Subproject ",$subproject,"\n";
   140 			}
   141 		elsif (/^source\s*(.+)/isx)
   142 			{
   143 #			print $1;
   144 			my $list=$1;
   145 			while($list)
   146 				{
   147 				$list =~ /^(\S+)\s*(.*)/isx;
   148 				push @sources, "\\".$project."\\".$subproject."\\".uc($1);
   149 				$list=$2;
   150 #				print "\t Source ",$1,"\n";
   151 				}
   152 			}
   153 		}
   154 	close(MMP);
   155 	$mmpfile =~ /\S*\\(\S+)\.mmp/isx;
   156 	$mmpfileshort=uc($1);
   157 	$$array{$mmpfileshort}=\@sources;
   158 	}
   159 
   160 sub parsebldinf
   161 	{
   162 	my $reachedmmps=0;
   163 	open(BLDINF,"bld.inf");
   164 	while (<BLDINF>)
   165 		{
   166 #		print;
   167 		if ($reachedmmps==0)
   168 			{
   169 			$reachedmmps=1 if (/PRJ_MMPFILES|PRJ_TESTMMPFILES/isx);
   170 			next;
   171 			}
   172 		/(\S+)\s*.*/isx;
   173 		my $mmpfile=uc($1);
   174 #		print "****************",$mmpfile,"\n";
   175 		my $mmp;
   176 		my $i=0;
   177 		foreach $mmp (@mmps)
   178 			{
   179 			$mmpflags[$i]=1 if ($mmp eq $mmpfile);
   180 			++$i;
   181 			}
   182 		}
   183 	close(BLDINF);
   184 	}
   185 
   186 __END__
   187 :end