blob: 0cff4261f7543a675a49161bb3a718c41115991e [file] [log] [blame]
Andreas Bollca79b722013-04-17 18:14:44 +02001#!/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
Emil Velikovc5050642015-07-13 20:01:39 +010018# regex pattern: trim before bug number
19trim_before='s/.*show_bug.cgi?id=\([0-9]*\).*/\1/'
Andreas Bollca79b722013-04-17 18:14:44 +020020
Emil Velikovc5050642015-07-13 20:01:39 +010021# regex pattern: reconstruct the url
22use_after='s,^,https://bugs.freedesktop.org/show_bug.cgi?id=,'
Andreas Bollca79b722013-04-17 18:14:44 +020023
24# extract fdo urls from commit log
Emil Velikovc5050642015-07-13 20:01:39 +010025urls=$(git log $* | grep 'bugs.freedesktop.org/show_bug' | sed -e $trim_before | sort -n -u | sed -e $use_after)
Andreas Bollca79b722013-04-17 18:14:44 +020026
27# if DRYRUN is set to "yes", simply print the URLs and don't fetch the
28# details from fdo bugzilla.
29#DRYRUN=yes
30
31if [ "x$DRYRUN" = xyes ]; then
32 for i in $urls
33 do
34 echo $i
35 done
36else
37 echo "<ul>"
38 echo ""
39
40 for i in $urls
41 do
42 id=$(echo $i | cut -d'=' -f2)
43 summary=$(wget --quiet -O - $i | grep -e '<title>.*</title>' | sed -e 's/ *<title>Bug [0-9]\+ &ndash; \(.*\)<\/title>/\1/')
44 echo "<li><a href=\"$i\">Bug $id</a> - $summary</li>"
45 echo ""
46 done
47
48 echo "</ul>"
49fi