Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Jun 2003 12:36:52 +0200
From:      Jens Rehsack <rehsack@liwing.de>
To:        freebsd-audit <freebsd-audit@freebsd.org>
Subject:   [patch] src/gnu/usr.bin/send-pr
Message-ID:  <3EFACCC4.1000508@liwing.de>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------040303080803070607000003
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

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@.

What do you think, makes it sense or should I rewite my script to make
replacements using sed and some regular expressions?

Best,
jens

--------------040303080803070607000003
Content-Type: text/plain;
 name="patch-send-pr.sh.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="patch-send-pr.sh.diff"

--- 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)>'

--------------040303080803070607000003
Content-Type: text/plain;
 name="submit-pr"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="submit-pr"

#!/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@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}"

--------------040303080803070607000003--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3EFACCC4.1000508>