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.
This commit is contained in:
parent
996a0fa54e
commit
523d987dc7
13
kernel.spec
13
kernel.spec
@ -409,7 +409,7 @@ Source0: ftp://ftp.kernel.org/pub/linux/kernel/v4.x/linux-%{kversion}.tar.xz
|
|||||||
|
|
||||||
Source10: perf-man-%{kversion}.tar.gz
|
Source10: perf-man-%{kversion}.tar.gz
|
||||||
Source11: x509.genkey
|
Source11: x509.genkey
|
||||||
|
Source12: remove-binary-diff.pl
|
||||||
Source15: merge.pl
|
Source15: merge.pl
|
||||||
Source16: mod-extra.list
|
Source16: mod-extra.list
|
||||||
Source17: mod-extra.sh
|
Source17: mod-extra.sh
|
||||||
@ -1118,17 +1118,19 @@ if [ ! -d kernel-%{kversion}%{?dist}/vanilla-%{vanillaversion} ]; then
|
|||||||
cp -al vanilla-%{kversion} vanilla-%{vanillaversion}
|
cp -al vanilla-%{kversion} vanilla-%{vanillaversion}
|
||||||
cd vanilla-%{vanillaversion}
|
cd vanilla-%{vanillaversion}
|
||||||
|
|
||||||
|
cp %{SOURCE12} .
|
||||||
|
|
||||||
# Update vanilla to the latest upstream.
|
# Update vanilla to the latest upstream.
|
||||||
# (non-released_kernel case only)
|
# (non-released_kernel case only)
|
||||||
%if 0%{?rcrev}
|
%if 0%{?rcrev}
|
||||||
xzcat %{SOURCE5000} | patch -p1 -F1 -s
|
xzcat %{SOURCE5000} | ./remove-binary-diff.pl | patch -p1 -F1 -s
|
||||||
%if 0%{?gitrev}
|
%if 0%{?gitrev}
|
||||||
xzcat %{SOURCE5001} | patch -p1 -F1 -s
|
xzcat %{SOURCE5001} | ./remove-binary-diff.pl | patch -p1 -F1 -s
|
||||||
%endif
|
%endif
|
||||||
%else
|
%else
|
||||||
# pre-{base_sublevel+1}-rc1 case
|
# pre-{base_sublevel+1}-rc1 case
|
||||||
%if 0%{?gitrev}
|
%if 0%{?gitrev}
|
||||||
xzcat %{SOURCE5000} | patch -p1 -F1 -s
|
xzcat %{SOURCE5000} | ./remove-binary-diff.pl | patch -p1 -F1 -s
|
||||||
%endif
|
%endif
|
||||||
%endif
|
%endif
|
||||||
git init
|
git init
|
||||||
@ -2140,6 +2142,9 @@ fi
|
|||||||
#
|
#
|
||||||
#
|
#
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Oct 12 2016 Laura Abbott <labbott@redhat.com>
|
||||||
|
- Add script to remove binary diffs
|
||||||
|
|
||||||
* Wed Oct 12 2016 Laura Abbott <labbott@redhat.com> - 4.9.0-0.rc0.git7.1
|
* Wed Oct 12 2016 Laura Abbott <labbott@redhat.com> - 4.9.0-0.rc0.git7.1
|
||||||
- Linux v4.8-14109-g1573d2c
|
- Linux v4.8-14109-g1573d2c
|
||||||
- Drop the extra parallel build optiosn from perf since perf does that on
|
- Drop the extra parallel build optiosn from perf since perf does that on
|
||||||
|
32
remove-binary-diff.pl
Executable file
32
remove-binary-diff.pl
Executable file
@ -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;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user