1b8e80941Smrg#!/bin/sh
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
15848b8605Smrg
16b8e80941Smrg# regex pattern: trim before bug number
17b8e80941Smrgtrim_before='s/.*show_bug.cgi?id=\([0-9]*\).*/\1/'
18848b8605Smrg
19b8e80941Smrg# regex pattern: reconstruct the url
20b8e80941Smrguse_after='s,^,https://bugs.freedesktop.org/show_bug.cgi?id=,'
21848b8605Smrg
22b8e80941Smrgecho "<ul>"
23b8e80941Smrgecho ""
24848b8605Smrg
25848b8605Smrg# extract fdo urls from commit log
26b8e80941Smrggit log --pretty=medium $* | grep 'bugs.freedesktop.org/show_bug' | sed -e $trim_before | sort -n -u | sed -e $use_after |\
27b8e80941Smrgwhile read url
28b8e80941Smrgdo
29b8e80941Smrg	id=$(echo $url | cut -d'=' -f2)
30b8e80941Smrg	summary=$(wget --quiet -O - $url | grep -e '<title>.*</title>' | sed -e 's/ *<title>[0-9]\+ &ndash; \(.*\)<\/title>/\1/')
31b8e80941Smrg	echo "<li><a href=\"$url\">Bug $id</a> - $summary</li>"
32848b8605Smrg	echo ""
33b8e80941Smrgdone
34848b8605Smrg
35b8e80941Smrgecho "</ul>"
36