bugzilla_mesa.sh revision 848b8605
1#!/bin/bash
2
3# This script is used to generate the list of fixed bugs that
4# appears in the release notes files, with HTML formatting.
5#
6# Note: This script could take a while until all details have
7#       been fetched from bugzilla.
8#
9# Usage examples:
10#
11# $ bin/bugzilla_mesa.sh mesa-9.0.2..mesa-9.0.3
12# $ bin/bugzilla_mesa.sh mesa-9.0.2..mesa-9.0.3 > bugfixes
13# $ bin/bugzilla_mesa.sh mesa-9.0.2..mesa-9.0.3 | tee bugfixes
14# $ DRYRUN=yes bin/bugzilla_mesa.sh mesa-9.0.2..mesa-9.0.3
15# $ DRYRUN=yes bin/bugzilla_mesa.sh mesa-9.0.2..mesa-9.0.3 | wc -l
16
17
18# regex pattern: trim before url
19trim_before='s/.*\(http\)/\1/'
20
21# regex pattern: trim after url
22trim_after='s/\(show_bug.cgi?id=[0-9]*\).*/\1/'
23
24# regex pattern: always use https
25use_https='s/http:/https:/'
26
27# extract fdo urls from commit log
28urls=$(git log $* | grep 'bugs.freedesktop.org/show_bug' | sed -e $trim_before -e $trim_after -e $use_https | sort | uniq)
29
30# if DRYRUN is set to "yes", simply print the URLs and don't fetch the
31# details from fdo bugzilla.
32#DRYRUN=yes
33
34if [ "x$DRYRUN" = xyes ]; then
35	for i in $urls
36	do
37		echo $i
38	done
39else
40	echo "<ul>"
41	echo ""
42
43	for i in $urls
44	do
45		id=$(echo $i | cut -d'=' -f2)
46		summary=$(wget --quiet -O - $i | grep -e '<title>.*</title>' | sed -e 's/ *<title>Bug [0-9]\+ &ndash; \(.*\)<\/title>/\1/')
47		echo "<li><a href=\"$i\">Bug $id</a> - $summary</li>"
48		echo ""
49	done
50
51	echo "</ul>"
52fi
53