From owner-svn-src-projects@FreeBSD.ORG Fri Aug 28 10:25:02 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 48619106566B; Fri, 28 Aug 2009 10:25:02 +0000 (UTC) (envelope-from rodrigc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1D8EF8FC14; Fri, 28 Aug 2009 10:25:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7SAP2bo022423; Fri, 28 Aug 2009 10:25:02 GMT (envelope-from rodrigc@svn.freebsd.org) Received: (from rodrigc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7SAP2aG022421; Fri, 28 Aug 2009 10:25:02 GMT (envelope-from rodrigc@svn.freebsd.org) Message-Id: <200908281025.n7SAP2aG022421@svn.freebsd.org> From: Craig Rodrigues Date: Fri, 28 Aug 2009 10:25:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196613 - projects/jbuild/usr.bin/jdirdep X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Aug 2009 10:25:02 -0000 Author: rodrigc Date: Fri Aug 28 10:25:01 2009 New Revision: 196613 URL: http://svn.freebsd.org/changeset/base/196613 Log: - add some help - make sure that ssh-agent is running before invoking svn - pass -F and -m flags down to svn, to facilitate specifying logs Modified: projects/jbuild/usr.bin/jdirdep/jcommit Modified: projects/jbuild/usr.bin/jdirdep/jcommit ============================================================================== --- projects/jbuild/usr.bin/jdirdep/jcommit Fri Aug 28 10:23:40 2009 (r196612) +++ projects/jbuild/usr.bin/jdirdep/jcommit Fri Aug 28 10:25:01 2009 (r196613) @@ -2,6 +2,76 @@ # # $FreeBSD$ # +## NAME: +## jcommit - run "jbuild check-commit", then commit code to repository +## +## SYNOPSIS: +## jcommit [options] +## +## DESCRIPTION: +## +## Verify that code compiles by running "jbuild check-commit". +## If successful, commit code to repository. +## +## OPTIONS: +## +## -h +## --help +## This manual page is emitted. +## +## -F "file" +## Read commit log message from "file". +## +## -m "msg" +## Specify commit log message "msg". +## + +ShowHelp() +{ + grep ^## $0 | sed -e 's/^##//' | ${PAGER} + exit 0 +} + +# Here is a trick to make sure that ssh-agent is running before +# we start doing a bunch of svn operations over ssh. + +# Try to list identities in ssh-agent +ssh-add -l > /dev/null 2>&1 +ret=$? +if [ $ret -eq 2 ] +then + # Couldn't open a connection to ssh-agent, + # so let's start one, and re-execute this script under ssh-agent. + exec ssh-agent $0 "$@" +elif [ $ret -eq 1 ] +then + # Couldn't find passphrase in ssh-agent, so let's + # prompt user for to add passphrase to ssh-agent + ssh-add + if [ $? -ne 0 ] + then + # If user does not have a valid ssh key in $HOME/.ssh, + # then ssh-add will fail, but not print any error messages to stdout. + echo "ERROR: ssh-add FAILED. You may see password prompt" + echo "multiple times, and possibly time out or fail." + echo "Please set up ssh-agent properly to avoid this:" + echo "" + + exit 1 + fi +fi + +# parse flags +while getopts "F:m:h" my_opt +do + case $my_opt in + h) ShowHelp; exit 0;; + F) commit_msg_file="-F $OPTARG" ;; + m) commit_msg="-m $OPTARG" ;; + [?]) echo "Bad Option"; ShowHelp; exit 1 ;; + esac +done +shift $(($OPTIND-1)) srcdir=`jbuild -V .SRCTOP test` @@ -12,4 +82,4 @@ then fi echo $srcdir cd $srcdir -svn commit +svn commit ${commit_msg_file} ${commit_msg}