diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-02-12 23:10:46 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-02-12 23:10:46 -0800 |
commit | 6ccfe3c5a9783067ab40dc698517f181d4cfd349 (patch) | |
tree | 667abcfba4e1c291654770a03b33a15469230ae1 | |
parent | 1620acac65f1ba79d2842a024f137ccc676613fc (diff) | |
download | ltsi-kernel-6ccfe3c5a9783067ab40dc698517f181d4cfd349.tar.gz |
Added a script to generate android patches from mainline.
Use with care.
-rwxr-xr-x | scripts/android_patch_generation.pl | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/scripts/android_patch_generation.pl b/scripts/android_patch_generation.pl new file mode 100755 index 00000000000000..f20003f7b8637e --- /dev/null +++ b/scripts/android_patch_generation.pl @@ -0,0 +1,53 @@ +#!/usr/bin/perl -w + + + +$start = shift; +$end = shift; + +if (($start eq "") || ($end eq "")) { + print "Error, must provide 2 git ids to generate patches between\n"; + die; +} + +open GIT, "git rev-list --no-merges --reverse $start..$end drivers/staging/android/ | " || die "can't run git"; + +my $commit; +my $patch_num = 0; +my $patch_string; +my $git_filename; +my $filename; +my $line; + + +while (<GIT>) { + my $header_complete = "false"; + $patch_num++; + $patch_string = sprintf("%.4d", $patch_num); + my @arr = split; + $commit = $arr[0]; + + $git_filename = `git show --pretty=format:%f $commit | head -n 1`; + chomp($git_filename); + + $filename = sprintf("android-%.4d-%.60s.patch", $patch_num, $git_filename); + + open FILE, ">$filename" || die "Failed to create $filename"; + print "$filename\n"; + + open PATCH, "git show --pretty=email $commit |" || die "Could not get commit $commit"; + while ($line = <PATCH>) { + $line =~ s/^Subject: \[PATCH\]/Subject:/; + + if ($header_complete eq "false") { + if ($line eq "\n") { + print FILE "Patch-mainline: $end\n"; + print FILE "Git-commit: $commit\n"; + $header_complete = "true"; + } + } + print FILE $line; + } + close PATCH; + close FILE; +} |