author | Mike Kinghan <mikek@symbian.org> |
Thu, 25 Nov 2010 13:59:07 +0000 | |
changeset 40 | 68f68128601f |
permissions | -rw-r--r-- |
40
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1 |
#!/usr/bin/perl |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
2 |
# Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
3 |
# All rights reserved. |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
4 |
# This component and the accompanying materials are made available |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
5 |
# under the terms of "Eclipse Public License v1.0" |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
6 |
# which accompanies this distribution, and is available |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
7 |
# at the URL "http://www.eclipse.org/legal/epl-v10.html". |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
8 |
# |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
9 |
# Initial Contributors: |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
10 |
# Nokia Corporation - initial contribution. |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
11 |
# |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
12 |
# Contributors: |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
13 |
# |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
14 |
# Description: |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
15 |
# e32toolp/genutil/listzip.pl |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
16 |
# Utility for listing the contents of a zip file. |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
17 |
# Syntax: |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
18 |
# perl listzip.pl <prefix> <zipfile> |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
19 |
# This command will print all files in the <zipfile>. Each file name is prefixed by |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
20 |
# <prefix> and is printed on a separate line. |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
21 |
# |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
22 |
# |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
23 |
|
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
24 |
# Version |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
25 |
my $MajorVersion = 1; |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
26 |
my $MinorVersion = 1; |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
27 |
my $PatchVersion = 0; |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
28 |
|
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
29 |
sub _print_usage_and_die(); |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
30 |
sub _print_err_and_die(@); |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
31 |
|
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
32 |
sub main(@) |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
33 |
{ |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
34 |
my ($prefix, $zipf, @junk) = @_; |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
35 |
|
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
36 |
_print_usage_and_die() if (!$prefix || !$zipf || @junk); |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
37 |
|
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
38 |
_print_err_and_die("$prefix is not a directory.") unless -d $prefix; |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
39 |
_print_err_and_die("$zipf doesn't exist.") unless -f $zipf; |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
40 |
|
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
41 |
my @raw_data = qx/unzip -l $zipf/; |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
42 |
|
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
43 |
for (@raw_data) |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
44 |
{ |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
45 |
if ($_ =~ /^\s*\d+\s+\d\d[-|\/|\.]\d\d[-|\/|\.]\d\d\s+\d\d:\d\d\s+(.*)/) |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
46 |
{ |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
47 |
my $line = "${prefix}/$1"; |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
48 |
$line =~ s/\//\\/g if($^O =~ /^MSWin32$/i); |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
49 |
# don't print directories under the <build> tags |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
50 |
if (!($line =~ /[\\|\/]$/)) { |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
51 |
print "$line\n"; |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
52 |
} |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
53 |
} |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
54 |
} |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
55 |
} |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
56 |
|
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
57 |
sub _print_usage_and_die() |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
58 |
{ |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
59 |
print "LISTZIP zip files process tool V$MajorVersion.$MinorVersion.$PatchVersion\nusage: listzip.pl <prefix> <zipfile>\n"; |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
60 |
exit 2; |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
61 |
} |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
62 |
|
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
63 |
sub _print_err_and_die(@) |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
64 |
{ |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
65 |
print "listzip.pl: error: @_\n"; |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
66 |
exit 1; |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
67 |
} |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
68 |
|
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
69 |
main(@ARGV); |
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
70 |
|
68f68128601f
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package.
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
71 |