Date: Fri, 21 Jan 2000 21:04:58 +0100 (CET) From: Alexander Langer <alex@cichlids.com> To: FreeBSD-gnats-submit@freebsd.org Subject: bin/16275: approve send-pr(1) (attach files, use enviroment vars) Message-ID: <200001212004.VAA04462@cichlids.cichlids.com>
next in thread | raw e-mail | index | archive | help
>Number: 16275
>Category: bin
>Synopsis: approve send-pr(1) (attach files, use enviroment vars)
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Fri Jan 21 12:10:01 PST 2000
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200001212004.VAA04462>
