On 01-08-14 06:21, Yury Gribov wrote:
Cc Diego.
-----------------------------------------------
From: Tom de Vries <tom_devr...@mentor.com>
Sent: Saturday, May 31, 2014 11:47AM
To: Geoff Keating <geo...@geoffk.org>
Cc: GCC Patches
Subject: [PATCH] Keep patch file permissions in mklog
On 05/31/2014 11:47 AM, Tom de Vries wrote:
Geoff,
Currently, mklog resets the permissions on a patch file:
Yuri,
Diego,
The permissions problem does not occur anymore with the latests versions of
mklog, since it doesn't modify the patch file anymore.
This patch adds a script contrib/mklog-in-patch, which uses mklog to generate
the skeleton log, but generates the log at the start of the patch as mklog did
before (which is how I like to use it).
OK for trunk?
I can also try to add an --inline option to mklog instead.
Thanks,
- Tom
2014-08-01 Tom de Vries <t...@codesourcery.com>
* mklog-in-patch: New script.
diff --git a/contrib/mklog-in-patch b/contrib/mklog-in-patch
new file mode 100755
index 0000000..6d041eb
--- /dev/null
+++ b/contrib/mklog-in-patch
@@ -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