Blob Blame History Raw
#!/usr/bin/perl -w
use strict;

my $one = shift;
my $two = shift;

sub convert($$) {
	my $in = shift;
	my $out = shift;
	open(IN, "<$in") || die "cannot open '$in'";

	while (<IN>) {
		s/^[[ 0-9s]*\] //;
		last if (/^\+ make .*all CONFIG_DEBUG_SECTION_MISMATCH/);
	}

	my @lines;
	my $start = 1;
	while (<IN>) {
		s/^[[ 0-9s]*\] //;
		next if ($start && /^\+/);
		$start = 0;
		last if (/^\+/);
		s/2\.6\.[0-9]+(\.[0-9]+)?//g;
		s/3\.[0-9]+(\.[0-9]+)?//g;
		s@/home/abuild/rpmbuild/@@g;
		s@/usr/src/packages/@@g;
		s/^CRC [0-9a-z]+$//g;
		s/^System is [0-9]+ kB$//g;
		s/^Root device is .*//g;
		if (/^(.+)(  (CC|LD|UNROLL) .*)$/) {
			push @lines, "$1\n";
			push @lines, "$2\n";
		} else {
			push @lines, $_;
		}
	}
	close IN;

	open(OUT, ">", $out) || die "cannot open '$out'";
	map { print OUT } sort @lines;
	close OUT;
}

convert($one, "/tmp/one.$$");
convert($two, "/tmp/two.$$");

system "diff -u -w -b -B /tmp/one.$$ /tmp/two.$$";

unlink "/tmp/one.$$";
unlink "/tmp/two.$$";

1;