per-user send-pr defaults: ~/.send-pr.rc?

Roman Neuhauser neuhauser at chello.cz
Wed Apr 21 02:33:18 PDT 2004


# ceri at FreeBSD.org / 2004-04-14 11:36:55 +0100:
> On Wed, Apr 14, 2004 at 09:31:19AM +0200, Roman Neuhauser wrote:
> > Would a patch for send-pr adding support for defaults handling using
> > an rc file be welcome? If so, should I target send-pr as is in our tree,
> > the one from the 4.0 tarball, or upstream cvs?
> 
> I'd certainly be interested in looking at it.  At the moment my plan to
> upgrade is entirely {hub,www,freefall}.FreeBSD.org based - there seems
> to be no pressing need to upgrade the distributed send-pr, so I'd target
> the in-tree send-pr.  If it should turn out that a client-side upgrade
> is worth the effort then we can bring the patches forward (I had to do
> the same for our local edit-pr hacks).

    I've used the attached patch to submit some PRs (65668 - 65680), and
    it was a relief.
    
    It's not commitable as-is (e. g. note -s/-S are swapped), I'd just
    like to know whether I'm on the right track.

-- 
If you cc me or remove the list(s) completely I'll most likely ignore
your message.    see http://www.eyrie.org./~eagle/faqs/questions.html
-------------- next part --------------
Index: gnu/usr.bin/send-pr/send-pr.sh
===================================================================
RCS file: /home/ncvs/src/gnu/usr.bin/send-pr/send-pr.sh,v
retrieving revision 1.13.2.13
diff -u -r1.13.2.13 send-pr.sh
--- gnu/usr.bin/send-pr/send-pr.sh	1 Dec 2003 19:12:58 -0000	1.13.2.13
+++ gnu/usr.bin/send-pr/send-pr.sh	21 Apr 2004 09:16:36 -0000
@@ -22,6 +22,10 @@
 #
 # $FreeBSD: src/gnu/usr.bin/send-pr/send-pr.sh,v 1.13.2.13 2003/12/01 19:12:58 ceri Exp $
 
+if [ -n "$HOME" -a -f $HOME/send-pr.conf ]; then
+    . $HOME/send-pr.conf
+fi
+
 # The version of this send-pr.
 VERSION=3.113
 
@@ -85,6 +89,10 @@
 	fi
 fi
 
+if [ -z "$SENDER" ]; then
+    SENDER=$LOGNAME
+fi
+
 # Find out the name of the originator of this PR.
 if [ -n "$NAME" ]; then
   ORIGINATOR="$NAME"
@@ -99,8 +107,8 @@
   rm -f $PTEMP
 fi
 
-FROM="$ORIGINATOR <$LOGNAME>"
-REPLY_TO="$ORIGINATOR <${REPLY_TO:-${REPLYTO:-$LOGNAME}}>"
+FROM="$ORIGINATOR <$SENDER>"
+REPLY_TO="$ORIGINATOR <${REPLY_TO:-${REPLYTO:-$SENDER}}>"
 
 if [ -n "$ORGANIZATION" ]; then
   if [ -f "$ORGANIZATION" ]; then
@@ -137,7 +145,6 @@
 REMOVE=
 BATCH=
 CC=
-SEVERITY_C=
 
 while [ $# -gt 0 ]; do
   case "$1" in
@@ -157,9 +164,18 @@
     -c | --cc) if [ $# -eq 1 ]; then echo "$USAGE"; exit 1; fi
 	shift ; CC="$1"
 	;;
-    -s | --severity) if [ $# -eq 1 ]; then echo "$USAGE"; exit 1; fi
-	shift ; SEVERITY_C="$1"
+    -C | --category) if [ $# -eq 1 ]; then echo "$USAGE"; exit 1; fi
+	shift ; CATEGORY="$1"
+	;;
+    -S | --severity) if [ $# -eq 1 ]; then echo "$USAGE"; exit 1; fi
+	shift ; SEVERITY="$1"
 	;;
+    -R | --priority) if [ $# -eq 1 ]; then echo "$USAGE"; exit 1; fi
+    shift ; PRIORITY="$1"
+    ;;
+    -s | --synopsis) if [ $# -eq 1 ]; then echo "$USAGE"; exit 1; fi
+    shift ; SYNOPSIS="$1"
+    ;;
     -p | -P | --print) PRINT=true ;;
     -L | --list) FORMAT=norm ;;
     -l | -CL | --lisp) FORMAT=lisp ;;
@@ -244,9 +260,7 @@
 ORGANIZATION_C='<organization of PR author (multiple lines)>'
 CONFIDENTIAL_C='no <FreeBSD PRs are public data>'
 SYNOPSIS_C='<synopsis of the problem (one line)>'
-if [ -z "$SEVERITY_C" ]; then
-  SEVERITY_C='<[ non-critical | serious | critical ] (one line)>'
-fi
+SEVERITY_C='<[ non-critical | serious | critical ] (one line)>'
 PRIORITY_C='<[ low | medium | high ] (one line)>'
 CATEGORY_C='<choose from the list of categories above (one line)>'
 CLASS_C='<[ sw-bug | doc-bug | change-request | update | maintainer-update ] (one line)>'
@@ -256,6 +270,22 @@
 HOW_TO_REPEAT_C='<code/input/activities to reproduce the problem (multiple lines)>'
 FIX_C='<how to correct or work around the problem, if known (multiple lines)>'
 
+if [ -z "$SYNOPSIS" ]; then
+  SYNOPSIS=$SYNOPSIS_C
+fi
+if [ -z "$SEVERITY" ]; then
+  SEVERITY=$SEVERITY_C
+fi
+if [ -z "$PRIORITY" ]; then
+  PRIORITY=$PRIORITY_C
+fi
+if [ -z "$CATEGORY" ]; then
+  CATEGORY=$CATEGORY_C
+fi
+if [ -z "$CLASS" ]; then
+  CLASS=$CLASS_C
+fi
+
 # Create temporary files, safely
 REF=`mktemp -t pf` || exit 1
 TEMP=`mktemp -t pf` || exit 1
@@ -353,11 +383,11 @@
 >Originator:	$ORIGINATOR
 >Organization:	${ORGANIZATION-$ORGANIZATION_C}
 >Confidential:	$CONFIDENTIAL_C
->Synopsis:	$SYNOPSIS_C
->Severity:	$SEVERITY_C
->Priority:	$PRIORITY_C
->Category:	$CATEGORY_C
->Class:		$CLASS_C
+>Synopsis:	$SYNOPSIS
+>Severity:	$SEVERITY
+>Priority:	$PRIORITY
+>Category:	$CATEGORY
+>Class:		$CLASS
 >Release:	${DEFAULT_RELEASE-$RELEASE_C}
 >Environment:
 `[ -n "$SYSTEM" ] && echo System: $SYSTEM`
@@ -537,11 +567,11 @@
 # Add the subject field with the value of $SYNOPSIS.  We use the To:
 # field as an anchor, which had better be there.
 #
-SYNOPSIS=`grep '^>Synopsis:' $TEMP | sed -e 's/^>Synopsis:[ 	]*//' |
+SYNOPSIS_R=`grep '^>Synopsis:' $TEMP | sed -e 's/^>Synopsis:[ 	]*//' |
     sed -e "s;$SYNOPSIS_C;;"`
 ed -s $TEMP << __EOF__
 /^To:/a
-Subject: $SYNOPSIS
+Subject: $SYNOPSIS_R
 .
 w
 q


More information about the freebsd-bugbusters mailing list