[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2] scripts: Add a script to check for bug URLs
From: |
Thomas Huth |
Subject: |
Re: [Qemu-devel] [PATCH v2] scripts: Add a script to check for bug URLs in the git log |
Date: |
Wed, 14 Sep 2016 12:35:02 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 |
Erik,
thanks a lot for your detailed review and comments ... I somewhat
suspected that my shell-script-fu is crap, but now I also have the
confirmation ;-)
Anyway, some comments below...
On 13.09.2016 18:06, Daniel P. Berrange wrote:
> On Tue, Sep 13, 2016 at 10:48:46AM -0500, Eric Blake wrote:
>> On 09/13/2016 08:20 AM, 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 <address@hidden>
>>> ---
>>> 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 ;;
>>
>> POSIX recommends that short options with arguments be parseable both as
>> '-s foo' and '-sfoo'. I don't care that you aren't POSIX compliant, but
>> using getopt(1) or getopts(1) may make it easier to comply.
OK. After googling a little bit, it sounds like getopts is the way to
go, e.g. http://mywiki.wooledge.org/BashFAQ/035#getopts says that getopt
should not be used.
[...]
>>> +if [ "x$BROWSER" != "x" ]; then
>>> + BUGBROWSER = "$BROWSER"
>>> +elif which xdg-open > /dev/null; then
>>
>> 'which' is not portable; it may not exist. It looks like you are trying
>> to redirect to /dev/null to avoid shell messages when it does not exist,
>> but to properly do that, you'd need:
I rather wanted to simply suppress the output of which.
Is there a POSIX compliant way to check whether a program is available
in $PATH ?
> Your various comments above are a great example of why IMHO any script that
> is longer than 1 line shouldn't be written in shell. Instead pick python
> or any other scripting language which isn't rammed full of portability
> problems and shockingly awful error handling facilities as shell is.
I fully agree with you that writing portable shell-scripts is a pain,
but unfortunately my python-fu is even worse than my shell-script-fu ...
well, maybe it's now time to improve it ;-)
Thomas