-
Notifications
You must be signed in to change notification settings - Fork 3
/
makediffs.pl
executable file
·50 lines (40 loc) · 1.54 KB
/
makediffs.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/perl -w
use strict;
use File::Temp qw(tmpnam);
sub dosys {
print "@_\n";
system @_;
}
sub do_diff {
my ($major, $minor, $micro) = @_;
my $latest_ver = "$major.$minor.$micro";
my $latest = "bugzilla-$latest_ver";
my $base = "bugzilla-$major.$minor";
my @prior_micro = map { ".$_" } (1..$micro-1);
foreach my $this ('', @prior_micro) {
my $diffing = "$base$this";
# Move the $base/lib and $diffing/lib to temporary locations
# so we don't include them in the diffs
my $latest_tempdir_name = tmpnam();
my $diffing_tempdir_name = tmpnam();
dosys("mv $latest/lib $latest_tempdir_name");
dosys("mv $diffing/lib $diffing_tempdir_name");
dosys("diff -urN --exclude=CVS --exclude=*.pdf --exclude=.bzr --exclude=.git"
. " $diffing $latest > $diffing-to-$latest_ver.diff");
dosys("gzip $diffing-to-$latest_ver.diff");
dosys("diff -urN --exclude=CVS --exclude=docs --exclude=.bzr --exclude=.git"
. " $diffing $latest > $diffing-to-$latest_ver-nodocs.diff");
dosys("gzip $diffing-to-$latest_ver-nodocs.diff");
# Move the lib directories back
dosys("mv $latest_tempdir_name $latest/lib");
dosys("mv $diffing_tempdir_name $diffing/lib");
}
}
my @tarballs = glob('./bugzilla-*.tar.gz');
foreach my $tarball (@tarballs) {
if ($tarball =~ /bugzilla-(\d)\.(\d+)\.(\d+).tar.gz/) {
my ($major, $minor, $micro) = ($1, $2, $3);
next if $minor % 2; # Don't do odd-numbered releases
do_diff($major, $minor, $micro);
}
}