generator: Properly lay out and indent multi-line C function decls.
[libguestfs.git] / update-bugs
1 #!/bin/bash -
2 # update-bugs
3 # Copyright (C) 2009-2010 Red Hat Inc.
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
19 # In 'make dist' this is used to update the top level 'BUGS' file with
20 # the current bug list from Red Hat Bugzilla (bugzilla.redhat.com).
21
22 # First of all fetch the bugs from the database.  This might fail,
23 # eg. if there is no net access or no 'bugzilla' program, but if that
24 # happens just exit and leave the BUGS file alone.
25
26 bugzilla query -c libguestfs --outputformat='%{bug_id} %{bug_status} %{short_desc}' > .bugs.tmp || exit 0
27
28 # Any errors from now on are fatal.
29 set -e
30
31 # Print prologue.
32 echo 'NOTE: This file is automatically generated from "update-bugs".'
33 echo -n 'Last updated: ' ; date +'%Y-%m-%d %H:%M:%S'
34 echo '
35 This contains a local list of the bugs that are open against
36 libguestfs.  Bugs are tracked in the Red Hat Bugzilla database
37 at https://bugzilla.redhat.com/ and to report a new bug you
38 should follow this link:
39
40 https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools
41
42 When reporting a new bug, please check:
43
44  - That the bug has not been reported already.
45  - That you are testing a recent version.
46  - Describe the bug accurately, and give a way to reproduce it.
47  - Include the version of libguestfs, distro version and any other
48    relevant information.
49  - Attach the complete output of "libguestfs-test-tool".
50 '
51
52 lastclass=X
53 while read bugno status summary; do
54     # Ignore CLOSED bugs in this list.
55     if [ "$status" = "CLOSED" ]; then continue; fi
56
57     # Treat ASSIGNED the same as NEW.
58     # Treat MODIFIED, POST and ON_QA as the same.
59     case "$status" in
60         ASSIGNED) bugclass=NEW ;;
61         POST|ON_QA) bugclass=MODIFIED ;;
62         *) bugclass=$status ;;
63     esac
64
65     # 'bugzilla' command returns the bugs sorted by status, NEW, ASSIGNED,
66     # MODIFIED, ..., CLOSED.  Therefore start a new section when the
67     # status field changes.
68     if [ "$bugclass" != "$lastclass" ]; then
69         echo '--------------------------------------------------'
70         case "$bugclass" in
71             NEW)
72                 echo 'Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.' ;;
73             NEEDINFO)
74                 echo 'Bugs in NEEDINFO state require additional information.' ;;
75             MODIFIED)
76                 echo 'Bugs in MODIFIED, POST or ON_QA state are fixed.'
77                 echo 'You can help by testing the fixes.'
78                 ;;
79             *)
80                 echo "These bugs are in the $status state." ;;
81         esac
82         echo
83     fi
84     lastclass=$bugclass
85
86     # Display the bug.
87     echo "$bugno $status https://bugzilla.redhat.com/show_bug.cgi?id=$bugno"
88     echo "  $summary"
89     echo
90 done < .bugs.tmp
91
92 echo "End of BUGS file."
93
94 # Clean up temporary file.
95 rm .bugs.tmp