From: Tom de Vries Date: Mon, 22 Sep 2014 12:53:12 +0000 (+0000) Subject: Add --inline option to contrib/mklog X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=38278d8a9c97abd336ad3d565ecf7b18ad3d23ed;p=gcc.git Add --inline option to contrib/mklog 2014-09-22 Tom de Vries * mklog: Add --inline option. From-SVN: r215462 --- diff --git a/contrib/ChangeLog b/contrib/ChangeLog index d9ab9015fc3..f7cb37e9aab 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 3d17dc54891..6ed4c6e8f51 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;