tleleu / rpms / kernel

Forked from rpms/kernel 3 years ago
Clone
f2c60e
#!/usr/bin/perl -w
f2c60e
# A script to remove those terrible binary diffs from the patches which
f2c60e
# screw up everything and rain on my parade.
f2c60e
f2c60e
use strict;
f2c60e
f2c60e
my @args=@ARGV;
f2c60e
my @current_patch;
f2c60e
my $is_binary = 0;
f2c60e
my $cnt = 0;
f2c60e
f2c60e
while(my $row = <>) {
f2c60e
	# diff marks the start of a new file to check
f2c60e
	if ($row =~ /^diff --git.*?(\S+)$/) {
f2c60e
		if (!$is_binary) {
f2c60e
			foreach my $line (@current_patch) {
f2c60e
				print $line;
f2c60e
			}
f2c60e
		}
f2c60e
		$is_binary = 0;
f2c60e
		@current_patch = ();
f2c60e
	} elsif ($row =~ /Binary files (.)* differ$/) {
f2c60e
		$is_binary = 1;
f2c60e
	} elsif ($row =~ /GIT binary patch/) {
f2c60e
		$is_binary = 1;
f2c60e
	}
f2c60e
	push (@current_patch, $row);
f2c60e
}
f2c60e
f2c60e
if (!$is_binary) {
f2c60e
	foreach my $line (@current_patch) {
f2c60e
		print $line;
f2c60e
	}
f2c60e
}