williamr/compare_7z_listings.pl
author William Roberts <williamr@symbian.org>
Fri, 03 Sep 2010 13:41:03 +0100
changeset 293 e9c03eb287f9
parent 2 a600c1a596f7
permissions -rw-r--r--
Update to reflect new packages
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
     1
#!/usr/bin/perl
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
     2
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
     3
# Copyright (c) 2009 Symbian Foundation Ltd
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
     4
# This component and the accompanying materials are made available
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
     5
# under the terms of the License "Eclipse Public License v1.0"
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
     6
# which accompanies this distribution, and is available
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
     7
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
     8
#
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
     9
# Initial Contributors:
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    10
# Symbian Foundation Ltd - initial contribution.
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    11
# 
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    12
# Contributors:
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    13
#
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    14
# Description:
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    15
# Compare two 7z listings, looking for files present in both
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    16
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    17
use strict;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    18
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    19
my %first_files;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    20
my $line;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    21
my $file_index = -1;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    22
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    23
while ($line=<>)
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    24
  {
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    25
  
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    26
  if ($line =~ /^Listing archive/)
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    27
    {
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    28
    $file_index++;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    29
    print "$file_index: Processing $line";
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    30
    next;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    31
    }
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    32
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    33
  # 2009-04-30 11:26:58 D....            0            0  epoc32\cshlpcmp_template
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    34
  # 2009-03-20 22:22:18 .....        72192        16307  epoc32\cshlpcmp_template\cshelp2000.dot
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    35
  
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    36
  next if (length($line) < 54);
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    37
  
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    38
  my $dir_attribute = substr($line, 20, 1);  
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    39
  if ($dir_attribute eq ".")
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    40
    {
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    41
    chomp $line;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    42
    my $fullpath = substr($line, 53);
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    43
    
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    44
    if ($file_index == 0)
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    45
      {
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    46
      # first file
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    47
      $first_files{$fullpath} = $line;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    48
      next;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    49
      }
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    50
    if (defined $first_files{$fullpath})
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    51
      {
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    52
      print "Duplicate filename: $fullpath\n";
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    53
      print "\t$first_files{$fullpath}\n\t$line\n";
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    54
      next
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    55
      }
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    56
    }
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    57
  }
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    58