From 6077d258b500b20e1e705f5cda567400240c7804 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 11:36:25 +0200 Subject: Adding upstream version 2.21.3+deb11u1. Signed-off-by: Daniel Baumann --- scripts/wnpp-check.sh | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100755 scripts/wnpp-check.sh (limited to 'scripts/wnpp-check.sh') diff --git a/scripts/wnpp-check.sh b/scripts/wnpp-check.sh new file mode 100755 index 0000000..a380874 --- /dev/null +++ b/scripts/wnpp-check.sh @@ -0,0 +1,101 @@ +#!/bin/bash + +# wnpp-check -- check for software being packaged or requested + +# This script is in the PUBLIC DOMAIN. +# Authors: +# David Paleino +# +# Adapted from wnpp-alert, by Arthur Korn + +set -e + +CURLORWGET="" +GETCOMMAND="" +EXACT=0 +PROGNAME=${0##*/} + +usage () { echo \ +"Usage: $PROGNAME [...] + -h,--help Show this help message + -v,--version Show a version message + + Check whether a package is listed as being packaged (ITPed) or has an + outstanding request for packaging (RFP) on the WNPP website + https://www.debian.org/devel/wnpp/" +} + +version () { echo \ +"This is $PROGNAME, from the Debian devscripts package, version ###VERSION### +This script is in the PUBLIC DOMAIN. +Authors: David Paleino +Adapted from wnpp-alert, by Arthur Korn , +with modifications by Julian Gilbey " +} + +TEMP=$(getopt -n "$PROGNAME" -o 'hve' \ + -l 'help,version,exact' \ + -- "$@") || (rc=$?; usage >&2; exit $rc) + +eval set -- "$TEMP" + +while true +do + case "$1" in + -h|--help) usage; exit 0 ;; + -v|--version) version; exit 0 ;; + -e|--exact) EXACT=1 ;; + --) shift; break ;; + esac + shift +done + +if [ -z "$1" ]; then + usage + exit 1 +fi + +PACKAGES="$@" + +if command -v wget >/dev/null 2>&1; then + CURLORWGET="wget" + GETCOMMAND="wget -q -O" +elif command -v curl >/dev/null 2>&1; then + CURLORWGET="curl" + GETCOMMAND="curl -qfs -o" +else + echo "$PROGNAME: need either the wget or curl package installed to run this" >&2 + exit 1 +fi + +WNPP=$(mktemp --tmpdir wnppcheck-wnpp.XXXXXX) +WNPPTMP=$(mktemp --tmpdir wnppcheck-wnpp.XXXXXX) +WNPP_PACKAGES=$(mktemp --tmpdir wnppcheck-wnpp_packages.XXXXXX) +trap 'rm -f "$WNPP" "$WNPPTMP" "$WNPP_PACKAGES"' EXIT + +# Here's a really sly sed script. Rather than first grepping for +# matching lines and then processing them, this attempts to sed +# every line; those which succeed execute the 'p' command, those +# which don't skip over it to the label 'd' + +$GETCOMMAND $WNPPTMP http://www.debian.org/devel/wnpp/being_packaged || \ + { echo "$PROGNAME: $CURLORWGET http://www.debian.org/devel/wnpp/being_packaged failed." >&2; exit 1; } +sed -ne 's/.*
  • \([^:<]*\)[: ]*\([^<]*\)<\/a>.*/ITP \1 \2 -- \3/; T d; p; : d' $WNPPTMP > $WNPP + +$GETCOMMAND $WNPPTMP http://www.debian.org/devel/wnpp/requested || \ + { echo "$PROGNAME: $CURLORWGET http://www.debian.org/devel/wnpp/requested failed." >&2; exit 1; } +sed -ne 's/.*
  • \([^:<]*\)[: ]*\([^<]*\)<\/a>.*/RFP \1 \2 -- \3/; T d; p; : d' $WNPPTMP >> $WNPP + +awk -F' ' '{print "("$1" - #"$2") http://bugs.debian.org/"$2" "$3}' $WNPP | sort -k 5 > $WNPP_PACKAGES + +FOUND=0 +for pkg in $PACKAGES +do + if [ $EXACT != 1 ]; then + grep $pkg $WNPP_PACKAGES && FOUND=1 + else + grep " $pkg$" $WNPP_PACKAGES && FOUND=1 + fi +done + +exit $FOUND -- cgit v1.2.3