clone_packages/parse_clone_all.pl
author William Roberts <williamr@symbian.org>
Fri, 27 Aug 2010 15:27:06 +0100
changeset 281 c62bd4f9dbce
parent 60 3efaaf387e1a
permissions -rw-r--r--
Add delete_builds.pl - a utility for making space quickly on build machines This Perl script deletes some directories known to contain very large files first, before deleting the rest of the build which contains millions of small files. Given multiple builds, it will do this breadth first, so that lost of space is released quickly.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
60
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
     1
#! perl
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
     2
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
     3
# Copyright (c) 2009 Symbian Foundation Ltd
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
     4
# This component and the accompanying materials are made available
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
     5
# under the terms of the License "Eclipse Public License v1.0"
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
     6
# which accompanies this distribution, and is available
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
     7
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
     8
#
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
     9
# Initial Contributors:
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    10
# Symbian Foundation Ltd - initial contribution.
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    11
#
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    12
# Contributors:
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    13
#
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    14
# Description:
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    15
# Perl script to summarise output from clone_all_package.pl
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    16
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    17
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    18
@all = <>;
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    19
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    20
my $repo;
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    21
my $newrepo = 0;
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    22
my $errors = 0;
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    23
my $summary = 0;
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    24
my $retries = 0;
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    25
foreach my $line (@all)
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    26
{
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    27
  if($summary)
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    28
  {
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    29
    # if we are in the summary section then just echo all lines out
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    30
    # this should be a list of all the packages with errors
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    31
    print "$line\n";
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    32
  }
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    33
	#save package name
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    34
	# e.g new package "Cloning compatanaapps from sfl/MCL/sftools/ana/compatanaapps..."
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    35
	# e.g. existing package "Updating helix from sfl/MCL/sf/mw/helix..."
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    36
	# e.g. with -exec option "Processing sfl/FCL/interim/auxiliary_tools/AgileBrowser."
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    37
	elsif ($line =~ m/Cloning (.*?)from(.*)$/)
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    38
	{
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    39
		$repo = $2;
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    40
		$newrepo = 1;
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    41
		$retries =0;
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    42
    }
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    43
    elsif ($line =~ m/Updating (.*?)from(.*)$/)
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    44
    {
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    45
		$repo = $2;
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    46
		$newrepo = 0;
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    47
		$retries =0;
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    48
    }
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    49
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    50
    #
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    51
    # Capture number of changes, should be line like one of the following
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    52
	# e.g. "added 4 changesets with 718 changes to 690 files"
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    53
	# e.g. "no changes found"
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    54
	elsif ($line =~ m/added (.*?)changesets with(.*)$/)
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    55
	{
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    56
		print "\n$repo\t added $1 chamgesets";
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    57
		print "\t retries $retries";
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    58
		print "\t** NEW" if ($newrepo);
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    59
    }
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    60
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    61
  if($line =~ m/abort:/)
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    62
  {
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    63
    $retries++;
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    64
  }
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    65
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    66
	# Process the summary section
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    67
	# e.g. "------------"
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    68
	# e.g. "Processed 22 packages, of which 0 reported errors"
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    69
	if ($line =~ m/Processed (.*?)packages, of which(.*?)reported errors/)
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    70
	{
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    71
		print "\n-------------------------------\n";
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    72
		print "\n Summary: Processed $1 : Errors $2\n";
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    73
		$errors= $2;
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    74
		$summary = 1;
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    75
	}
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    76
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    77
}
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    78
if ($errors > 0)
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    79
{
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    80
	print "\nexit with error\n";
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    81
	exit 1;
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    82
}
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    83
else
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    84
{
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    85
  print "\nexit success\n";
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    86
	exit 0;
3efaaf387e1a add utils to parse output of clone_all_packages.pl and to remove credentials from the local clone
andysimpson
parents:
diff changeset
    87
}