public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* commitinfo script to check policy, issue warnings (and/or abort commit)
@ 2001-05-14 13:54 Loren James Rittle
  2001-05-14 17:45 ` commitinfo script to check policy, issue warnings (and/orabort commit) Mark Mitchell
                   ` (4 more replies)
  0 siblings, 5 replies; 23+ messages in thread
From: Loren James Rittle @ 2001-05-14 13:54 UTC (permalink / raw)
  To: gcc

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2001-05-24  6:15 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-14 13:54 commitinfo script to check policy, issue warnings (and/or abort commit) Loren James Rittle
2001-05-14 17:45 ` commitinfo script to check policy, issue warnings (and/orabort commit) Mark Mitchell
2001-05-16  0:57 ` commitinfo script to check policy, issue warnings (and/or abort commit) Alexandre Oliva
2001-05-16  1:31   ` commitinfo script to check policy, issue warnings (and/or abortcommit) Gerald Pfeifer
2001-05-18 11:43     ` Loren James Rittle
2001-05-18 11:46     ` Loren James Rittle
2001-05-18 11:40   ` commitinfo script to check policy, issue warnings (and/or abort commit) Loren James Rittle
2001-05-19 18:46     ` Alexandre Oliva
2001-05-20 10:17       ` commitinfo script to check policy, issue warnings (and/orabort commit) Mark Mitchell
2001-05-24  6:15         ` Loren James Rittle
2001-05-16  1:38 ` commitinfo script to check policy, issue warnings (and/or abort commit) Alexandre Oliva
2001-05-18 11:49   ` Loren James Rittle
2001-05-18 12:58     ` commitinfo script to check policy, issue warnings (and/or abortcommit) Joseph S. Myers
2001-05-18 13:24       ` Loren James Rittle
2001-05-16  6:38 ` Gerald Pfeifer
2001-05-16  9:24   ` commitinfo script to check policy, issue warnings (and/or abort commit) Alexandre Oliva
2001-05-18 12:14   ` commitinfo script to check policy, issue warnings (and/or abortcommit) Loren James Rittle
2001-05-16 13:31 ` commitinfo script to check policy, issue warnings (and/or abort commit) Marc Espie
2001-05-16 15:12   ` Branko
2001-05-17  6:07     ` Marc Espie
2001-05-17 12:08       ` Branko
2001-05-17 20:18   ` Loren James Rittle
2001-05-17 22:22     ` Fergus Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).