2014-08-01 Tom de Vries <tom@codesourcery.com>
* mklog-in-patch: New script.
new file mode 100755
@@ -0,0 +1,61 @@
+#!/bin/sh
+
+# Copyright (C) 2014 Free Software Foundation, Inc.
+#
+# This file is part of GCC.
+#
+# GCC is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GCC is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING. If not, write to
+# the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+
+# Check for errors
+set -e
+
+scriptdir=$(dirname $0)
+prog=$(basename $0)
+
+diff="$1"
+
+if [ "$diff" = "" ]; then
+ usage
+ echo <<EOF
+usage: $prog file.diff
+
+Invokes mklog, and prepends the generated log to file.diff.
+EOF
+elif [ ! -r "$diff" ]; then
+ echo "Could not open file $diff for reading"
+ exit 1
+fi
+
+temp=$(mktemp)
+
+# Generate log in $temp
+if ! $scriptdir/mklog "$diff" > "$temp"; then
+ echo "Could not write log file to $temp"
+ exit 1
+fi
+
+# Append patch to $temp, and move $temp to $patch. For the latter, we use cat
+# rather than mv to keep $diff permissions the same.
+if ! ( cat $diff >>$temp && cat $temp >$diff ); then
+ echo "Could not add the ChangeLog entry to $diff"
+ exit 1
+fi
+
+if ! rm $temp; then
+ echo "Could not remove $temp"
+ exit 1
+fi