]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
updated c2p script
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 24 Feb 2014 20:22:05 +0000 (12:22 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 24 Feb 2014 20:22:05 +0000 (12:22 -0800)
scripts/c2p

index 6a64ef127c98a5c32763dd12dc8087535532b7d0..208c7b12ab5313b9d2997d9f4d872983150ef8c8 100755 (executable)
@@ -11,10 +11,23 @@ my $line;
 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;
 }
@@ -26,6 +39,11 @@ if ($base_id eq "") {
        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";
@@ -36,10 +54,25 @@ open FILE, ">$tmpfile" || die "Failed to create $tmpfile";
 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];
@@ -59,16 +92,16 @@ close FILE;
 
 #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