From: Greg Kroah-Hartman Date: Mon, 24 Feb 2014 20:22:05 +0000 (-0800) Subject: updated c2p script X-Git-Tag: v3.10.33~55 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b34caee80e06963415be0fad52c0cbfd79183bef;p=thirdparty%2Fkernel%2Fstable-queue.git updated c2p script --- diff --git a/scripts/c2p b/scripts/c2p index 6a64ef127c9..208c7b12ab5 100755 --- a/scripts/c2p +++ b/scripts/c2p @@ -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 = ) { + # 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 \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