[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Helper script



Hello,

I've written a small script that lists all installed packages
that have RC bugs. This is hacked from wnpp-alert from devscripts
and is called rcbugs-alert.

This may help people who want to help QA by figuring out how to patch
these bugs. The principle is that people who use a package
would like to see its bugs squashed.

Regards,

Kapil.

encl: rcbugs-alert (A bash script which depends on w3m/lynx)

-- 

#! /bin/bash -e

# rcbugs-alert -- check for installed packages which have been RC bugs

# This script is in the PUBLIC DOMAIN.
# Authors:
# Kapil Hari Paranjape <kapil@imsc.res.in>
# Heavily hacked from wnpp-alert written by
# Arthur Korn <arthur@korn.ch>

PROGNAME=`basename $0`
RCBUGS_URL='http://bugs.debian.org/release-critical/debian/all.html'
DEBUG=""

usage () { echo \
"Usage: $PROGNAME [--help|-h|--version|-v]
  List all installed packages with RC bugs against them,
  as determined from the bugs.debian.org website."
}

version () { echo \
"This is $PROGNAME, based on wnpp-alert from the Debian devscripts package, version 2.9.10
This script is in the PUBLIC DOMAIN.
Authors: Kapil Hari Paranjape <kapil@imsc.res.in>"
}

if [ "x$1" = "x--help" -o "x$1" = "x-h" ]; then usage; exit 0; fi
if [ "x$1" = "x--version" -o "x$1" = "x-v" ]; then version; exit 0; fi

if command -v w3m >/dev/null 2>&1; then
    URL2TXT='w3m -dump'
elif command -v lynx >/dev/null 2>&1; then
    URL2TXT='lynx -dump -nolist'
else 
    echo "$PROGNAME: need w3m or lynx installed to run this" >&2
    exit 1
fi


INSTALLED=`mktemp -t rcbugsalert-installed.XXXXXX`
[ -z "$DEBUG" ] && trap "rm -f '$INSTALLED'" 0 1 2 3 7 10 13 15
RCBUGS=`mktemp -t rcbugsalert-rcbugs.XXXXXX`
[ -z "$DEBUG" ] && trap "rm -f '$INSTALLED' '$RCBUGS'" 0 1 2 3 7 10 13 15
RCBUGS_PACKAGES=`mktemp -t rcbugsalert-rcbugs_packages.XXXXXX`
[ -z "$DEBUG" ] && trap "rm -f '$INSTALLED' '$RCBUGS' '$RCBUGS_PACKAGES'" \
  0 1 2 3 7 10 13 15
SCRIPT=`mktemp -t rcbugsalert-script.XXXXXX`
[ -z "$DEBUG" ] && trap "rm -f '$INSTALLED' '$RCBUGS' '$RCBUGS_PACKAGES' '$SCRIPT'" \
  0 1 2 3 7 10 13 15

# Get the RC bug list in text form and
# Extract the list of packages
$URL2TXT $RCBUGS_URL > $RCBUGS

sed -ne 's;^Package: \([^ ]*\) .*$;\1;p' < $RCBUGS > $RCBUGS_PACKAGES

# A list of installed files.
# This shouldn't use knowledge of the internal /var/lib/dpkg/status
# format directly, but speed ...
# For the correct settings of -B# -A#, keep up-to-date with
# the dpkg source, defn of fieldinfos[] in lib/parse.c
# (and should match Devscripts/Packages.pm)

# The pattern ^\(Package\|Source\): is also possible
grep -B2 -A7 'Status: install ok installed' /var/lib/dpkg/status | \
sed -ne 's;^Package: ;;p' | \
sort -u > $INSTALLED

# Print the head of the RC Bugs text
sed -n -e'1,/^Package/{s/^Package.*$//;p}' < $RCBUGS

# Generate a sed script to print all lines associated
# with the given package from the RC bugs list.
comm -12 $RCBUGS_PACKAGES $INSTALLED | \
sed -e 's;^;/^Package: ;' -e 's;$; /,/^$/p;' > $SCRIPT
sed -n -f $SCRIPT < $RCBUGS

exit 0

Attachment: signature.asc
Description: Digital signature


Reply to: