From alex@cichlids.com Fri Jan 21 12:04:49 2000 Return-Path: Received: from cichlids.com (pC19F54A4.dip0.t-ipconnect.de [193.159.84.164]) by hub.freebsd.org (Postfix) with ESMTP id 543F215143 for ; Fri, 21 Jan 2000 12:04:47 -0800 (PST) (envelope-from alex@cichlids.com) Received: from cichlids.cichlids.com (cichlids.cichlids.com [192.168.0.10]) by cichlids.com (Postfix) with ESMTP id 8DA62AB92 for ; Fri, 21 Jan 2000 21:05:12 +0100 (CET) Received: (from alex@localhost) by cichlids.cichlids.com (8.9.3/8.9.3) id VAA04462; Fri, 21 Jan 2000 21:04:58 +0100 (CET) (envelope-from alex) Message-Id: <200001212004.VAA04462@cichlids.cichlids.com> Date: Fri, 21 Jan 2000 21:04:58 +0100 (CET) From: Alexander Langer Reply-To: alex@cichlids.com To: FreeBSD-gnats-submit@freebsd.org Subject: approve send-pr(1) (attach files, use enviroment vars) X-Send-Pr-Version: 3.2 >Number: 16275 >Category: bin >Synopsis: approve send-pr(1) (attach files, use enviroment vars) >Confidential: no >Severity: non-critical >Priority: medium >Responsible: steve >State: closed >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Fri Jan 21 12:10:01 PST 2000 >Closed-Date: Wed Jul 11 11:05:36 PDT 2001 >Last-Modified: Wed Jul 11 11:06:17 PDT 2001 >Originator: Alexander Langer >Release: FreeBSD 4.0-CURRENT i386 >Organization: This space is intentionally left blank. >Environment: -current >Description: This patch improves the send-pr(1) functionality. manpages are not included yet, but if the patch is ok, I'll fix the manpage as well. it's really nice and should be delivered now on all releases ;-) What does it do? 1) add an -a option, which makes it possible to attach text and binary files. The attached files go into the Fixes section. binary files are uuencoded, text files are included with a --- filename begins here --- stuff --- filename ends here --- as you can see below (this pr is filed using my changes) ALSO, you can specify PR_* vars, which makes the use of send-pr(1) out of scripts VERY nice. e.g., I've discovered, when I update ports I ALWAYS write the same stuff. I could create an alias as alias send-ports-pr='echo -n "Please enter the synopsis: "; read syn; PR_SYNOPSIS=$syn PR_CATEGORY=ports PR_CONFIDENTAL=no PR_PRIORITY=medium PR_SEVERITY=non-critical send-pr' which then automatically inserts the stuff into the fields...nice, isn't it? then: send-ports-pr -a port-diff.diff also includes the patch for the port. Wow, I do really like it. I hope you will too, since it does not destroy any of the old funtionality. >How-To-Repeat: n/a >Fix: --- send-pr.diff begins here --- --- send-pr-freebsd.old Fri Jan 21 20:13:08 2000 +++ send-pr Fri Jan 21 20:55:01 2000 @@ -87,19 +87,23 @@ REPLY_TO="${REPLY_TO:-${REPLYTO:-$LOGNAME}}" # Find out the name of the originator of this PR. -if [ -n "$NAME" ]; then - ORIGINATOR="$NAME" -elif [ -f $HOME/.fullname ]; then - ORIGINATOR="`sed -e '1q' $HOME/.fullname`" -elif [ -f /bin/domainname ]; then - if [ "`/bin/domainname`" != "" -a -f /usr/bin/ypcat ]; then - # Must use temp file due to incompatibilities in quoting behavior - # and to protect shell metacharacters in the expansion of $LOGNAME - /usr/bin/ypcat passwd 2>/dev/null | cat - /etc/passwd | grep "^$LOGNAME:" | - cut -f5 -d':' | sed -e 's/,.*//' > $TEMP - ORIGINATOR="`cat $TEMP`" - rm -f $TEMP +if [ -z "$PR_ORIGINATOR" ]; then + if [ -n "$NAME" ]; then + ORIGINATOR="$NAME" + elif [ -f $HOME/.fullname ]; then + ORIGINATOR="`sed -e '1q' $HOME/.fullname`" + elif [ -f /bin/domainname ]; then + if [ "`/bin/domainname`" != "" -a -f /usr/bin/ypcat ]; then + # Must use temp file due to incompatibilities in quoting behavior + # and to protect shell metacharacters in the expansion of $LOGNAME + /usr/bin/ypcat passwd 2>/dev/null | cat - /etc/passwd | grep "^$LOGNAME:" | + cut -f5 -d':' | sed -e 's/,.*//' > $TEMP + ORIGINATOR="`cat $TEMP`" + rm -f $TEMP + fi fi +else + ORIGINATOR="$PR_ORIGINATOR" fi if [ "$ORIGINATOR" = "" ]; then @@ -108,16 +112,20 @@ rm -f $TEMP fi -if [ -n "$ORGANIZATION" ]; then - if [ -f "$ORGANIZATION" ]; then - ORGANIZATION="`cat $ORGANIZATION`" +if [ -z "$PR_ORGANIZATION" ]; then + if [ -n "$ORGANIZATION" ]; then + if [ -f "$ORGANIZATION" ]; then + ORGANIZATION="`cat $ORGANIZATION`" + fi + else + if [ -n "$DEFAULT_ORGANIZATION" ]; then + ORGANIZATION="$DEFAULT_ORGANIZATION" + elif [ -f $HOME/.organization ]; then + ORGANIZATION="`cat $HOME/.organization`" + fi fi else - if [ -n "$DEFAULT_ORGANIZATION" ]; then - ORGANIZATION="$DEFAULT_ORGANIZATION" - elif [ -f $HOME/.organization ]; then - ORGANIZATION="`cat $HOME/.organization`" - fi + $ORGANIZATION="$PR_ORGANIZATION" fi # If they don't have a preferred editor set, then use @@ -139,7 +147,7 @@ COMMAND=`echo $0 | sed -e 's,.*/,,'` USAGE="Usage: $COMMAND [-PVL] [-t address] [-f filename] [--request-id] -[--version]" +[--version] [-a file]" REMOVE= BATCH= @@ -162,6 +170,24 @@ -L | --list) FORMAT=norm ;; -l | -CL | --lisp) FORMAT=lisp ;; --request-id) REQUEST_ID=true ;; + -a | --attach) if [ -z "$2" ]; then + echo "$USAGE" ; exit 1; + fi + if [ ! -d "$2" ]; then + if file $2 | grep "text" >/dev/null 2>/dev/null ; then + ATTACHED_FILES="$ATTACHED_FILES +--- $2 begins here --- +`cat \"$2\"` +--- $2 ends here --- +" + else + ATTACHED_FILES="$ATTACHED_FILES +`uuencode \"$2\" < \"$2\"` +" + fi + shift; + fi; + ;; -h | --help) echo "$USAGE"; exit 0 ;; -V | --version) echo "$VERSION"; exit 0 ;; -*) echo "$USAGE" ; exit 1 ;; @@ -318,7 +344,6 @@ END { printf "\nSEND-PR:\n"; }' >> $file - cat >> $file << __EOF__ To: $GNATS_ADDR Subject: @@ -330,28 +355,29 @@ >Submitter-Id: $SUBMITTER >Originator: $ORIGINATOR >Organization: ${ORGANIZATION-$ORGANIZATION_C} ->Confidential: $CONFIDENTIAL_C ->Synopsis: $SYNOPSIS_C ->Severity: $SEVERITY_C ->Priority: $PRIORITY_C ->Category: $CATEGORY_C +>Confidential: ${PR_CONFIDENTAL-$CONFIDENTIAL_C} +>Synopsis: ${PR_SYNOPSIS-$SYNOPSIS_C} +>Severity: ${PR_SEVERITY-$SEVERITY_C} +>Priority: ${PR_PRIORITY-$PRIORITY_C} +>Category: ${PR_CATEGORY-$CATEGORY_C} >Release: ${DEFAULT_RELEASE-$RELEASE_C} >Class: $CLASS_C >Environment: - $ENVIRONMENT_C +${PR_ENVIROMENT- $ENVIRONMENT_C} >Description: - $DESCRIPTION_C +${PR_DESCRIPTION- $DESCRIPTION_C} >How-To-Repeat: - $HOW_TO_REPEAT_C +${PR_HOW_TO_REPEAT- $HOW_TO_REPEAT_C} >Fix: - $FIX_C +${PR_FIX- $FIX_C} +$ATTACHED_FILES __EOF__ --- send-pr.diff ends here --- >Release-Note: >Audit-Trail: Responsible-Changed-From-To: freebsd-bugs->steve Responsible-Changed-By: johan Responsible-Changed-When: Sat Aug 12 14:57:13 PDT 2000 Responsible-Changed-Why: Steve is our gnats admin person and knows (maintains) send-pr. http://www.freebsd.org/cgi/query-pr.cgi?pr=16275 State-Changed-From-To: open->closed State-Changed-By: alex State-Changed-When: Wed Jul 11 11:05:36 PDT 2001 State-Changed-Why: The attach thing has been added recently. The remainding diffs can probably solved in a more elegant way, so I'm closing this PR now. http://www.FreeBSD.org/cgi/query-pr.cgi?pr=16275 >Unformatted: