All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v3] scripts: Add a script to check for bug URLs in the git log
@ 2016-09-21 19:42 Thomas Huth
  2016-09-21 20:00 ` Eric Blake
  2016-09-21 20:08 ` Paolo Bonzini
  0 siblings, 2 replies; 6+ messages in thread
From: Thomas Huth @ 2016-09-21 19:42 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, stefanha, Paolo Bonzini, Eric Blake

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>
---
 v3: Adressed Eric's review comments from v2 (fixed bashisms, more
     POSIX compliance, use lower-case variable names, etc.)

 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..9dcc0f7
--- /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.
+
+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 getopts "s:e:cbh" opt; do
+   case "$opt" in
+    s)  start="$OPTARG" ;;
+    e)  end="$OPTARG" ;;
+    c)  check_if_open=1 ;;
+    b)  show_in_browser=1 ;;
+    h)  show_help ; exit 0 ;;
+    *)   echo "Use -h for help." ; exit 1 ;;
+   esac
+done
+
+if [ "x$start" = "x" ]; then
+    start=`git tag -l 'v[0-9]*\.[0-9]*.0' | tail -n 2 | head -n 1`
+fi
+if [ "x$end" = "x" ]; then
+    end=`git tag -l  'v[0-9]*\.[0-9]*.0' | tail -n 1`
+fi
+
+if [ "x$start" = "x" ] || [ "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"
+
+urlstr='https://bugs.launchpad.net/\(bugs\|qemu/+bug\)/'
+bug_urls=`git log $start..$end \
+  | sed -n '\,'"$urlstr"', s,\(.*\)\('"$urlstr"'\)\([0-9]*\).*,\2\4,p' \
+  | 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
+    # Try to determine which browser we should use
+    if [ "x$BROWSER" != "x" ]; then
+        bugbrowser="$BROWSER"
+    elif command -v xdg-open >/dev/null 2>&1; then
+        bugbrowser=xdg-open
+    elif command -v gnome-open >/dev/null 2>&1; then
+        bugbrowser=gnome-open
+    elif [ "`uname`" = "Darwin" ]; then
+        bugbrowser=open
+    elif command -v sensible-browser >/dev/null 2>&1; then
+        bugbrowser=sensible-browser
+    else
+        echo "Please set the BROWSER variable to the browser of your choice."
+        exit 1
+    fi
+    # Now show the bugs in the browser
+    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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH v3] scripts: Add a script to check for bug URLs in the git log
  2016-09-21 19:42 [Qemu-devel] [PATCH v3] scripts: Add a script to check for bug URLs in the git log Thomas Huth
@ 2016-09-21 20:00 ` Eric Blake
  2016-09-22  7:00   ` Thomas Huth
  2016-09-21 20:08 ` Paolo Bonzini
  1 sibling, 1 reply; 6+ messages in thread
From: Eric Blake @ 2016-09-21 20:00 UTC (permalink / raw)
  To: Thomas Huth, qemu-devel; +Cc: Peter Maydell, stefanha, Paolo Bonzini

[-- Attachment #1: Type: text/plain, Size: 1678 bytes --]

On 09/21/2016 02:42 PM, Thomas Huth wrote:
> 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>
> ---
>  v3: Adressed Eric's review comments from v2 (fixed bashisms, more
>      POSIX compliance, use lower-case variable names, etc.)
> 

> +
> +if [ "x$start" = "x" ]; then
> +    start=`git tag -l 'v[0-9]*\.[0-9]*.0' | tail -n 2 | head -n 1`
> +fi
> +if [ "x$end" = "x" ]; then
> +    end=`git tag -l  'v[0-9]*\.[0-9]*.0' | tail -n 1`

This would match v1.100 (not that we are likely to have that tag); both
lines are missing a \ before the second '.' if you are trying to
constrain it to just vX.Y.Z forms.

> +fi
> +
> +if [ "x$start" = "x" ] || [ "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!"

I'd drop the ending !; we don't need to shout at the user.

At any rate, you have indeed addressed the portability issues I pointed
out, so with the missing \ fixed, I'm okay with adding:
Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH v3] scripts: Add a script to check for bug URLs in the git log
  2016-09-21 19:42 [Qemu-devel] [PATCH v3] scripts: Add a script to check for bug URLs in the git log Thomas Huth
  2016-09-21 20:00 ` Eric Blake
@ 2016-09-21 20:08 ` Paolo Bonzini
  2016-09-22  7:02   ` Thomas Huth
  1 sibling, 1 reply; 6+ messages in thread
From: Paolo Bonzini @ 2016-09-21 20:08 UTC (permalink / raw)
  To: Thomas Huth, qemu-devel; +Cc: Peter Maydell, stefanha

On 21/09/2016 21:42, Thomas Huth wrote:
> 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>
> ---
>  v3: Adressed Eric's review comments from v2 (fixed bashisms, more
>      POSIX compliance, use lower-case variable names, etc.)

Queued with this squashed in:

diff --git a/scripts/show-fixed-bugs.sh b/scripts/show-fixed-bugs.sh
index 9dcc0f7..6e64edd 100755
--- a/scripts/show-fixed-bugs.sh
+++ b/scripts/show-fixed-bugs.sh
@@ -23,7 +23,7 @@ while getopts "s:e:cbh" opt; do
 done
 
 if [ "x$start" = "x" ]; then
-    start=`git tag -l 'v[0-9]*\.[0-9]*.0' | tail -n 2 | head -n 1`
+    start=`git tag -l 'v[0-9]*\.[0-9]*\.0' | tail -n 2 | head -n 1`
 fi
 if [ "x$end" = "x" ]; then
     end=`git tag -l  'v[0-9]*\.[0-9]*.0' | tail -n 1`
@@ -31,7 +31,7 @@ fi
 
 if [ "x$start" = "x" ] || [ "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!"
+    echo "script must be run from a checked out git repository of QEMU."
     exit 1
 fi
 
@@ -47,7 +47,7 @@ for i in $bug_urls ; do echo " $i" ; done
 
 if [ "x$check_if_open" = "x1" ]; then
     echo
-    echo "Checking which ones are still opened..."
+    echo "Checking which ones are still open..."
     for i in $bug_urls ; do
         if ! curl -s -L "$i" | grep "value status" | grep -q "Fix Released" ; then
             echo " $i"

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH v3] scripts: Add a script to check for bug URLs in the git log
  2016-09-21 20:00 ` Eric Blake
@ 2016-09-22  7:00   ` Thomas Huth
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Huth @ 2016-09-22  7:00 UTC (permalink / raw)
  To: Eric Blake; +Cc: qemu-devel, Peter Maydell, stefanha, Paolo Bonzini

[-- Attachment #1: Type: text/plain, Size: 1840 bytes --]

On Wed, 21 Sep 2016 15:00:21 -0500
Eric Blake <eblake@redhat.com> wrote:

> On 09/21/2016 02:42 PM, Thomas Huth wrote:
> > 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>
> > ---
> >  v3: Adressed Eric's review comments from v2 (fixed bashisms, more
> >      POSIX compliance, use lower-case variable names, etc.)
> > 
> 
> > +
> > +if [ "x$start" = "x" ]; then
> > +    start=`git tag -l 'v[0-9]*\.[0-9]*.0' | tail -n 2 | head -n 1`
> > +fi
> > +if [ "x$end" = "x" ]; then
> > +    end=`git tag -l  'v[0-9]*\.[0-9]*.0' | tail -n 1`
> 
> This would match v1.100 (not that we are likely to have that tag); both
> lines are missing a \ before the second '.' if you are trying to
> constrain it to just vX.Y.Z forms.

Oh, you're right, of course - the idea was to constrain the output to
the official .0 releases.

> > +fi
> > +
> > +if [ "x$start" = "x" ] || [ "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!"
> 
> I'd drop the ending !; we don't need to shout at the user.
> 
> At any rate, you have indeed addressed the portability issues I pointed
> out, so with the missing \ fixed, I'm okay with adding:
> Reviewed-by: Eric Blake <eblake@redhat.com>

Thanks!

 Thomas

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH v3] scripts: Add a script to check for bug URLs in the git log
  2016-09-21 20:08 ` Paolo Bonzini
@ 2016-09-22  7:02   ` Thomas Huth
  2016-09-22  8:53     ` Paolo Bonzini
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Huth @ 2016-09-22  7:02 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel, Peter Maydell, stefanha

On Wed, 21 Sep 2016 22:08:10 +0200
Paolo Bonzini <pbonzini@redhat.com> wrote:

> On 21/09/2016 21:42, Thomas Huth wrote:
> > 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>
> > ---
> >  v3: Adressed Eric's review comments from v2 (fixed bashisms, more
> >      POSIX compliance, use lower-case variable names, etc.)
> 
> Queued with this squashed in:

Thanks a lot for the fixup. But...

> diff --git a/scripts/show-fixed-bugs.sh b/scripts/show-fixed-bugs.sh
> index 9dcc0f7..6e64edd 100755
> --- a/scripts/show-fixed-bugs.sh
> +++ b/scripts/show-fixed-bugs.sh
> @@ -23,7 +23,7 @@ while getopts "s:e:cbh" opt; do
>  done
>  
>  if [ "x$start" = "x" ]; then
> -    start=`git tag -l 'v[0-9]*\.[0-9]*.0' | tail -n 2 | head -n 1`
> +    start=`git tag -l 'v[0-9]*\.[0-9]*\.0' | tail -n 2 | head -n 1`
>  fi
>  if [ "x$end" = "x" ]; then
>      end=`git tag -l  'v[0-9]*\.[0-9]*.0' | tail -n 1`

... could you please also squash in another backslash in the "end=..."
line here?

Thanks,
 Thomas

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH v3] scripts: Add a script to check for bug URLs in the git log
  2016-09-22  7:02   ` Thomas Huth
@ 2016-09-22  8:53     ` Paolo Bonzini
  0 siblings, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2016-09-22  8:53 UTC (permalink / raw)
  To: Thomas Huth; +Cc: qemu-devel, Peter Maydell, stefanha



On 22/09/2016 09:02, Thomas Huth wrote:
> On Wed, 21 Sep 2016 22:08:10 +0200
> Paolo Bonzini <pbonzini@redhat.com> wrote:
> 
>> On 21/09/2016 21:42, Thomas Huth wrote:
>>> 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>
>>> ---
>>>  v3: Adressed Eric's review comments from v2 (fixed bashisms, more
>>>      POSIX compliance, use lower-case variable names, etc.)
>>
>> Queued with this squashed in:
> 
> Thanks a lot for the fixup. But...
> 
>> diff --git a/scripts/show-fixed-bugs.sh b/scripts/show-fixed-bugs.sh
>> index 9dcc0f7..6e64edd 100755
>> --- a/scripts/show-fixed-bugs.sh
>> +++ b/scripts/show-fixed-bugs.sh
>> @@ -23,7 +23,7 @@ while getopts "s:e:cbh" opt; do
>>  done
>>  
>>  if [ "x$start" = "x" ]; then
>> -    start=`git tag -l 'v[0-9]*\.[0-9]*.0' | tail -n 2 | head -n 1`
>> +    start=`git tag -l 'v[0-9]*\.[0-9]*\.0' | tail -n 2 | head -n 1`
>>  fi
>>  if [ "x$end" = "x" ]; then
>>      end=`git tag -l  'v[0-9]*\.[0-9]*.0' | tail -n 1`
> 
> ... could you please also squash in another backslash in the "end=..."
> line here?

Sure.

Paolo

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-09-22  8:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-21 19:42 [Qemu-devel] [PATCH v3] scripts: Add a script to check for bug URLs in the git log Thomas Huth
2016-09-21 20:00 ` Eric Blake
2016-09-22  7:00   ` Thomas Huth
2016-09-21 20:08 ` Paolo Bonzini
2016-09-22  7:02   ` Thomas Huth
2016-09-22  8:53     ` Paolo Bonzini

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.