tools/bulk_marking.pl
changeset 81 5796f75bcd93
parent 34 33a3c5f8b4c8
child 82 e044daaa1848
equal deleted inserted replaced
80:3ab0df073c86 81:5796f75bcd93
    14 # Read a list of "static dependency" lines and tag them in rom_content.csv
    14 # Read a list of "static dependency" lines and tag them in rom_content.csv
    15 
    15 
    16 use strict;
    16 use strict;
    17 use Getopt::Long;
    17 use Getopt::Long;
    18 
    18 
       
    19 my $newcmd = "";
       
    20 my $who;
    19 my $marking;
    21 my $marking;
    20 my $who;
    22 my $other_exes = 0;
    21 GetOptions(
    23 GetOptions(
       
    24   "c|command=s" => \$newcmd,    # value for the What colum (can be blank)
    22   "m|message=s" => \$marking,   # comment to add to the CSV lines
    25   "m|message=s" => \$marking,   # comment to add to the CSV lines
    23   "u|user=s" => \$who,          # value for the Who column
    26   "u|user=s" => \$who,          # value for the Who column
       
    27   "x" => \$other_exes,          # marking is applied to exes NOT listed
    24   );
    28   );
    25 
    29 
    26 die("must specify a value for the Why column with the -m option") if (!defined $marking);
    30 die("must specify a value for the Why column with the -m option") if (!defined $marking);
    27 die("must specify a value for the Who column with the -u option") if (!defined $who);
    31 die("must specify a value for the Who column with the -u option") if (!defined $who);
    28 
    32 
    32 	{
    36 	{
    33 	# PRIVATE\10003A3F\IMPORT\APPS\musui_reg.rsc	/epoc32/data/z/private/10003a3f/apps/musui_reg.rsc	sys\bin\musui.exe
    37 	# PRIVATE\10003A3F\IMPORT\APPS\musui_reg.rsc	/epoc32/data/z/private/10003a3f/apps/musui_reg.rsc	sys\bin\musui.exe
    34 	if ($line =~ /^\S+\t\S+\t(\S+)/)
    38 	if ($line =~ /^\S+\t\S+\t(\S+)/)
    35 		{
    39 		{
    36 		my $romfile = $1;
    40 		my $romfile = $1;
    37 		$romfiles{$romfile} = 1;
    41 		$romfiles{lc $romfile} = 1;
    38 		next;
    42 		next;
    39 		}
    43 		}
    40 
    44 
    41 	my ($romfile,$hostfile,$ibyfile,$package,$cmd,@rest) = split /,/, $line;
    45 	my ($romfile,$hostfile,$ibyfile,$package,$cmd,@rest) = split /,/, $line;
    42 	next if (!defined $cmd);
    46 	if (!defined $cmd)
       
    47 		{
       
    48 		if ($other_exes && $line =~ /^(\S+)$/)
       
    49 			{
       
    50 			# guess that this is a preserved filename
       
    51 			my $exe = "sys\\bin\\". lc $1;
       
    52 			$romfiles{$exe} = 1;
       
    53 			print STDERR "Preserving $exe\n";
       
    54 			}
       
    55 		next;
       
    56 		}
    43 	
    57 	
    44 	if (defined $romfiles{$romfile})
    58 	if ($cmd ne "")
    45 		{
    59 		{
    46 		if ($cmd eq "")
    60 		print $line;	# already marked, so leave it alone
       
    61 		next;
       
    62 		}
       
    63 
       
    64 	my $mark_me = 0;
       
    65 	if ($other_exes)
       
    66 		{
       
    67 		if ($romfile =~ /^sys.bin.(.*)$/i)
    47 			{
    68 			{
    48 			# mark this one
    69 			# this is an exe - are we tagging it?
    49 			print join(",", $romfile,$hostfile,$ibyfile,$package,"",$who,$marking), "\n";
    70 			if (!defined $romfiles{lc $romfile})
    50 			next;
    71 				{
    51 			}
    72 				print STDERR "Marking $romfile\n";
    52 		else
    73 				$mark_me = 1;
    53 			{
    74 				}
    54 			print STDERR "Skipping $romfile line - already marked as $cmd,",join(",", @rest);
       
    55 			}
    75 			}
    56 		}
    76 		}
    57 	print $line;
    77 	elsif (defined $romfiles{lc $romfile})
       
    78 		{
       
    79 		$mark_me = 1;
       
    80 		}
       
    81 
       
    82 	if ($mark_me)
       
    83 		{
       
    84 		print join(",", $romfile,$hostfile,$ibyfile,$package,$newcmd,$who,$marking), "\n";
       
    85 		}
       
    86 	else
       
    87 		{
       
    88 		print $line;
       
    89 		}
    58 	}
    90 	}