This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

commitinfo script to check policy, issue warnings (and/or abort commit)


I wrote:

> In addition to any English description, a good place to document this
> policy might be in CVSROOT/commitinfo and a supporting script. [...]

I have finished updating this proposed commitinfo script based on
Gerald Pfeifer, Alexandre Oliva and Mark Mitchell's comments.  The
script has been completed based upon the initial idea and fully tested
in my environment, but someone with shell access to gcc.gnu.org will
have to take over from here and build the contents of
CVSROOT/commitinfo based on the sample in the comment.  Notice that
the GCC Steering Committee can set policy along two lines.

Although I think it is a cool idea, I did not incorporate the
suggestion to open an X11 connection back to client to ask questions
since that would require other policy changes (someone could add this
later).  I also think it might be a good idea if this script used data
from external files instead of being fairly hard-coded (again, someone
could change it later - and the current method has the benefit of
being very straightforward code).

If we want to force people to use `cvs import' to bring libtool into
our source tree (i.e. prevent_commit=0), then this documentation
should appear in http://gcc.gnu.org/codingconventions.html:

Here is a correct way to use CVS vendor branches with the import
policy rules for libtool (this example for libtool only, but
config.guess, etc should be similar):

1. Create an empty directory (i.e. do not work in a checked-out CVS
   working tree).  Populate it with upgraded libtool files taken from
   the master repository on subversion.gnu.org.

2. Run: cvs import /cvs/gcc SUBVERSION LIBTOOL_RELEASE_NUMBER
   within the directory populated in step 1.

3. Ignore any merge warnings the first time this is done.

4. Run: cvs admin -bSUBVERSION ltconfig ltmain.sh libtool.m4 ltcf-*.sh
   at the top level of a checked-out CVS working tree.

If we want to just warn when libtool files are changed
(i.e. prevent_commit=1), then the existing documentation should be OK.
The person's commit will succeed, but they will have been given a
message explaining why they might have broken protocol with a pointer
to more information.  Enabling e-mail (i.e. send_mail=0) only makes
sense when we do not prevent the commit.

Regards,
Loren

#!/bin/sh
#
# This commitinfo script warns a commiter of violations of the policy
# encoded in http://gcc.gnu.org/codingconventions.html section
# "Upstream packages" and suggests actions to be handled outside CVS.
# Upon request, it may be configured to never prevent a commit and to
# send mail to gcc@gcc.gnu.org.
#
# Here are the sample contents of CVSROOT/commitinfo to support this
# script (the exact paths must be fully checked by the installer with
# knowledge of gcc.gnu.org's CVS repository layout):
#
# /cvs/gcc/boehm-gc check-gcc-commit
# /cvs/gcc/fastjar check-gcc-commit
# /cvs/gcc/.* true
# /cvs/gcc check-gcc-commit

# GCC Steering Committee settable values
# (all booleans using UNIX shell conventions that 0 is true)

# Should this script prevent the commit if it detects a violation?
prevent_commit=0

# Should this script send e-mail upon issuing a warning?
send_mail=1
send_mail_to=nobody #gcc@gcc.gnu.org

# Run environment settable values

PATH=/bin:/usr/bin

# NO settable values past this point

# Handle warnings for commits into special subdirectories.  This is
# really just a memory aid since it is not wrong to commit these
# changes.
for i in `basename $1`; do case $i in
  boehm-gc)
    echo "WARNING: Patches should be sent to boehm@acm.org, but it was"
    echo "WARNING: acceptable to check them in the GCC CVS tree before"
    echo "WARNING: getting them installed in the master tree."
    exit 0;;
  fastjar)
    echo "WARNING: The master sources are at fastjar.sourceforge.net."
    echo "WARNING: Local patches should be sent upstream, but it was"
    echo "WARNING: acceptable to check them in the GCC CVS tree before"
    echo "WARNING: getting them installed in the master tree."
    exit 0;;
esac; done

message_emitted=1
important_message_emitted=1
imported_files_committed=

shift; for i in $*; do case $i in
  config.guess|config.sub|ltconfig|ltmain.sh|libtool.m4|ltcf-*.sh)
    echo "WARNING: $i should only be upgraded from the related external"
    echo "WARNING: master source repository using 'cvs import'."
    imported_files_committed="$imported_files_committed $i"
    important_message_emitted=0
    message_emitted=0;;
  *)
    echo "WARNING: $i should be synchronized with the corresponding file"
    echo "WARNING: in the src repository at sources.redhat.com."
    message_emitted=0;;
esac; done

if (exit $message_emitted); then
  echo "WARNING: See http://gcc.gnu.org/codingconventions.html for details."
fi

if (exit $important_message_emitted); then
  if (exit $send_mail); then
    mail -s 'CVS commit operation to imported files' $send_mail_to <<EOF
Someone committed a change to the following file(s):
$imported_files_committed

This is usually not the correct procedure to update these file(s).
See http://gcc.gnu.org/codingconventions.html for complete details.
EOF
  fi
  if (exit $prevent_commit); then exit 1; fi
fi

exit 0


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]