common/tools/detectArchiveCollisions.pl
author Simon Howkins <simonh@symbian.org>
Thu, 14 Oct 2010 16:29:33 +0100
changeset 1271 77ff148fa4d2
permissions -rw-r--r--
Added a post build check that the release zips don't collide. Collisions are BRAG affecting.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1271
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
     1
#!perl -w
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
     2
# Copyright (c) 2010 Symbian Foundation Ltd
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
     3
# This component and the accompanying materials are made available
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
     4
# under the terms of the License "Eclipse Public License v1.0"
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
     5
# which accompanies this distribution, and is available
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
     6
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
     7
#
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
     8
# Initial Contributors:
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
     9
# Symbian Foundation Ltd - initial contribution.
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    10
# 
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    11
# Contributors:
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    12
#
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    13
# Description:
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    14
# Identify collisions between file archives
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    15
#
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    16
# Usage:
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    17
# detectArchiveCollisions.pl this.zip that.zip several_*.zip and\also_*.7z
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    18
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    19
use strict;
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    20
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    21
# Expand shell wildcards
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    22
@ARGV = map { glob $_ } @ARGV;
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    23
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    24
my $data;
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    25
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    26
foreach my $archive (@ARGV)
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    27
{
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    28
	print "Reading $archive...\n";
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    29
	my $file = undef;
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    30
	foreach my $line (`7z l -slt $archive`)
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    31
	{
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    32
		if ($line =~ m{^Path = (.*)})
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    33
		{
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    34
			$file = $1;
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    35
			next;
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    36
		}
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    37
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    38
		if ($line =~ m{^Folder = -})
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    39
		{
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    40
			# Record this (non-directory) item
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    41
			push @{$data->{$file}}, $archive;
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    42
			next;
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    43
		}
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    44
	}
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    45
}
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    46
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    47
foreach my $file (sort keys %$data)
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    48
{
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    49
	next unless scalar @{$data->{$file}} > 1;
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    50
	print "ERROR: $file\n";
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    51
	foreach (@{$data->{$file}})
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    52
	{
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    53
		print "\t$_\n";
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    54
	}
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    55
}
77ff148fa4d2 Added a post build check that the release zips don't collide.
Simon Howkins <simonh@symbian.org>
parents:
diff changeset
    56