Here's an updated copy of the tool, which should be runnable now
without copying it; the dehs stuff might be in flux, though..

Justin
#! /bin/bash
# dev-best-practice
# Best-practice information for Debian developers;
# intended to be run periodically as a cronjob;
# weekly:
#   0 2 * * 0 /usr/share/doc/devscripts/examples/dev-best-practice
#
# Copyright (C) 2006 Justin Pryzby <[EMAIL PROTECTED]>
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
set -e;

# Some randomization to avoid developers hammering the BTS sunday at
# 0200 local time.
random_delay ()
{
        test -n "$DEBUG" && return;
        delay=`dd if=/dev/urandom bs=1 count=1 2>/dev/null |hexdump -e '"%d"'`;
        sleep "${delay}m";
}

# Source a shell fragment
src ()
{
        [ ! -r "$1" ] && return;
        . "$1";
}

exec 3>&1;
exec 1> >(mail -s "Debian fixme list for $LOGNAME on `date +%x`" $LOGNAME)

random_delay;

src "/etc/devscripts.conf";
src "$HOME/.devscripts";

if [ -z "$DEBEMAIL" ]; then
        echo "DEBEMAIL is unset; this output wont be as complete";
        echo "You should consider setting it in ~/.devscripts"; 
else
        bts='http://bugs.debian.org';
        ddpo='http://qa.debian.org/developer.php';
        dehs='http://dehs.alioth.debian.org/maintainer.php';

        echo "Checking for your bugs tagged moreinfo:";
        lynx -dump "$bts/from:$DEBEMAIL&include=moreinfo" |
         sed -ne '/^[[:space:]]*\* \[[[:digit:]]\+\]\(#[[:digit:]]\)/s//\1/p';
         # grep -E '^[[:space:]]*\* \[[[:digit:]]+\]#[[:digit:]]+' |
         # sed -e 's/^[^#]*//';

        echo;
        echo "Checking for opened WNPP bugs:";
        # See also: http://qa.debian.org/data/bts/wnpp_by_maint
        wget -qO- "$ddpo?wnpp=$DEBEMAIL" |
         grep -Eo '#[[:digit:]]+:[^<]*' || test $? -eq 1;
        # sed -nre 's/.*(#[0-9]+:[^<]*).*/\1/p'

        echo;
        echo "Checking for new upstream releases:";
        wget -qO- "$dehs?maint=$DEBEMAIL" |
         sed -nre \
         's/.*<!-- *Machine-readable: *([^ ]+) +([^ ]+) +([^ ]+).*-->.*/\1 \2 
\3/p'

         # sed -ne '/.*Machine-readable: /{ s///; s/-->.*//; s,N/A,,; s, *, ,; 
p; };'
        # echo;
        # echo "Checking for lintian warnings:";
        # http://qa.debian.org/data/lintian.log

        # echo;
        # echo "Checking for PTS todo items:"
fi;

echo;
echo "Checking for installed packages up for adoption or orphaned:"
wnpp-alert |sort |
 sed -re 's/^([^[:space:]]*)[[:space:]]*([[:digit:]]*)/#\2: \1/';

echo;
echo "Checking for installed packages with release-critical bugs:"
rc-alert |sed -nre '/^Package:/,/^$/{ n; s/^Bug:[[:space:]]*/#/; N; 
s/\nTitle:[[:space:]]*/: /p; };'

exec >&-;
exec 1>&3;

Reply via email to