summaryrefslogtreecommitdiffstats
path: root/remove-binary-diff.pl
diff options
context:
space:
mode:
authorLaura Abbott <labbott@fedoraproject.org>2016-10-12 13:37:34 -0700
committerLaura Abbott <labbott@fedoraproject.org>2016-10-12 13:37:37 -0700
commit523d987dc764b6ab70c3cded2f1de090d2cbf311 (patch)
treeefa551c2f418ce6fe0009f8fc05ed39b744761f3 /remove-binary-diff.pl
parent996a0fa54e63f422431f4fdf3660c8a574db2883 (diff)
downloadkernel-523d987dc764b6ab70c3cded2f1de090d2cbf311.tar.gz
kernel-523d987dc764b6ab70c3cded2f1de090d2cbf311.tar.xz
kernel-523d987dc764b6ab70c3cded2f1de090d2cbf311.zip
Add script to remove binary diffs
Once upon a time, the kernel was just a series of patches. These days, git manages most of the kernel. git can do many useful things, such as maintain binary files. Binary file changes are not easily expressed in patches and can't be applied without using git. Remove the binary diffs from any snapshot or -rc patches. We will eventually pick up the changes/deletions in the final release tarball.
Diffstat (limited to 'remove-binary-diff.pl')
-rwxr-xr-xremove-binary-diff.pl32
1 files changed, 32 insertions, 0 deletions
diff --git a/remove-binary-diff.pl b/remove-binary-diff.pl
new file mode 100755
index 000000000..520ac5d73
--- /dev/null
+++ b/remove-binary-diff.pl
@@ -0,0 +1,32 @@
+#!/usr/bin/perl -w
+# A script to remove those terrible binary diffs from the patches which
+# screw up everything and rain on my parade.
+
+use strict;
+
+my @args=@ARGV;
+my @current_patch;
+my $is_binary = 0;
+my $cnt = 0;
+
+while(my $row = <>) {
+ # diff marks the start of a new file to check
+ if ($row =~ /^diff --git.*?(\S+)$/) {
+ if (!$is_binary) {
+ foreach my $line (@current_patch) {
+ print $line;
+ }
+ }
+ $is_binary = 0;
+ @current_patch = ();
+ } elsif ($row =~ /Binary files (.)* differ$/) {
+ $is_binary = 1;
+ }
+ push (@current_patch, $row);
+}
+
+if (!$is_binary) {
+ foreach my $line (@current_patch) {
+ print $line;
+ }
+}