- allow to put the gnats database in ${DATADIR}

- add ceri's freefall patches

Submitted by:	ceri (partial)
This commit is contained in:
Oliver Eikemeier 2004-01-29 14:06:18 +00:00
parent f31cfcf9cf
commit 26ba675eeb
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=99407
5 changed files with 317 additions and 15 deletions

View file

@ -26,10 +26,21 @@ CONFLICTS= gnats-3.*
PKGMESSAGE= ${WRKDIR}/pkg-message
PKGINSTALL= ${WRKDIR}/pkg-install
GNATSDBBASE?= /var/db
.ifdef WANT_FREEFALL_CFG
EXTRA_PATCHES+= ${PATCHDIR}/extrapatch-*
CONFIGURE_ARGS= --sharedstatedir=${GNATSDBBASE}/gnats \
--datadir=${GNATSDBBASE}
GNATSDBDIR= ${DATADIR}
CONFIGURE_ARGS+= --with-gnats-default-db=${GNATSDBDIR}/gnats-db
WITH_SUBMITTER_ID= current-users
WITH_ORGANIZATION= FreeBSD
WITH_GNATSD_SERVICE= support
.endif
GNATSDBDIR?= /var/db/gnats
CONFIGURE_ARGS+= --sharedstatedir=${GNATSDBDIR}
.ifdef WITH_SUBMITTER_ID
CONFIGURE_ARGS+= --with-submitter=${WITH_SUBMITTER_ID}
@ -43,7 +54,7 @@ CONFIGURE_ARGS+= --with-organization=${WITH_ORGANIZATION:Q}
CONFIGURE_ARGS+= --with-gnats-service=${WITH_GNATSD_SERVICE}
.endif
PLIST_SUB= GNATSDBDIR=${GNATSDBBASE}/gnats
PLIST_SUB= GNATSDBDIR=${GNATSDBDIR}
MAN1= edit-pr.1 query-pr.1 send-pr.1
MAN5= databases.5 dbconfig.5
@ -72,6 +83,7 @@ CONFLICTS+= ${PKGNAMEPREFIX}${PORTNAME}-client-4.*
.endif
pre-everything::
.if !defined(PACKAGE_BUILDING) && !defined(WANT_FREEFALL_CFG)
@${ECHO} "============================================================="
@${ECHO}
@${ECHO} "You can build ${PKGNAME} with the following options:"
@ -83,11 +95,15 @@ pre-everything::
@${ECHO}
@${ECHO} "============================================================="
@${ECHO}
.endif
pre-configure:
@${ECHO_CMD} 'RELEASE_TAG="\`uname -srm\`"' > ${WRKSRC}/release-info
post-build:
@for doc in pkg-message pkg-install; do \
${SED} -e 's,%%PREFIX%%,${PREFIX},g' \
-e 's,%%GNATSDBDIR%%,${GNATSDBBASE}/gnats,g' \
-e 's,%%GNATSDBDIR%%,${GNATSDBDIR},g' \
${PKGDIR}/$${doc} >${WRKDIR}/$${doc} ; \
done

View file

@ -1 +1,2 @@
MD5 (gnats-4.0.tar.gz) = 3bf0d3336b976549553c64ac4bc15f75
SIZE (gnats-4.0.tar.gz) = 1561192

View file

@ -0,0 +1,265 @@
--- gnats/edit-pr.sh.orig Sun May 26 16:32:02 2002
+++ gnats/edit-pr.sh Sat Dec 6 02:43:44 2003
@@ -5,6 +5,8 @@
# Contributed by Jeffrey Osier (jeffrey@cygnus.com).
# Majorly revised by Bob Manson (manson@juniper.net).
# Further improvements by Dirk Bergstrom (dirk@juniper.net).
+# Patches for the FreeBSD Project by Ceri Davies (ceri@FreeBSD.org),
+# based on work by Paul Richards (paul@FreeBSD.org).
#
# This file is part of GNU GNATS.
#
@@ -24,9 +26,12 @@
debug_print=false # or echo to get output.
BINDIR=xBINDIRx
+DATE=`LC_TIME=C date` # Some prstats tools rely on this format
+GNATS_ROOT=${GNATS_ROOT:-/usr/local/share/gnats/gnats-db}; export GNATS_ROOT
LIBEXECDIR=xLIBEXECDIRx
GNATS_PORT=
locked=
+rc=0
version=xVERSIONx
usage="
@@ -99,28 +104,23 @@
*)
if [ "`echo $1 | grep /`" != "" ]; then
- pr_id=`echo $1 | awk -F"/" '{print $2}' -`
+ pr=`echo $1 | awk -F"/" '{print $2}' -`
else
- pr_id=$1
+ pr=$1
fi
+ prs="$prs $pr"
;;
esac
shift
done
+chng_tpl="${GNATS_ROOT}/gnats-adm/edit-pr-msg"
+
# set command here to always pass host and port, and directory if supplied
QUERY_PR="$BINDIR/query-pr $GNATS_HOST $GNATS_PORT $GNATS_DB $EDIT_USER $EDIT_PASSWD"
PR_ADDR="$QUERY_PR --responsible-address"
PR_EDIT="$LIBEXECDIR/gnats/pr-edit $GNATS_HOST $GNATS_PORT $EDIT_USER $EDIT_PASSWD $GNATS_DB"
-# These traps take care of deleting all the /tmp files
-trap 'rm -f $new.old $change_msg $fixfil' 0
-# Don't delete $new on error signals
-trap 'if [ "$locked" != "" ]; then \
- $PR_EDIT --unlock $pr_id ; \
- locked= ; \
- fi' 1 2 3 13 15
-
# find a user name
if [ "$USER" != "" ]; then
me=$USER
@@ -138,85 +138,45 @@
full_me="$me"
fi
+for pr_id in $prs ; do
+
+epdir=`mktemp -d /tmp/epXXXXXX || exit 75`
+chng_msg="$epdir/chng.$pr_id.$$"
# new = temp file to use for editing
-new="/tmp/ep$$"
-newtmp="/tmp/ep$$.tp"
-change_msg="/tmp/ep$$.ch"
-fixfil="/tmp/ep$$.fx"
+new="$epdir/$pr_id.ep$$"
+change_msg="$epdir/ep$$.$pr_id.ch"
+keepnew=
+
+# These traps take care of deleting all the /tmp files
+trap 'rm -f $new.old $change_msg chng_msg; rmdir $epdir 2>/dev/null' 0
+trap 'if [ "$locked" != "" ]; then \
+ $PR_EDIT --unlock $pr_id ; \
+ locked= ; \
+ fi; \
+ rm -f $new.old $change_msg chng_msg; rmdir $epdir 2>/dev/null' 1 2 3 13 15
+
# lock the pr
$debug_print "Locking $pr_id."
-lock=`$PR_EDIT --lock=$full_me --process=$$ $pr_id 2>&1 > $new`
+lock=`$PR_EDIT --lock=$me --process=$$ $pr_id 2>&1 > $new`
locked=t
if [ "$lock" != "" ] ; then
+ echo "Failed to lock PR $pr_id"
echo $lock
- exit 0
+ rc=1
+ rm -r $epdir
+ continue
fi
-rm -f $fixfil
-
-# Now add any missing fields, along with a description.
-
-$QUERY_PR --list-fields | while read field
-do
- grep -i "^>${field}:" "$new" > /dev/null 2>&1
- if [ $? != 0 ]
- then
- $QUERY_PR --field-flags "$field" | grep -i readonly > /dev/null 2>&1
- if [ $? != 0 ]
- then
- type="`$QUERY_PR --field-type $field`"
- case $type in
- [Ee][Nn][Uu][Mm])
- values=`$QUERY_PR --valid-values $field | tr '\n' ' ' | sed 's/ *$//g; s/ / | /g;s/^/[ /;s/$/ ]/;`
- valslen=`echo "$values" | wc -c`
- if [ "$valslen" -gt 160 ]
- then
- desc="<`$QUERY_PR --field-description $field` (one line)>";
- else
- desc="<${values} (one line)>";
- fi
- dpat=`echo "$desc" | tr '][*+^$|\()&/' '............'`
- echo "/^>${field}:/ s/${dpat}//" >> $fixfil
- echo "/>${field}: ${desc}" >> $new;
- ;;
- [Mm][Uu][Ll][Tt][Ii][Tt][Ee][Xx][Tt])
- desc=" <`$QUERY_PR --field-description $field` (multiple lines)>";
- dpat=`echo "$desc" | tr '][*+^$|\()&/' '............'`
- echo "s/^${dpat}//" >> $fixfil
- echo ">${field}:" >> $new;
- echo "$desc" >> $new;
- ;;
- *)
- desc="<`$QUERY_PR --field-description $field` (one line)>"
- dpat=`echo "$desc" | tr '][*+^$|\()&/' '............'`
- echo "/^>${field}:/ s/${dpat}//" >> $fixfil
- echo ">${field}: ${desc}" >> $new
- ;;
- esac
- else
- prevfld="$field";
- fi
- fi
-done
-
# here's where we actually call the editor.
cp $new $new.old
$VISUAL $new
if cmp -s $new.old $new ; then
echo "edit-pr: PR not changed"
$PR_EDIT --unlock $pr_id
- exit 0
-fi
-
-if [ -f $fixfil ]
-then
- sed -f $fixfil < $new > $newtmp
- mv $newtmp $new
- sed -f $fixfil < $new.old > $newtmp
- mv $newtmp $new.old
- rm -f $fixfil
+ rm -r $epdir
+ continue
fi
# error-check output by calling pr-edit --check; if mistakes exist,
@@ -233,7 +193,7 @@
echo "PR $pr_id not updated: changed file is in $new.changed"
mv $new $new.changed
$PR_EDIT --unlock $pr_id
- exit 0
+ continue 2
;;
esac
$VISUAL $new
@@ -242,24 +202,37 @@
fi
done
-exec 3<&0
-
#
# Find out what fields have changed; if the changed field requires a
# change reason, then ask about it.
#
-$LIBEXECDIR/gnats/diff-prs $new.old $new | while read field
+
+changed_fields=`$LIBEXECDIR/gnats/diff-prs $new.old $new`
+for field in $changed_fields
do
flags=`$QUERY_PR --field-flags $field` || echo "edit-pr: Invalid field name $field" 1>&2;
if echo "$flags" | grep -i "requirechangereason" > /dev/null 2>&1
then
- echo ">${field}-Changed-Why:" >> $change_msg;
- echo "Why did the $field field change? (Ctrl-D to end)";
- cat 0<&3 >> $change_msg;
+ $debug_print "Doing $field change."
+ echo ">$field-Changed-Why: " >> $change_msg
+ if [ -e $chng_msg ]; then
+ echo "Re-use last message (y/n)?"
+ read yesno
+ if [ "$yesno" != "y" ]; then
+ sed "s/%%ITEM%%/$field/" $chng_tpl > $chng_msg
+ fi
+ else
+ sed "s/%%ITEM%%/$field/" $chng_tpl > $chng_msg
+ fi
+ $VISUAL $chng_msg
+ sed '/^GNATS:/d' $chng_msg >> $change_msg
fi
done
+echo "" >> $change_msg
+echo "http://www.FreeBSD.org/cgi/query-pr.cgi?pr=$pr_id" >> $change_msg
+
if [ -f $change_msg ]
then
cat $change_msg >> $new
@@ -269,12 +242,12 @@
# Submit the changed PR.
#
while true; do
- if $PR_EDIT --email-addr "$full_me" $pr_id < $new
+ if $PR_EDIT --email-addr "$me" $pr_id < $new
then
echo "Edit successful"
# we need to unlock the PR
$PR_EDIT --unlock $pr_id
- exit 0
+ break
else
echo "Problems with edit submission."
fi
@@ -284,9 +257,11 @@
case "$input" in
a*)
echo "Cancelling edit. Changed PR is in $new."
- # we need to ulock the PR no matter what
+ # we need to unlock the PR no matter what
$PR_EDIT --unlock $pr_id
- exit 1 ;;
+ keepnew=y
+ rc=1
+ break 2 ;;
r*)
break ;;
*)
@@ -296,6 +271,13 @@
done
done
-rm -f $new
+rm -f $chng_msg $new.old $change_msg
+if [ "$keepnew" != "y" ]; then
+ rm -f $new
+ rmdir $epdir
+fi
+keepnew=
+
+done # for pr_id in $prs
-exit 0
+exit $rc

View file

@ -1,5 +1,5 @@
--- gnats/Makefile.in.orig Sun Jul 27 01:23:17 2003
+++ gnats/Makefile.in Mon Sep 22 05:41:57 2003
+++ gnats/Makefile.in Thu Sep 25 02:30:32 2003
@@ -91,7 +91,7 @@
INSTALL = $(srcdir)/../install-sh -c
@ -9,7 +9,15 @@
INSTALL_DATA = @INSTALL_DATA@
SUB_INSTALL = `echo $(INSTALL) | sed 's,^\([^/]\),../\1,'`
@@ -163,7 +163,7 @@
@@ -107,6 +107,7 @@
libdir = @libdir@
libexecdir = @libexecdir@
statedir = @datadir@
+sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
program_transform_name =
@@ -163,7 +164,7 @@
check-db delete-pr dbconfig gnats-databases gnats-pwconv $(EXTRA_STUFF)
all-tools: libgnats.a query-pr pr-age pr-edit edit-pr file-pr getclose \
@ -18,18 +26,30 @@
libgnats.a: $(LIBOBJS)
-rm -f tmplibgnats.a libgnats.a
@@ -371,7 +371,9 @@
@@ -363,15 +364,17 @@
install-tools-arch-dep: install-tools-bin
install-tools-arch-indep: all-tools
- $(SHELL) $(srcdir)/../mkinstalldirs $(datadir)/gnats
+ $(SHELL) $(srcdir)/../mkinstalldirs $(sharedstatedir)
$(SHELL) $(srcdir)/../mkinstalldirs $(sysconfdir)/gnats/defaults
@if [ `whoami` = root -o `whoami` = $(GNATS_USER) ] ; then \
- echo "chown $(GNATS_USER) $(datadir)/gnats" ; \
- chown $(GNATS_USER) $(datadir)/gnats ; \
+ echo "chown $(GNATS_USER) $(sharedstatedir)" ; \
+ chown $(GNATS_USER) $(sharedstatedir) ; \
else \
echo "*** Warning: Must chown $(GNATS_USER) $(datadir)/gnats" ; \
fi
- $(INSTALL_DATA) $(srcdir)/gnats.el $(lispdir)/gnats.el
- echo "*** Warning: Must chown $(GNATS_USER) $(datadir)/gnats" ; \
+ echo "*** Warning: Must chown $(GNATS_USER) $(sharedstatedir)" ; \
+ fi
+ @if [ x"$(lispdir)" != x ]; then \
+ $(INSTALL_DATA) $(srcdir)/gnats.el $(lispdir)/gnats.el ; \
+ fi
fi
- $(INSTALL_DATA) $(srcdir)/gnats.el $(lispdir)/gnats.el
for i in categories submitters responsible gnatsd.user_access addresses states classes dbconfig ; do \
if [ -f "$$i" ] ; then \
$(INSTALL_DATA) $$i $(sysconfdir)/gnats/defaults/$$i ; \
@@ -386,7 +388,7 @@
@@ -386,7 +389,7 @@
$(INSTALL_SCRIPT) edit-pr $(bindir)/edit-pr
$(INSTALL_SCRIPT) $(srcdir)/diff-prs $(libexecdir)/gnats/diff-prs
$(INSTALL_SCRIPT) mail-agent $(libexecdir)/gnats/mail-agent
@ -38,7 +58,7 @@
$(INSTALL_PROGRAM) pr-age $(libexecdir)/gnats/pr-age
$(INSTALL_PROGRAM) pr-edit $(libexecdir)/gnats/pr-edit
@if [ `whoami` = root -o `whoami` = $(GNATS_USER) ] ; then \
@@ -404,29 +406,29 @@
@@ -404,29 +407,29 @@
install-gnats-arch-dep: install-gnats-bin $(EXTRA_INSTALL)
install-gnats-arch-indep: all-gnats install-tools-arch-indep

View file

@ -8,4 +8,4 @@ querying, editing and maintaining these databases.
WWW: http://www.gnu.org/software/gnats/
- Oliver Eikemeier
eikemeier@fillmore-labs.com
eik@FreeBSD.org