clone_packages/parse_clone_all.pl
changeset 61 3efaaf387e1a
equal deleted inserted replaced
60:e86c659b78a0 61:3efaaf387e1a
       
     1 #! perl
       
     2 
       
     3 # Copyright (c) 2009 Symbian Foundation Ltd
       
     4 # This component and the accompanying materials are made available
       
     5 # under the terms of the License "Eclipse Public License v1.0"
       
     6 # which accompanies this distribution, and is available
       
     7 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 #
       
     9 # Initial Contributors:
       
    10 # Symbian Foundation Ltd - initial contribution.
       
    11 #
       
    12 # Contributors:
       
    13 #
       
    14 # Description:
       
    15 # Perl script to summarise output from clone_all_package.pl
       
    16 
       
    17 
       
    18 @all = <>;
       
    19 
       
    20 my $repo;
       
    21 my $newrepo = 0;
       
    22 my $errors = 0;
       
    23 my $summary = 0;
       
    24 my $retries = 0;
       
    25 foreach my $line (@all)
       
    26 {
       
    27   if($summary)
       
    28   {
       
    29     # if we are in the summary section then just echo all lines out
       
    30     # this should be a list of all the packages with errors
       
    31     print "$line\n";
       
    32   }
       
    33 	#save package name
       
    34 	# e.g new package "Cloning compatanaapps from sfl/MCL/sftools/ana/compatanaapps..."
       
    35 	# e.g. existing package "Updating helix from sfl/MCL/sf/mw/helix..."
       
    36 	# e.g. with -exec option "Processing sfl/FCL/interim/auxiliary_tools/AgileBrowser."
       
    37 	elsif ($line =~ m/Cloning (.*?)from(.*)$/)
       
    38 	{
       
    39 		$repo = $2;
       
    40 		$newrepo = 1;
       
    41 		$retries =0;
       
    42     }
       
    43     elsif ($line =~ m/Updating (.*?)from(.*)$/)
       
    44     {
       
    45 		$repo = $2;
       
    46 		$newrepo = 0;
       
    47 		$retries =0;
       
    48     }
       
    49 
       
    50     #
       
    51     # Capture number of changes, should be line like one of the following
       
    52 	# e.g. "added 4 changesets with 718 changes to 690 files"
       
    53 	# e.g. "no changes found"
       
    54 	elsif ($line =~ m/added (.*?)changesets with(.*)$/)
       
    55 	{
       
    56 		print "\n$repo\t added $1 chamgesets";
       
    57 		print "\t retries $retries";
       
    58 		print "\t** NEW" if ($newrepo);
       
    59     }
       
    60 
       
    61   if($line =~ m/abort:/)
       
    62   {
       
    63     $retries++;
       
    64   }
       
    65 
       
    66 	# Process the summary section
       
    67 	# e.g. "------------"
       
    68 	# e.g. "Processed 22 packages, of which 0 reported errors"
       
    69 	if ($line =~ m/Processed (.*?)packages, of which(.*?)reported errors/)
       
    70 	{
       
    71 		print "\n-------------------------------\n";
       
    72 		print "\n Summary: Processed $1 : Errors $2\n";
       
    73 		$errors= $2;
       
    74 		$summary = 1;
       
    75 	}
       
    76 
       
    77 }
       
    78 if ($errors > 0)
       
    79 {
       
    80 	print "\nexit with error\n";
       
    81 	exit 1;
       
    82 }
       
    83 else
       
    84 {
       
    85   print "\nexit success\n";
       
    86 	exit 0;
       
    87 }