On Fri, Mar 31, 2006 at 06:58:24PM +0100, Julian Gilbey wrote:
> On Thu, Mar 23, 2006 at 03:15:10PM -0500, Justin Pryzby wrote:
> > Here's an updated copy of the tool, which should be runnable now
> > without copying it; the dehs stuff might be in flux, though..
> 
> Anyone got an idea for a better name than dev-best-practice, since it
> seems like something we could just stick in /usr/bin and be done with
> it?
> 
> Something like dev-check-system or dev-package-status or something
> like that?
Sure, whatever :)  "devcheck" is too much like the QA debcheck, but
how about "dev-checker"?

> BTW, I have an additional way of avoiding the "killing the BTS at
> 02:00 local time": just change the heading to say:
> 
> # Best-practice information for Debian developers
> # intended to be run periodically as a cronjob, for example weekly as:
> #   0 hour * * day  /usr/bin/dev-best-practice
> # (replacing hour and day by your preferred times!)
I prefer to give something copy-and-paste-able, and which doesn't
assume that everyone wont use day=0 hour=0.

I'm attaching the most recent copy; help2man output is even sane.

DEHS apparently didn't work on the last run because of some BTS
hickup; Stefano was rebuilding it yesterday, but it still doesn't list
useful upstream release info..

Justin
#! /bin/bash
# dev-checker
# 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 --delay --mail
#
# 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;

version=0;

# Options' default values are candidates for devscripts.conf...
XMAIL='';
XDELAY='';

# help2man -S Debian -N -m devscripts -n 'Best practice information for Debian 
developers' -i <(echo [SEE ALSO]; echo 'devscripts (1)') ./dev-best-practice 
|nroff -man |less

bts='http://bugs.debian.org';
ddpo='http://qa.debian.org/developer.php';
dehs='http://dehs.alioth.debian.org/maintainer.php';

# Version info
function version ()
{
        echo "$0 ($version)"
        echo;
        echo "Copyright (C) 2006 Justin Pryzby <[EMAIL PROTECTED]>;";
        echo "Distributed under the MIT license grant.";
}

# Help message
function usage ()
{
        echo "Usage: $0 [option]...";
        echo "Best-practice information for Debian developers.";
        echo "Display important information expected to be interesting to the 
invoking developer."

        echo;
        echo "Options:";
        echo " --help -h        This message";
        echo " --version -v     Version and copyright info";
        echo " --mail           Send mail rather than displaying to stdout"
        echo " --delay          Delay for a random time interval at startup"
}

# Source a shell fragment
function src ()
{
        [ -e "$1" ] && . "$1"
}

while test $# -gt 0; do
        case "$1" in
        -v|-version|--version)
                version;
                [ $# -eq 1 ] && exit 0;
                exit 1;
                ;;
        -h|-help|--help)
                usage;
                [ $# -eq 1 ] && exit 0;
                exit 1;
                ;;
        --mail)
                XMAIL=1;
                ;;
        --delay|-d)
                XDELAY=1;
                ;;
        *)
                echo >&2 "Unknown argument: $1.";       
                exit 1;
        esac;
        shift;
done;

# Some randomization to avoid developers hammering the BTS sunday at
# 0200 local time.
test -n "$XDELAY" && sleep $((1 + (3600 * $RANDOM / 32768)))

if [ -n "$XMAIL" ]; then
        exec 3>&1;
        exec 1> >(mail -s "Debian fixme list for $LOGNAME on `date +%x`" 
$LOGNAME)
fi;

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
        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:";
        test -z $MAINTEMAIL || DEBEMAIL="$MAINTEMAIL";
        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, orphaned, or in need of 
help:"
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; };'

if [ -n "$XMAIL" ]; then
        exec >&-;
        exec 1>&3;
fi;

Reply via email to