[patch] src/gnu/usr.bin/send-pr
Jens Rehsack
rehsack at liwing.de
Thu Jun 26 03:36:55 PDT 2003
Hi,
I tried to write a small script which makes it easier to send PR's from
a hidden subdomain. This is required for us, because I didn't found a
way to send pr's from internal network. So I had to copy the generated
pr-files to one of our "internet" machines and use 'send-pr -f'.
Ok, I added some new parameters to send-pr but found no person who is
really responsible to it, so I remembered a hint got earlier to send
patches to be approved to audit at .
What do you think, makes it sense or should I rewite my script to make
replacements using sed and some regular expressions?
Best,
jens
-------------- next part --------------
--- gnu/usr.bin/send-pr/send-pr.sh.orig Sat Mar 22 10:31:24 2003
+++ gnu/usr.bin/send-pr/send-pr.sh Wed Jun 25 09:58:02 2003
@@ -138,6 +138,9 @@
BATCH=
CC=
SEVERITY_C=
+PRIORITY_C=
+CATEGORY_C=
+CLASS_C=
while [ $# -gt 0 ]; do
case "$1" in
@@ -160,6 +163,15 @@
-s | --severity) if [ $# -eq 1 ]; then echo "$USAGE"; exit 1; fi
shift ; SEVERITY_C="$1"
;;
+ --priority) if [ $# -eq 1 ]; then echo "$USAGE"; exit 1; fi
+ shift ; PRIORITY_C="$1"
+ ;;
+ --category) if [ $# -eq 1 ]; then echo "$USAGE"; exit 1; fi
+ shift ; CATEGORY_C="$1"
+ ;;
+ --class) if [ $# -eq 1 ]; then echo "$USAGE"; exit 1; fi
+ shift ; CLASS_C="$1"
+ ;;
-p | -P | --print) PRINT=true ;;
-L | --list) FORMAT=norm ;;
-l | -CL | --lisp) FORMAT=lisp ;;
@@ -247,9 +259,15 @@
if [ -z "$SEVERITY_C" ]; then
SEVERITY_C='<[ non-critical | serious | critical ] (one line)>'
fi
-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)>'
+if [ -z "$PRIORITY_C" ]; then
+ PRIORITY_C='<[ low | medium | high ] (one line)>'
+fi
+if [ -z "$CATEGORY_C" ]; then
+ CATEGORY_C='<choose from the list of categories above (one line)>'
+fi
+if [ -z "$CLASS_C" ]; then
+ CLASS_C='<[ sw-bug | doc-bug | change-request | update | maintainer-update ] (one line)>'
+fi
RELEASE_C='<release number or tag (one line)>'
ENVIRONMENT_C='<machine, os, target, libraries (multiple lines)>'
DESCRIPTION_C='<precise description of the problem (multiple lines)>'
-------------- next part --------------
#!/bin/sh
# $Id$
usage()
{
cat <<EOF
Usage: $0 [-p <port-location>] [-c <carbon-copy>] [-a <patch-files-pattern>]
[-l <class>] [-s <severity>] [-t <category>] [-o <priority>]
[-u <username>] [-m <maildomain>]
<port-location> location of port in ports-tree (eg. lang/php4)
<carbon-copy> e-mail addresses to put in Cc: of mail
<patch-files-pattern> pattern to match the patch files
<class> one of [ sw-bug | doc-bug | change-request |
update | maintainer-update ]
<severity> one of [ non-critical | serious | critical ]
<category> one of the entries from /etc/gnats/freefall
<priority> one of [ low | medium | high ]
<user> another user name, eg. when name differs
from mail user name
<maildomain> another domain name for sending mail from/to
EOF
exit 1
}
cc="Jens Rehsack <rehsack at liwing.de>"
organization="LiWing IT-Services"
severity="non-critical" # [ non-critical | serious | critical ]
priority="medium" # [ low | medium | high ]
category="ports" # </etc/gnats/freefall
class="change-request" # [ sw-bug | doc-bug | change-request | update | maintainer-update ]
maildomain="liwing.de"
user=${USER}
while getopts p:c:a:s:l:o:u:m: options
do
case $options in
p)
port_path=$OPTARG ;;
c)
cc="${cc}, $OPTARG" ;;
a)
pfp=$OPTARG ;;
l)
class=$OPTARG ;;
s)
severity=$OPTARG ;;
t)
category=$OPTARG ;;
o)
priority=$OPTARG ;;
u)
user=$OPTARG ;;
m)
maildomain=$OPTARG ;;
\?)
usage
esac
done
if [ -z "${pfp}" ]
then
patch_pattern=patch-*
else
patch_pattern=patch-*${pfp}*
fi
if [ "ports" = "${category}" ]
then
patch_base=~root/patches
patch_pattern=ports/${port_path}/${patch_pattern}
else
patch_base=~root/patches/src
fi
patch_files=
for a in ${patch_base}/${patch_pattern}
do
if [ -f ${a} ]
then
patch_files="${patch_files} -a ${a}"
fi
done
if [ ! -d ~/pr-files ]
then
mkdir ~/pr-files
fi
pr_file="${patch_pattern}-`date +%F`"
pr_file=`echo "${pr_file}" | sed "s|[/*-]|_|g" | sed "s/__/_/g"`
pr_file="${HOME}/pr-files/pr-${pr_file}"
touch ${pr_file}
env ORGANIZATION="${organization}" REPLY_TO="${user}@${maildomain}" \
send-pr -c "${cc}" ${patch_files} --severity ${severity} \
--priority ${priority} --category ${category} \
--class ${class} --print > ${pr_file}
${EDITOR} ${pr_file}
echo "The PR to send is in ${pr_file}"
More information about the freebsd-audit
mailing list