my $firstline = "true";
my $git_id;
my $header_complete = "false";
+my $signed_off_by_seen = "false";
+my $signed_off_by_complete = "false";
my $tmpfile;
+my $kernel_version;
+
+
+$SIG{__DIE__} = sub
+{
+ # what usually happens is we don't have the git version, so clean up
+ # the temp file we created.
+ if ($tmpfile ne "") {
+ unlink $tmpfile;
+ }
+};
$numArgs = $#ARGV + 1;
-if ($numArgs != 1) {
+if ($numArgs < 1) {
print "must provide git id\n";
exit;
}
exit;
}
+$kernel_version = shift;
+if (!defined($kernel_version)) {
+ $kernel_version = "";
+}
+
#print "handing commit id $base_id\n";
$tmpfile = `mktemp patch.XXXXX` || die "Failed to run mktemp";
open GIT, "git show --pretty=email $base_id |" || die "Failed to run git";
while ($line = <GIT>) {
+ # clean up the subject line, stripping off the [PATCH] prefix
$line =~ s/^Subject: \[PATCH\]/Subject:/;
-# if (($line =~ m/^diff --git/) {
- print FILE $line;
-# }
+
+ if ($line =~m/^Signed-off-by:/) {
+ $signed_off_by_seen = "true";
+ }
+
+ if ($signed_off_by_seen eq "true") {
+ if ($signed_off_by_complete eq "false") {
+ if ($line eq "\n") {
+ print FILE "Signed-off-by: Greg Kroah-Hartman <gregkh\@linuxfoundation.org>\n";
+ $signed_off_by_complete = "true";
+ $signed_off_by_seen = "false";
+ }
+ }
+ }
+
+ print FILE $line;
+
if ($firstline eq "true") {
my @from = split(/ /, $line);
$git_id = $from[1];
#print "$tmpfile\n";
-system "vim $tmpfile";
+system "vim -c \":set syntax=mail\" $tmpfile";
system "reset";
$new_file = `rename-patch $tmpfile`;
chomp($new_file);
system "mv $new_file ~/linux/stable/";
#print "moved $new_file to ~/linux/stable/\n";
-system "cd ~/linux/stable && ./apply_it $new_file";
-system "cp ~/linux/stable/$new_file ~/linux/longterm";
-system "cd ~/linux/longterm && ./apply_it $new_file";
+system "cd ~/linux/stable && ./apply_it $new_file $kernel_version";
+#system "cp ~/linux/stable/$new_file ~/linux/longterm";
+#system "cd ~/linux/longterm && ./apply_it $new_file";
#TMPFILE1=`mktemp patch.XXXXXX` || exit 1
#TMPFILE2=`mktemp patch.XXXXXX` || exit 1