Open Configure to the world of 64bitonly environments
[p5sagit/p5-mst-13.2.git] / packed_files.pl
CommitLineData
687d3573 1#!perl
2use strict;
3use Getopt::Std;
4
5my $opts = {};
6getopts('uch', $opts );
7
8die usage() if $opts->{'h'} or ( not $opts->{'u'} and not $opts->{'c'} );
9
10my $Pack = 'pack.pl';
11die "Could not find $Pack" unless -e $Pack;
12
13open my $fh, "MANIFEST" or die "Could not open MANIFEST";
14
15while( my $line = <$fh> ) {
16 chomp $line;
17 my ($file) = split /\s+/, $line;
18
19 next unless $file =~ /\.packed/;
20
21 my $out = $file;
22 $out =~ s/\.packed//;
23
24 ### unpack
25 if( $opts->{'u'} ) {
26
27 my $cmd = "$^X -Ilib $Pack -u -v $file $out";
28 system( $cmd ) and die "Could not unpack $file: $?";
29
30 ### clean up
31 } else {
32
33 ### file exists?
34 unless( -e $out ) {
35 print "File $file was not unpacked into $out. Can not remove.\n";
36
37 ### remove it
38 } else {
39 print "Removing $out\n";
40 1 while unlink $out;
41 }
42 }
43}
44
45sub usage {
46 return qq[
47Usage: $^X $0 -u | -c | -h
48
49 Unpack or clean up .packed files from the source tree.
50 This program is just a wrapper around $Pack.
51
52Options:
53 -u Unpack all files in this source tree
54 -c Clean up all unpacked files from this source tree
55 -h Display this help text
56
57];
58}