Date: Tue, 19 Feb 2013 02:36:06 +0000 (UTC) From: Mark Linimon <linimon@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r246970 - user/bugmeister/gnats/tools/repocopy Message-ID: <201302190236.r1J2a7Sp018986@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: linimon (doc,ports committer) Date: Tue Feb 19 02:36:06 2013 New Revision: 246970 URL: http://svnweb.freebsd.org/changeset/base/246970 Log: Scripts to deal with PRs in the repocopy state. Note that due to the switch of the ports repository from CVS to SVN, these are mostly of historical interest. Added: user/bugmeister/gnats/tools/repocopy/ user/bugmeister/gnats/tools/repocopy/autonagger (contents, props changed) user/bugmeister/gnats/tools/repocopy/crontab user/bugmeister/gnats/tools/repocopy/nag (contents, props changed) user/bugmeister/gnats/tools/repocopy/nagtargets (contents, props changed) user/bugmeister/gnats/tools/repocopy/reasons user/bugmeister/gnats/tools/repocopy/reassign (contents, props changed) user/bugmeister/gnats/tools/repocopy/reassign.helper (contents, props changed) user/bugmeister/gnats/tools/repocopy/reassigned user/bugmeister/gnats/tools/repocopy/reporter (contents, props changed) user/bugmeister/gnats/tools/repocopy/timeouts (contents, props changed) Added: user/bugmeister/gnats/tools/repocopy/autonagger ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/bugmeister/gnats/tools/repocopy/autonagger Tue Feb 19 02:36:06 2013 (r246970) @@ -0,0 +1,39 @@ +#!/bin/sh -- +# $Id$ +# +# Script to autonag $1 about PRs in state $2 +# +MAIL=/usr/bin/mail +PATH=${PATH}:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin; export PATH +QUERY_PR="/usr/local/bin/query-pr" + +usage() { + echo Usage: `basename $0` responsible state > /dev/stderr +} + +if [ ${#} -ne 2 ]; then + usage + exit 1 +fi + +WHO=$1 +STATE=$2 + +PRS=`${QUERY_PR} -q -s ${STATE} -r ${WHO} 2>/dev/null` + +if [ -z "${PRS}" ]; then + exit 0 +fi + +${MAIL} -s "PRs in state ${STATE} assigned to ${WHO}" -b bugmeister ${WHO} << EOM + +The following PRs in the ${STATE} state require your attention. + +${PRS} + +Thank you, + +The Automated Repocopy Nagger. +(/c/gnats/tools/repocopy/). + +EOM Added: user/bugmeister/gnats/tools/repocopy/crontab ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/bugmeister/gnats/tools/repocopy/crontab Tue Feb 19 02:36:06 2013 (r246970) @@ -0,0 +1,11 @@ +#* Separate reminders to portmgr and cvs every 3 days, but only if there +# is anything waiting +5 5 * * */3 /c/gnats/tools/repocopy/reporter portmgr repocopy +5 5 * * */3 /c/gnats/tools/repocopy/reporter cvs repocopy +#* if a repocopy has been performed and is back in the hands of a +# committer, they should get a reminder every other day nagging them to +# finish their deer. +5 6 * * */2 /c/gnats/tools/repocopy/nag repocopy +#* after two weeks in portmgr's hands, they'll automatically be assigned +# to cvs. +5 7 * * * /c/gnats/tools/repocopy/timeouts 1209600 cvs portmgr Added: user/bugmeister/gnats/tools/repocopy/nag ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/bugmeister/gnats/tools/repocopy/nag Tue Feb 19 02:36:06 2013 (r246970) @@ -0,0 +1,21 @@ +#!/bin/sh -- +# $Id$ + +PATH=${PATH}:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin; export PATH +THISDIR=`dirname $0` + +usage() { + echo Usage: `basename $0` state > /dev/stderr +} + +if [ ${#} -ne 1 ]; then + usage + exit 1 +fi + +STATE=$1 + +for committer in `${THISDIR}/nagtargets ${STATE}` + do + ${THISDIR}/autonagger ${committer} ${STATE} + done Added: user/bugmeister/gnats/tools/repocopy/nagtargets ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/bugmeister/gnats/tools/repocopy/nagtargets Tue Feb 19 02:36:06 2013 (r246970) @@ -0,0 +1,22 @@ +#!/bin/sh -- +# $Id$ +# +# Output a list of users with PRs in state $1 +# +PATH=${PATH}:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin; export PATH +QUERY_PR="/usr/local/bin/query-pr" + +usage() { + echo Usage: `basename $0` state > /dev/stderr +} + +if [ ${#} -ne 1 ]; then + usage + exit 1 +fi + +STATE=$1 + +${QUERY_PR} -q -s ${STATE} 2>/dev/null | awk '{print $2}' | sort \ + | uniq | grep -v ^cvs$ | grep -Ev ^[dps]cvs$ | grep -v ^portmgr$ + Added: user/bugmeister/gnats/tools/repocopy/reasons ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/bugmeister/gnats/tools/repocopy/reasons Tue Feb 19 02:36:06 2013 (r246970) @@ -0,0 +1 @@ +Automatic repocopy approval. Added: user/bugmeister/gnats/tools/repocopy/reassign ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/bugmeister/gnats/tools/repocopy/reassign Tue Feb 19 02:36:06 2013 (r246970) @@ -0,0 +1,5 @@ +#!/bin/sh +# Reassign a PR +# +THISDIR=`dirname $0` +OEDITOR=$EDITOR OVISUAL=$VISUAL VISUAL=reassign.helper EDITOR= edit-pr $* Added: user/bugmeister/gnats/tools/repocopy/reassign.helper ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/bugmeister/gnats/tools/repocopy/reassign.helper Tue Feb 19 02:36:06 2013 (r246970) @@ -0,0 +1,27 @@ +#!/bin/sh +# +# If we're editing the PR, then make the requested substitution with sed. +# Otherwise, we're editing the reason, so copy it over. + +PATH=${PATH}:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin; export PATH +THISDIR=`dirname $0` + +if [ -z ${ASSIGN_TO} ]; then + echo ASSIGN_TO not set > /dev/stderr + exit 1 +fi +# gnats4 +#if [ `echo $1 | cut -c1-7,14-19` = "/tmp/ep/chng." ]; then +if [ `echo $1 | cut -c1-10` = "/tmp/chng." ]; then + + cp ${THISDIR}/reasons $1 + +else + + cp $1 $1~ + sed -e "/^>Responsible:/s/[^ ]*$/${ASSIGN_TO}/" \ + < $1~ > $1 + rm $1~ + +fi + Added: user/bugmeister/gnats/tools/repocopy/reassigned ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/bugmeister/gnats/tools/repocopy/reassigned Tue Feb 19 02:36:06 2013 (r246970) @@ -0,0 +1,31 @@ +62606 # Tue Feb 10 08:34:04 PST 2004 +70324 # Wed Aug 25 22:05:21 GMT 2004 +72129 # Mon Oct 11 14:05:17 GMT 2004 +84591 # Mon Aug 22 16:05:20 GMT 2005 +86242 # Sat Oct 1 02:05:25 GMT 2005 +106576 # Mon Dec 25 00:05:23 UTC 2006 +106577 # Mon Dec 25 00:05:29 UTC 2006 +106578 # Mon Dec 25 00:05:35 UTC 2006 +106579 # Mon Dec 25 00:05:40 UTC 2006 +106580 # Mon Dec 25 00:05:46 UTC 2006 +106581 # Mon Dec 25 00:05:51 UTC 2006 +106582 # Mon Dec 25 00:05:57 UTC 2006 +106583 # Mon Dec 25 00:06:03 UTC 2006 +106584 # Mon Dec 25 00:06:08 UTC 2006 +106585 # Mon Dec 25 00:06:14 UTC 2006 +106586 # Mon Dec 25 00:06:20 UTC 2006 +106587 # Mon Dec 25 00:06:29 UTC 2006 +106588 # Mon Dec 25 00:06:39 UTC 2006 +106589 # Mon Dec 25 00:06:48 UTC 2006 +114611 # Sun Oct 7 06:05:15 UTC 2007 +116357 # Sun Oct 7 10:05:12 UTC 2007 +117099 # Tue Oct 23 12:05:04 UTC 2007 +117407 # Fri Nov 9 12:05:05 UTC 2007 +117082 # Sat Nov 10 22:05:04 UTC 2007 +117161 # Mon Nov 12 00:05:03 UTC 2007 +127012 # Thu Sep 18 22:05:05 UTC 2008 +127173 # Sun Sep 21 10:05:04 UTC 2008 +147925 # Sun Jul 4 07:05:05 UTC 2010 +148136 # Sat Jul 10 07:05:06 UTC 2010 +148158 # Sat Jul 31 07:05:04 UTC 2010 +168372 # Thu Jun 14 07:05:07 UTC 2012 Added: user/bugmeister/gnats/tools/repocopy/reporter ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/bugmeister/gnats/tools/repocopy/reporter Tue Feb 19 02:36:06 2013 (r246970) @@ -0,0 +1,39 @@ +#!/bin/sh -- +# $Id$ +# +# Script to tell $1 about PRs in state $2 +# +PATH=${PATH}:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin; export PATH +MAIL=/usr/bin/mail +QUERY_PR="/usr/local/bin/query-pr" + +usage() { + echo Usage: `basename $0` responsible state > /dev/stderr +} + +if [ ${#} -ne 2 ]; then + usage + exit 1 +fi + +WHO=$1 +STATE=$2 + +PRS=`${QUERY_PR} -q -s ${STATE} -r ${WHO} 2>/dev/null` + +if [ -z "${PRS}" ]; then + exit 0 +fi + +${MAIL} -s "PRs in state ${STATE} assigned to ports-committers" -b bugmeister ${WHO} << EOM + +The following PRs in the ${STATE} state require attention. + +${PRS} + +Thank you, + +The Automated Repocopy Nagger +(/c/gnats/tool/repocopy/). + +EOM Added: user/bugmeister/gnats/tools/repocopy/timeouts ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/bugmeister/gnats/tools/repocopy/timeouts Tue Feb 19 02:36:06 2013 (r246970) @@ -0,0 +1,43 @@ +#!/bin/sh -- +# $Id: timeouts,v 1.2 2004/02/10 18:32:14 setantae Exp $ +# +# Script used to find PRs that have been unmodifed for $1 seconds, +# optionally limited to those for whom $3 is responsible, and assign +# them to $2 + +PATH=${PATH}:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin; export PATH +QUERY_PR="/usr/local/bin/query-pr" +THISDIR=`dirname $0` +REASSIGN="${THISDIR}/reassign" +SEENLIST="${THISDIR}/reassigned" +PATH=${PATH}:${THISDIR}; export PATH + +usage() { + echo Usage: `basename $0` timeout assign-to [responsible] > /dev/stderr +} + +if [ ${#} -ne 2 ]; then + if [ ${#} -ne 3 ]; then + usage + exit 1 + fi + RESPONSIBLE=" -r $3" +fi +TIMEOUT=$1 +ASSIGN_TO=$2 + +for id in `${QUERY_PR} -q -s repocopy ${RESPONSIBLE} 2>/dev/null| awk '{print $1}'`; do + DONE=`grep -c $id ${SEENLIST}` + if [ ${DONE} -eq 0 ]; then + now=`date +%s` + mtime="`${QUERY_PR} ${id} | grep Last-Modified: | \ + sed -E -e 's/^.*Modified:[[:space:]]*//' \ + -e 's/[[:space:]]\+[[:digit:]]{4}[[:space:]]/ /'`" + utc="`date -j -f '%+' \"${mtime}\" '+%s'`" + diff="`echo ${now}-${utc} | bc`" + if [ ${diff} -ge ${TIMEOUT} ]; then + ASSIGN_TO=${ASSIGN_TO} ${REASSIGN} $id && echo "$id # " `date` >> ${SEENLIST} + fi + fi +done +
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201302190236.r1J2a7Sp018986>