| 1 |
#!/bin/sh |
| 2 |
#set -x |
| 3 |
|
| 4 |
# Prepares a patch for the patch tester. |
| 5 |
# Copyright (C) 2007-2025 Free Software Foundation, Inc. |
| 6 |
# Contributed by Sebastian Pop <[email protected]> |
| 7 |
|
| 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. |
| 12 |
|
| 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. |
| 17 |
|
| 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 |
| 21 |
|
| 22 |
usage() { |
| 23 |
cat <<EOF |
| 24 |
prepare_patch.sh <source_dir> [patches_dir] |
| 25 |
|
| 26 |
SOURCE_DIR is the directory containing GCC's toplevel configure. |
| 27 |
|
| 28 |
PATCHES_DIR is the directory where the patch will be copied to. |
| 29 |
Default is SOURCE_DIR/patches. |
| 30 |
|
| 31 |
EOF |
| 32 |
exit 1 |
| 33 |
} |
| 34 |
|
| 35 |
test $# -eq 0 && usage |
| 36 |
|
| 37 |
SOURCE=$1 |
| 38 |
PATCHES= |
| 39 |
|
| 40 |
if [[ "$#" < 2 ]]; then |
| 41 |
PATCHES=$SOURCE/patches |
| 42 |
else |
| 43 |
PATCHES=$2 |
| 44 |
fi |
| 45 |
|
| 46 |
[ -f $SOURCE/config.guess ] || usage |
| 47 |
[ -d $PATCHES ] || mkdir -p $PATCHES |
| 48 |
|
| 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 |
| 52 |
|
| 53 |
echo "Enter the email where the report should be sent: " |
| 54 |
read email |
| 55 |
echo "email:$email" >> $PATCH |
| 56 |
|
| 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 |
| 62 |
fi |
| 63 |
echo "branch:$svn_branch" >> $PATCH |
| 64 |
|
| 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 |
| 70 |
fi |
| 71 |
echo "revision:$svn_revision" >> $PATCH |
| 72 |
|
| 73 |
echo "Enter configure options: " |
| 74 |
read configure_options |
| 75 |
echo "configure:$configure_options" >> $PATCH |
| 76 |
|
| 77 |
echo "Enter make options: " |
| 78 |
read make_options |
| 79 |
echo "make:$make_options" >> $PATCH |
| 80 |
|
| 81 |
echo "Enter make check options: " |
| 82 |
read check_options |
| 83 |
echo "check:$check_options" >> $PATCH |
| 84 |
|
| 85 |
echo "" >> $PATCH |
| 86 |
|
| 87 |
svn diff $SOURCE | tee -a $PATCH |
| 88 |
|
| 89 |
cat <<EOF |
| 90 |
|
| 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: |
| 93 |
|
| 94 |
gpg --clearsign $PATCH |
| 95 |
|
| 96 |
EOF |