CLOSED TREE: TraceMonkey merge head. (a=blockers)
[mozilla-central.git] / tools / update-packaging / unwrap_full_update.pl
blobab191287478097d5376d9c587b5b2a1f0f899c46
1 #!/usr/bin/perl -w
3 # This tool unpacks a full update package generated by make_full_update.sh
4 # Author: Benjamin Smedberg
7 # -----------------------------------------------------------------------------
8 # By default just assume that these tools exist on our path
10 use Getopt::Std;
12 my ($MAR, $BZIP2, $archive, @marentries, @marfiles);
14 if (defined($ENV{"MAR"})) {
15 $MAR = $ENV{"MAR"};
17 else {
18 $MAR = "mar";
21 if (defined($ENV{"BZIP2"})) {
22 $BZIP2 = $ENV{"BZIP2"};
24 else {
25 $BZIP2 = "bzip2";
28 sub print_usage
30 print "Usage: unwrap_full_update.pl [OPTIONS] ARCHIVE\n\n";
31 print "The contents of ARCHIVE will be unpacked into the current directory.\n\n";
32 print "Options:\n";
33 print " -h show this help text\n";
36 my %opts;
37 getopts("h", \%opts);
39 if (defined($opts{'h'}) || scalar(@ARGV) != 1) {
40 print_usage();
41 exit 1;
44 $archive = $ARGV[0];
45 @marentries = `"$MAR" -t "$archive"`;
47 $? && die("Couldn't run \"$MAR\" -t");
49 shift @marentries;
51 system("$MAR -x \"$archive\"") == 0 || die "Couldn't run $MAR -x";
53 foreach (@marentries) {
54 tr/\n\r//d;
55 my @splits = split(/\t/,$_);
56 my $file = $splits[2];
58 system("mv \"$file\" \"$file.bz2\"") == 0 ||
59 die "Couldn't mv \"$file\"";
60 system("\"$BZIP2\" -d \"$file.bz2\"") == 0 ||
61 die "Couldn't decompress \"$file\"";