1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235
|
#!/bin/sh
# $Id$
# elvis: debbugs -- Search the debian BTS (bugs.debian.org)
. surfraw || exit 1
w3_config_hook () {
def SURFRAW_debbugs_search pkg
def SURFRAW_debbugs_version ""
def SURFRAW_debbugs_dist ""
defyn SURFRAW_debbugs_archive 0
defyn SURFRAW_debbugs_merge 0
defyn SURFRAW_debbugs_statussort 1
defyn SURFRAW_debbugs_head 1
defyn SURFRAW_debbugs_foot 1
def SURFRAW_debbugs_incstatus ""
def SURFRAW_debbugs_excstatus ""
def SURFRAW_debbugs_incsev ""
def SURFRAW_debbugs_excsev ""
def SURFRAW_debbugs_inctag ""
def SURFRAW_debbugs_exctag ""
defyn SURFRAW_debbugs_asmbox 0
defyn SURFRAW_debbugs_headers 0
defyn SURFRAW_debbugs_boring 0
defyn SURFRAW_debbugs_revstat 0
defyn SURFRAW_debbugs_revsev 0
defyn SURFRAW_debbugs_revbugs 0
defyn setsearch 0
}
w3_usage_hook () {
cat <<EOF
Usage: $w3_argv0 [options] [package | bug number | maintainer email]
Description:
Surfraw search debian BTS (bugs.debian.org)
Examples:
debbugs 20000 | show report for bug #20000
debbugs csurchi@debian.org | show bugs for csurchi
debbugs surfraw | show bugs for surfraw package
debbugs -raw -rb surfraw | show surfraw bugs newest first
Defaults if -search is not supplied:
If arg is numeric, searches by bug number,
If it contains '@', searches by maintainer,
Otherwise, searches by package.
Local options:
-search= pkg | Search type.
src |
bug | (bug number)
maint |
tag |
submitter |
severity |
tag
-s Alias for -search=src
-version=VERSION Package version.
-dist=oldstable | Distribution
stable |
proposed-updates |
testing |
unstable |
experimental |
testing-proposed-updates
-arc Show archived bugs.
-raw Do not sort by status or severity.
-rb Reverse order of bugs shown.
-rst Reverse order of statuses shown.
-rse Reverse order of severities shown.
-merge Display merged bugs only once.
-nohead Do not show table of contents header.
-nofoot Do not show statistics in the footer.
-mbox View results in mbox format. *
-sh Show headers. *
-boring Show boring messages. *
(* = only when searching by bug number.)
-incstat=stat1,stat2 Include given status list.
-exstat=stat3,stat4 Exclude given status list.
Available statuses:
open, forwarded, pending, fixed, done.
-incsev=sev1,sev2 Include given severities.
-exsev=sev3,sev4 Exclude given severities.
Available severities:
critical, grave, serious, important,
normal, minor, wishlist, fixed.
-inctag=tag1,tag2 Include given tags.
-extag=tag3,tag4 Exclude given tags.
Available tags:
potato, woody, sarge, sarge-ignore,
etch, etch-ignore, sid, experimental,
confirmed, d-i, fixed, fixed-in-experimental,
fixed-upstream, help, l10n, moreinfo, patch,
pending, security, unreproducible, upstream,
wontfix, ipv6, lfs
EOF
w3_global_usage
}
w3_parse_option_hook () {
opt="$1"
optarg="$2"
case "$opt" in
-s) setopt SURFRAW_debbugs_search src ; setoptyn setsearch 1 ;;
-se*=*) setopt SURFRAW_debbugs_search $optarg; setoptyn setsearch 1 ;;
-ve*=*) setopt SURFRAW_debbugs_version $optarg ;;
-dis*=*) setopt SURFRAW_debbugs_dist $optarg ;;
-arc*) setoptyn SURFRAW_debbugs_archive 1;;
-mer*) setoptyn SURFRAW_debbugs_merge 1;;
-raw*) setoptyn SURFRAW_debbugs_statussort 0;;
-noh*) setoptyn SURFRAW_debbugs_head 0;;
-nof*) setoptyn SURFRAW_debbugs_foot 0;;
-in*stat*=*) setopt SURFRAW_debbugs_incstatus $optarg;;
-ex*stat*=*) setopt SURFRAW_debbugs_excstatus $optarg;;
-in*sev*=*) setopt SURFRAW_debbugs_incsev $optarg;;
-ex*sev*=*) setopt SURFRAW_debbugs_excsev $optarg;;
-in*tag*=*) setopt SURFRAW_debbugs_inctag $optarg;;
-ex*tag*=*) setopt SURFRAW_debbugs_exctag $optarg;;
-rb*) setoptyn SURFRAW_debbugs_revbugs 1;;
-rst*) setoptyn SURFRAW_debbugs_revstat 1;;
-rse*) setoptyn SURFRAW_debbugs_revsev 1;;
-mb*) setoptyn SURFRAW_debbugs_asmbox 1;;
-sh*) setoptyn SURFRAW_debbugs_headers 1;;
-bo*) setoptyn SURFRAW_debbugs_boring 1;;
*) return 1 ;;
esac
return 0
}
w3_config
w3_parse_args "$@"
# w3_args now contains a list of arguments
if test -z "$w3_args"; then
w3_browse_url "https://www.debian.org/Bugs"
else
escaped_args=`w3_url_of_arg $w3_args`
setoptyn donum 0
setoptyn domaint 0
case "$SURFRAW_debbugs_search" in
bug*) setoptyn donum 1;;
esac
# default search unless searchtype set on cmdline
if ifno setsearch
then
export escaped_args
if perl -e 'if($ENV{escaped_args} =~/^((\#|\%23)(\s|\%20)*)?\d+$/) { exit 0; } exit 1;'
then # %23 = uri escaped '#', %20=' '
setoptyn donum 1
elif perl -e 'if($ENV{escaped_args} =~/\%40|@/) { exit 0; } exit 1;'
then # %40 = uri escaped '@'
setopt SURFRAW_debbugs_search "maint"
fi
fi
if ifyes donum
then
url="https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=${escaped_args}"
if yesno SURFRAW_debbugs_asmbox
then
url="$url&mbox=yes"
fi
if yesno SURFRAW_debbugs_headers
then
url="$url&trim=no"
fi
if yesno SURFRAW_debbugs_boring
then
url="$url&boring=yes"
fi
else
url="https://bugs.debian.org/cgi-bin/pkgreport.cgi?which=${SURFRAW_debbugs_search}&version=${SURFRAW_debbugs_version}&dist=${SURFRAW_debbugs_dist}&data=${escaped_args}"
if yesno SURFRAW_debbugs_archive
then
url="$url&archive=yes"
else
url="$url&archive=no"
fi
if ifyes SURFRAW_debbugs_merge
then
url="$url&repeatmerged=no"
fi
if ifno SURFRAW_debbugs_statussort
then
url="$url&raw=yes"
fi
if ifno SURFRAW_debbugs_head
then
url="$url&show_list_header=no"
fi
if ifno SURFRAW_debbugs_foot
then
url="$url&show_list_footer=no"
fi
if ifyes SURFRAW_debbugs_revstat
then
url="$url&pend-rev=yes"
fi
if ifyes SURFRAW_debbugs_revsev
then
url="$url&sev-rev=yes"
fi
if ifyes SURFRAW_debbugs_revbugs
then
url="$url&bug-rev=yes"
fi
if [ "$SURFRAW_debbugs_incstatus" != "" ]
then
add=`echo "$SURFRAW_debbugs_incstatus"|perl -ne 's/pending/pending-fixed/g;s/open/pending/g;print(join("&pend-inc=","",split(/\s*,\s*/,$_)));'`
url="${url}${add}"
fi
if [ "$SURFRAW_debbugs_excstatus" != "" ]
then
add=`echo "$SURFRAW_debbugs_excstatus"|perl -ne 'print(join("&pend-exc=","",split(/\s*,\s*/,$_)));'`
url="${url}${add}"
fi
if [ "$SURFRAW_debbugs_incsev" != "" ]
then
add=`echo "$SURFRAW_debbugs_incsev"|perl -ne 'print(join("&sev-inc=","",split(/\s*,\s*/,$_)));'`
url="${url}${add}"
fi
if [ "$SURFRAW_debbugs_excsev" != "" ]
then
add=`echo "$SURFRAW_debbugs_excsev"|perl -ne 'print(join("&sev-exc=","",split(/\s*,\s*/,$_)));'`
url="${url}${add}"
fi
if [ "$SURFRAW_debbugs_inctag" != "" ]
then
add=`echo "$SURFRAW_debbugs_inctag"|perl -ne 'print(join("&include=","",split(/\s*,\s*/,$_)));'`
url="${url}${add}"
fi
if [ "$SURFRAW_debbugs_exctag" != "" ]
then
add=`echo "$SURFRAW_debbugs_exctag"|perl -ne 'print(join("&exclude=","",split(/\s*,\s*/,$_)));'`
url="${url}${add}"
fi
fi
w3_browse_url "$url"
fi
|