diff options
author | Emil Velikov <emil.velikov@collabora.com> | 2017-02-23 11:57:49 +0000 |
---|---|---|
committer | Emil Velikov <emil.l.velikov@gmail.com> | 2017-03-10 14:12:48 +0000 |
commit | 3aa5f51c2706023ff707d1e28410f8d9e67e6c6c (patch) | |
tree | 1c8358eb2721eaa9f22a7777aa7621fa6ed9a200 /bin | |
parent | 1c3a1d74ec250bd0b51413a24466cab085c7d55e (diff) |
bin/bugzilla_mesa.sh: rework the looping method
We don't use DRYRUN (and no others scripts have one) so just drop it.
This allows us to rework the loop to the more commonly used "git .... |
while read foo; do ... done"
That in itself gets rid of the only remaining bashism and we can toggle
the shebang to /bin/sh.
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Andreas Boll <andreas.boll.dev@gmail.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/bugzilla_mesa.sh | 38 |
1 files changed, 12 insertions, 26 deletions
diff --git a/bin/bugzilla_mesa.sh b/bin/bugzilla_mesa.sh index 49b9ce9c75..a8f5305844 100755 --- a/bin/bugzilla_mesa.sh +++ b/bin/bugzilla_mesa.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # This script is used to generate the list of fixed bugs that # appears in the release notes files, with HTML formatting. @@ -11,8 +11,6 @@ # $ bin/bugzilla_mesa.sh mesa-9.0.2..mesa-9.0.3 # $ bin/bugzilla_mesa.sh mesa-9.0.2..mesa-9.0.3 > bugfixes # $ bin/bugzilla_mesa.sh mesa-9.0.2..mesa-9.0.3 | tee bugfixes -# $ DRYRUN=yes bin/bugzilla_mesa.sh mesa-9.0.2..mesa-9.0.3 -# $ DRYRUN=yes bin/bugzilla_mesa.sh mesa-9.0.2..mesa-9.0.3 | wc -l # regex pattern: trim before bug number @@ -21,29 +19,17 @@ trim_before='s/.*show_bug.cgi?id=\([0-9]*\).*/\1/' # regex pattern: reconstruct the url use_after='s,^,https://bugs.freedesktop.org/show_bug.cgi?id=,' -# extract fdo urls from commit log -urls=$(git log $* | grep 'bugs.freedesktop.org/show_bug' | sed -e $trim_before | sort -n -u | sed -e $use_after) - -# if DRYRUN is set to "yes", simply print the URLs and don't fetch the -# details from fdo bugzilla. -#DRYRUN=yes +echo "<ul>" +echo "" -if [ "x$DRYRUN" = xyes ]; then - for i in $urls - do - echo $i - done -else - echo "<ul>" +# extract fdo urls from commit log +git log $* | grep 'bugs.freedesktop.org/show_bug' | sed -e $trim_before | sort -n -u | sed -e $use_after |\ +while read url +do + id=$(echo $url | cut -d'=' -f2) + summary=$(wget --quiet -O - $url | grep -e '<title>.*</title>' | sed -e 's/ *<title>[0-9]\+ – \(.*\)<\/title>/\1/') + echo "<li><a href=\"$url\">Bug $id</a> - $summary</li>" echo "" +done - for i in $urls - do - id=$(echo $i | cut -d'=' -f2) - summary=$(wget --quiet -O - $i | grep -e '<title>.*</title>' | sed -e 's/ *<title>[0-9]\+ – \(.*\)<\/title>/\1/') - echo "<li><a href=\"$i\">Bug $id</a> - $summary</li>" - echo "" - done - - echo "</ul>" -fi +echo "</ul>" |