bugzilla_mesa.sh revision 848b8605
1848b8605Smrg#!/bin/bash
2848b8605Smrg
3848b8605Smrg# This script is used to generate the list of fixed bugs that
4848b8605Smrg# appears in the release notes files, with HTML formatting.
5848b8605Smrg#
6848b8605Smrg# Note: This script could take a while until all details have
7848b8605Smrg#       been fetched from bugzilla.
8848b8605Smrg#
9848b8605Smrg# Usage examples:
10848b8605Smrg#
11848b8605Smrg# $ bin/bugzilla_mesa.sh mesa-9.0.2..mesa-9.0.3
12848b8605Smrg# $ bin/bugzilla_mesa.sh mesa-9.0.2..mesa-9.0.3 > bugfixes
13848b8605Smrg# $ bin/bugzilla_mesa.sh mesa-9.0.2..mesa-9.0.3 | tee bugfixes
14848b8605Smrg# $ DRYRUN=yes bin/bugzilla_mesa.sh mesa-9.0.2..mesa-9.0.3
15848b8605Smrg# $ DRYRUN=yes bin/bugzilla_mesa.sh mesa-9.0.2..mesa-9.0.3 | wc -l
16848b8605Smrg
17848b8605Smrg
18848b8605Smrg# regex pattern: trim before url
19848b8605Smrgtrim_before='s/.*\(http\)/\1/'
20848b8605Smrg
21848b8605Smrg# regex pattern: trim after url
22848b8605Smrgtrim_after='s/\(show_bug.cgi?id=[0-9]*\).*/\1/'
23848b8605Smrg
24848b8605Smrg# regex pattern: always use https
25848b8605Smrguse_https='s/http:/https:/'
26848b8605Smrg
27848b8605Smrg# extract fdo urls from commit log
28848b8605Smrgurls=$(git log $* | grep 'bugs.freedesktop.org/show_bug' | sed -e $trim_before -e $trim_after -e $use_https | sort | uniq)
29848b8605Smrg
30848b8605Smrg# if DRYRUN is set to "yes", simply print the URLs and don't fetch the
31848b8605Smrg# details from fdo bugzilla.
32848b8605Smrg#DRYRUN=yes
33848b8605Smrg
34848b8605Smrgif [ "x$DRYRUN" = xyes ]; then
35848b8605Smrg	for i in $urls
36848b8605Smrg	do
37848b8605Smrg		echo $i
38848b8605Smrg	done
39848b8605Smrgelse
40848b8605Smrg	echo "<ul>"
41848b8605Smrg	echo ""
42848b8605Smrg
43848b8605Smrg	for i in $urls
44848b8605Smrg	do
45848b8605Smrg		id=$(echo $i | cut -d'=' -f2)
46848b8605Smrg		summary=$(wget --quiet -O - $i | grep -e '<title>.*</title>' | sed -e 's/ *<title>Bug [0-9]\+ &ndash; \(.*\)<\/title>/\1/')
47848b8605Smrg		echo "<li><a href=\"$i\">Bug $id</a> - $summary</li>"
48848b8605Smrg		echo ""
49848b8605Smrg	done
50848b8605Smrg
51848b8605Smrg	echo "</ul>"
52848b8605Smrgfi
53