PR inline-asm/84742
[official-gcc.git] / contrib / prepare_patch.sh
blob8385f315cc36ab644f707c9e1ddadaea0d06f532
1 #!/bin/sh
2 #set -x
4 # Prepares a patch for the patch tester.
5 # Copyright (C) 2007 Free Software Foundation, Inc.
6 # Contributed by Sebastian Pop <sebastian.pop@amd.com>
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 3 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 usage() {
23 cat <<EOF
24 prepare_patch.sh <source_dir> [patches_dir]
26 SOURCE_DIR is the directory containing GCC's toplevel configure.
28 PATCHES_DIR is the directory where the patch will be copied to.
29 Default is SOURCE_DIR/patches.
31 EOF
32 exit 1
35 test $# -eq 0 && usage
37 SOURCE=$1
38 PATCHES=
40 if [[ "$#" < 2 ]]; then
41 PATCHES=$SOURCE/patches
42 else
43 PATCHES=$2
46 [ -f $SOURCE/config.guess ] || usage
47 [ -d $PATCHES ] || mkdir -p $PATCHES
49 echo "Enter a name for this patch: "
50 read name
51 PATCH=$PATCHES/`TZ=UTC date +"%Y_%m_%d_%H_%M_%S"`_$name.diff
53 echo "Enter the email where the report should be sent: "
54 read email
55 echo "email:$email" >> $PATCH
57 branch=`svn info $SOURCE | grep URL: | sed -e "s/^URL: //g"`
58 echo "Enter svn branch (svn info in $SOURCE reports $branch, default is trunk): "
59 read svn_branch
60 if [ x$svn_branch = x ]; then
61 svn_branch=trunk
63 echo "branch:$svn_branch" >> $PATCH
65 revision=`svn info $SOURCE | grep Revision: | sed -e "s/^Revision: //g"`
66 echo "Enter svn revision (svn info in $SOURCE reports $revision, default is HEAD): "
67 read svn_revision
68 if [ x$svn_revision = x ]; then
69 svn_revision=HEAD
71 echo "revision:$svn_revision" >> $PATCH
73 echo "Enter configure options: "
74 read configure_options
75 echo "configure:$configure_options" >> $PATCH
77 echo "Enter make options: "
78 read make_options
79 echo "make:$make_options" >> $PATCH
81 echo "Enter make check options: "
82 read check_options
83 echo "check:$check_options" >> $PATCH
85 echo "" >> $PATCH
87 svn diff $SOURCE | tee -a $PATCH
89 cat <<EOF
91 You can now edit your patch, include a ChangeLog, and before
92 submitting to the patch tester, don't forget to sign it with:
94 gpg --clearsign $PATCH
96 EOF