All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	stefanha@redhat.com, Paolo Bonzini <pbonzini@redhat.com>,
	berrange@redhat.com
Subject: [Qemu-devel] [PATCH v2] scripts: Add a script to check for bug URLs in the git log
Date: Tue, 13 Sep 2016 15:20:58 +0200	[thread overview]
Message-ID: <1473772858-30881-1-git-send-email-thuth@redhat.com> (raw)

Basic idea of this script is to check the git log for URLs
to the QEMU bugtracker at launchpad.net and to figure out
whether the related bug has been marked there as "Fix released"
(i.e. closed) already. So this script can e.g. be used after
each public release of QEMU to check whether there are any
bug tickets that could be moved from "Fix committed" (or another
state if the author of the patch forgot to update the bug ticket)
to "Fix released".

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 v2:
 - Use xdg-open and friends to open the URLs in a browser
 - Some cosmetics

 scripts/show-fixed-bugs.sh | 91 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 91 insertions(+)
 create mode 100755 scripts/show-fixed-bugs.sh

diff --git a/scripts/show-fixed-bugs.sh b/scripts/show-fixed-bugs.sh
new file mode 100755
index 0000000..89847bd
--- /dev/null
+++ b/scripts/show-fixed-bugs.sh
@@ -0,0 +1,91 @@
+#!/bin/sh
+
+# This script checks the git log for URLs to the QEMU launchpad bugtracker
+# and optionally checks whether the corresponding bugs are not closed yet.
+
+function show_help {
+    echo "Usage:"
+    echo "  -s <commit>  : Start searching at this commit"
+    echo "  -e <commit>  : End searching at this commit"
+    echo "  -c           : Check if bugs are still open"
+    echo "  -b           : Open bugs in browser"
+}
+
+while [ $# -ge 1 ]; do
+   case "$1" in
+    -s)  START="$2" ; shift ;;
+    -e)  END="$2" ; shift ;;
+    -c)  CHECK_IF_OPEN=1 ;;
+    -b)  SHOW_IN_BROWSER=1 ;;
+    -h)  show_help ; exit 0 ;;
+    *)   echo "Unkown option $1 ... use -h for help." ; exit 1 ;;
+   esac
+   shift
+done
+
+if [ "x$START" = "x" ]; then
+    START=`git tag | grep 'v[0-9]*\.[0-9]*.0$' | tail -n 2 | head -n 1`
+fi
+if [ "x$END" = "x" ]; then
+    END=`git tag | grep 'v[0-9]*\.[0-9]*.0$' | tail -n 1`
+fi
+
+if [ "x$BROWSER" != "x" ]; then
+    BUGBROWSER = "$BROWSER"
+elif which xdg-open > /dev/null; then
+    BUGBROWSER=xdg-open
+elif which gnome-open > /dev/null; then
+    BUGBROWSER=gnome-open
+elif [ `uname` = "Darwin" ]; then
+    BUGBROWSER=open
+elif which sensible-browser > /dev/null; then
+    BUGBROWSER=sensible-browser
+else
+    echo "Please set the BROWSER variable to the browser of your choice."
+    exit 1
+fi
+
+if [ "x$START" = "x" -o "x$END" = "x" ]; then
+    echo "Could not determine start or end revision ... Please note that this"
+    echo "script must be run from a checked out git repository of QEMU!"
+    exit 1
+fi
+
+echo "Searching git log for bugs in the range $START..$END"
+
+BUG_URLS=`git log $START..$END \
+  | grep 'https://bugs.launchpad.net/\(bugs\|qemu/+bug\)/' \
+  | sed 's,\(.*\)\(https://bugs.launchpad.net/\(bugs\|qemu/+bug\)/\)\([0-9]*\).*,\2\4,' \
+  | sort -u`
+
+echo Found bug URLs:
+for i in $BUG_URLS ; do echo " $i" ; done
+
+if [ "x$CHECK_IF_OPEN" = "x1" ]; then
+    echo
+    echo "Checking which ones are still opened..."
+    for i in $BUG_URLS ; do
+        if ! curl -s -L "$i" | grep "value status" | grep -q "Fix Released" ; then
+            echo " $i"
+            FINAL_BUG_URLS="$FINAL_BUG_URLS $i"
+        fi
+    done
+else
+    FINAL_BUG_URLS=$BUG_URLS
+fi
+
+if [ "x$FINAL_BUG_URLS" = "x" ]; then
+    echo "No open bugs found."
+elif [ "x$SHOW_IN_BROWSER" = "x1" ]; then
+    FIRST=1
+    for i in $FINAL_BUG_URLS; do
+        "$BUGBROWSER" "$i"
+        if [ $FIRST = 1 ]; then
+            # if it is the first entry, give the browser some time to start
+            # (to avoid messages like "Firefox is already running, but is
+            # not responding...")
+            sleep 4
+            FIRST=0
+        fi
+    done
+fi
-- 
1.8.3.1

             reply	other threads:[~2016-09-13 13:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-13 13:20 Thomas Huth [this message]
2016-09-13 15:48 ` [Qemu-devel] [PATCH v2] scripts: Add a script to check for bug URLs in the git log Eric Blake
2016-09-13 16:06   ` Daniel P. Berrange
2016-09-14 10:35     ` Thomas Huth
2016-09-14 14:44       ` Eric Blake
2016-09-14 21:02         ` Thomas Huth
2016-09-14 21:17           ` Eric Blake

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1473772858-30881-1-git-send-email-thuth@redhat.com \
    --to=thuth@redhat.com \
    --cc=berrange@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.