File: update-bugs.sh

package info (click to toggle)
libguestfs 1:1.40.2-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 123,660 kB
  • sloc: ansic: 460,074; ml: 63,059; sh: 14,955; java: 9,512; makefile: 9,133; cs: 6,300; haskell: 5,652; python: 3,856; perl: 3,619; erlang: 2,435; xml: 1,683; ruby: 350; pascal: 255; lex: 135; yacc: 128; cpp: 10
file content (137 lines) | stat: -rwxr-xr-x 4,463 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#!/bin/bash -
# update-bugs.sh
# Copyright (C) 2009-2019 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

# In 'make dist' this is used to update the top level 'BUGS' file with
# the current bug list from Red Hat Bugzilla (bugzilla.redhat.com).

# First of all fetch the bugs from the database.  This might fail,
# eg. if there is no net access or no 'bugzilla' program, but if that
# happens just exit and leave the BUGS file alone.

bugzilla --nosslverify query -c libguestfs \
  --outputformat='%{bug_id} %{bug_status} %{short_desc}' > .bugs.tmp || exit 0

perl -e '
    sub bugclass {
      local $_ = shift;
      return 1 if /NEW/;
      return 2 if /ASSIGNED/;
      return 3 if /ON_DEV/;
      return 4 if /POST/;
      return 5 if /MODIFIED/;
      return 6 if /ON_QA/;
      return 7 if /VERIFIED/;
      return 8 if /RELEASE_PENDING/;
      return 9 #if /CLOSED/;
    }
    sub compare {
      $a->[0] <=> $b->[0] || $a->[1] <=> $b->[1]
    }
    while (<>) {
      /^(\d+) (\w+) (.*)/; push @bugs, [bugclass($2), $1, $2, $3];
    }
    # No bugs?  Fail.
    if (0+@bugs == 0) {
        die "failed to get list of bugs\n"
    }
    foreach (sort compare @bugs) {
      print $_->[1], " ", $_->[2], " ", $_->[3], "\n";
    }
' < .bugs.tmp > .bugs.tmp2 || exit 0

# Any errors from now on are fatal.
set -e

# Print prologue.
echo 'NOTE: This file is automatically generated from "update-bugs.sh".'
echo -n 'Last updated: ' ; date +'%Y-%m-%d'
echo '
This contains a local list of the bugs that are open against
libguestfs.  Bugs are tracked in the Red Hat Bugzilla database
at https://bugzilla.redhat.com/ and to report a new bug you
should follow this link:

https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools

When reporting a new bug, please check:

 - That the bug has not been reported already.
 - That you are testing a recent version.
 - Describe the bug accurately, and give a way to reproduce it.
 - Include the version of libguestfs, distro version and any other
   relevant information.
 - Attach the complete output of "libguestfs-test-tool".
'

lastclass=X
count=0
while read bugno status summary; do
    # Ignore RELEASE_PENDING or CLOSED bugs in this list.
    if [ "$status" = "RELEASE_PENDING" -o "$status" = "CLOSED" ]; then
        continue
    fi

    # Treat ASSIGNED the same as NEW.
    # Treat MODIFIED, POST and ON_QA as the same.
    case "$status" in
        ASSIGNED) bugclass=NEW ;;
        POST|ON_QA) bugclass=MODIFIED ;;
        *) bugclass=$status ;;
    esac

    # perl sort returns the bugs sorted by status, NEW, ASSIGNED,
    # MODIFIED, ..., CLOSED.  Therefore start a new section when the
    # status field changes.
    if [ "$bugclass" != "$lastclass" ]; then
        if [ $count -ge 1 ]; then
            echo "($count bugs)"
            echo
        fi
        count=0
        echo '--------------------------------------------------'
        case "$bugclass" in
            NEW)
                echo 'Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.' ;;
            NEEDINFO)
                echo 'Bugs in NEEDINFO state require additional information.' ;;
            MODIFIED)
                echo 'Bugs in MODIFIED, POST or ON_QA state are fixed.'
                echo 'You can help by testing the fixes.'
                ;;
            *)
                echo "These bugs are in the $status state." ;;
        esac
        echo
    fi
    ((count++)) ||:
    lastclass=$bugclass

    # Display the bug.
    echo "$bugno $status https://bugzilla.redhat.com/show_bug.cgi?id=$bugno"
    echo "  $summary"
    echo
done < .bugs.tmp2

if [ $count -ge 1 ]; then
    echo "($count bugs)"
    echo
fi
echo "End of BUGS file."

# Clean up temporary files.
rm .bugs.tmp .bugs.tmp2