prepare_patch.sh 2.5 KB

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