Revert "cmake: fix version check for c-ares and gnuTLS"
[metze/wireshark/wip.git] / tools / gen-bugnote
1 #!/bin/bash
2 #
3 # Given a Wireshark bug ID, fetch its title and prepare an entry suitable
4 # for pasting into the release notes. Requires curl, grep, and sed.
5 #
6 # Usage: gen-bugnote <bug number>
7 #
8 # Copyright 2013 Gerald Combs
9 #
10 # SPDX-License-Identifier: GPL-2.0-or-later
11 #
12
13 bz_url_pfx="https://bugs.wireshark.org/bugzilla/show_bug.cgi"
14 bug_id="$1"
15
16 recode_cmd="cat"
17 hash recode > /dev/null 2>&1 && recode_cmd="recode html..utf8"
18
19 case "$OSTYPE" in
20     darwin*)
21         clipboard_cmd="pbcopy -Pascii"
22         ;;
23     cygwin*)
24         clipboard_cmd="cat > /dev/clipboard"
25         ;;
26     linux*)
27         clipboard_cmd="xsel --clipboard"
28         ;;
29     *)
30         echo "Unable to copy to clipboard"
31         clipboard_cmd="cat > /dev/null"
32         ;;
33 esac
34
35 if [ -z "$bug_id" ] ; then
36     echo "Usage: $( basename "$0" ) <bug id>"
37     exit 1
38 fi
39
40 bug_title=$(
41     curl -s -o - "${bz_url_pfx}?id=$bug_id" \
42     | grep -i '<title>' \
43     | sed \
44         -e 's/{/\\{/' \
45         -e 's:.*<title>.*ndash; ::' \
46         -e 's:</title>.*::' \
47         -e 's/[^\.]$/&./' \
48         -e 's/\\/{backslash}/' \
49     )
50
51 echo -e "* $bug_title wsbuglink:${bug_id}[].\\n" \
52         | $recode_cmd \
53         | $clipboard_cmd
54
55 echo "Copied $bug_id: $bug_title"