From: vries Date: Mon, 22 Sep 2014 12:53:12 +0000 (+0000) Subject: Add --inline option to contrib/mklog X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3979f78787bdc6db3e1679b6015a1a403bb097ba;p=thirdparty%2Fgcc.git Add --inline option to contrib/mklog 2014-09-22 Tom de Vries * mklog: Add --inline option. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@215462 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/contrib/ChangeLog b/contrib/ChangeLog index d9ab9015fc37..f7cb37e9aab7 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,3 +1,7 @@ +2014-09-22 Tom de Vries + + * mklog: Add --inline option. + 2014-09-19 Segher Boessenkool * dg-extract-results.py (Prog.result_re): Include options in test name. diff --git a/contrib/mklog b/contrib/mklog index 3d17dc548912..6ed4c6e8f51e 100755 --- a/contrib/mklog +++ b/contrib/mklog @@ -26,6 +26,9 @@ # Author: Diego Novillo and # Cary Coutant +use File::Temp; +use File::Copy qw(cp mv); + # Change these settings to reflect your profile. $username = $ENV{'USER'}; $name = `finger $username | grep -o 'Name: .*'`; @@ -56,14 +59,22 @@ if (-d "$gcc_root/.git") { # Program starts here. You should not need to edit anything below this # line. #----------------------------------------------------------------------------- -if ($#ARGV != 0) { +$inline = 0; +if ($#ARGV == 1 && ("$ARGV[0]" eq "-i" || "$ARGV[0]" eq "--inline")) { + shift; + $inline = 1; +} elsif ($#ARGV != 0) { $prog = `basename $0`; chop ($prog); print <', $tmp) or die "Could not open temp file: $!"; +} else { + *OUTPUTFILE = STDOUT; +} + +# Print the log foreach my $clname (keys %cl_entries) { - print "$clname:\n\n$hdrline\n\n$cl_entries{$clname}\n"; + print OUTPUTFILE "$clname:\n\n$hdrline\n\n$cl_entries{$clname}\n"; +} + +if ($inline) { + # Append the patch to the log + foreach (@diff_lines) { + print OUTPUTFILE "$_\n"; + } +} + +if ($inline && $diff ne "-") { + # Close $tmp + close(OUTPUTFILE); + + # Write new contents to $diff atomically + mv $tmp, $diff or die "Could not move temp file to patch file: $!"; } exit 0;