Populated Bestine Capitol Building with missing NPCs. Also spawns several other missi...
[swg-src.git] / tools / BuildLivePatchTreeFromChangelists.pl
blob40fcda9a57b4002ec718a31a6f3643f3df876837
1 #!/usr/bin/perl
3 use warnings;
4 use strict;
6 sub numerically
8 $a <=> $b;
11 # check command line arguments
12 if (@ARGV < 2 || ($ARGV[0] =~ /^[-\/]/) || !($ARGV[0] =~ /tre$/i))
14 die "usage: $0 [treefile.tre] [changelist ...]\n";
17 my $tre = shift;
19 # process all changelists gathering up files for the TRE
20 print "Processing changelists\n";
21 my %file;
22 foreach my $changelist (sort numerically @ARGV)
24 print "\t$changelist\n";
25 open(P4, "p4 describe -s $changelist |");
26 while (<P4>)
28 chomp;
29 if (s%^\.\.\. //depot/swg/live/(data/sku.\d+/sys.(client|shared)/[^\/]+/[^\/]+)/%%)
31 my $prefix = $1;
32 s/#\d+ .*//;
33 $file{$_} = "../../$prefix/" . $_;
37 close(P4);
39 print"\n";
41 # generate the tree file response file
42 print "Generating response file\n";
43 my $rsp = $tre;
44 $rsp =~ s/tre$/rsp/i;
45 open(RSP, ">" . $rsp);
46 foreach (sort keys %file)
48 print "\t", $_, " @ ", $file{$_}, "\n";
49 print RSP $_, " @ ", $file{$_}, "\n";
51 close(RSP);
52 print"\n";
54 # build the tree file
55 print "Generating tree file\n";
56 open(TRE, "TreeFileBuilder -r $rsp $tre |");
57 print "\t", $_ while (<TRE>);
58 close(TRE);
59 print "\n";
61 # generate the md5sum for the file
62 print "Generating md5sum\n";
63 my $md5 = $tre;
64 $md5 =~ s/tre$/md5/i;
65 system("md5sum -b $tre > $md5");
66 open(MD5, $md5);
67 print "\t", $_ while (<MD5>);
68 close(MD5);