3
# The purpose of this script it to find and mark duplicates of bug 464552
6
from arsenal_lib import *
9
sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)
11
#end = int(sys.argv[1])
14
distro = arsenal.load_project("ubuntu")
17
linux = distro.getSourcePackage(name="linux")
18
#linux = distro.getSourcePackage(name="alsa-driver")
19
#linux = distro.getSourcePackage(name="pulseaudio")
20
collection = linux.searchTasks(order_by="-id")[:500]
21
#collection = linux.searchTasks(order_by="-id", status="New")
26
unknown = 'kernel-series-unknown'
34
alltags = mapping.values()
35
#alltags.append(unknown)
45
re_distro = re.compile("\nDistroRelease: Ubuntu (.*)\n");
46
re_uname = re.compile("\nUname: Linux (\S+)-\d+-\S+ \S+\n");
47
re_binary = re.compile("\nBinary package hint: linux\S+-(\d+\.\d+\.\d+)");
48
for bug_task in collection:
49
# if bug_task.bug.id != 486643:
52
#print count, "/", ttl_count
54
bug = ArsenalBug(bug_task.bug, arsenal.launchpad)
56
# print "{0} checking {1}".format(bug.id, end)
61
# If we have a valid version tag then trust it, do not change it.
67
if bug.has_tag("kernel-" + tag):
71
print "{0} already tagged {1}".format(bug.id, tagged)
72
if tagged != unknown and bug.has_tag(unknown):
73
print "{0} removing {1}".format(bug.id, unknown)
74
bug.remove_tag(unknown)
75
if tagged == 'lucid' and bug.has_tag("kernel-lucid"):
76
bug.append_tag("lucid")
77
bug.remove_tag("kernel-lucid")
80
desc = bug.description.decode("utf-8")
81
desc = "\n" + desc + "\n"
83
# Scan DistroRelease: for distro version
85
m = re_distro.search(desc)
88
print "{0} distro {1}".format(bug.id, distro)
90
# Scan Uname: for kernel version
92
m = re_uname.search(desc)
95
print "{0} has uname {1}".format(bug.id, kernel)
97
# Scan Binary package hint: for kernel version
98
if not distro and not kernel:
99
m = re_binary.search(desc)
102
print "{0} has binary hint {1}".format(bug.id, kernel)
104
# Convert version to a distro if we have no distro
105
if not distro and kernel:
106
if kernel in kernel_mapping:
107
distro = kernel_mapping[kernel]
108
print "{0} distro {1} from version {2}".format(bug.id,
111
# Check for apport data
112
if not distro and bug.has_tag('apport-collected'):
114
for m in bug.bug.messages:
115
if m.subject == 'apport-collect data':
119
m = re_distro.search(data)
122
print "{0} distro {1} from apport data".format(bug.id, distro)
125
if distro in mapping:
126
tag = mapping[distro]
128
if tag and not bug.has_tag(tag):
129
print "{0} needs {1}".format(bug.id, tag)
131
if tag != unknown and bug.has_tag(unknown):
132
print "{0} removing {1}".format(bug.id, unknown)
133
bug.remove_tag(unknown)
135
print "{0} already tagged {1}".format(bug.id, tag)
138
# if not distro or not kernel:
139
# print "{0} ? - -".format(bug.id)
143
# if distro == '10.04':
144
# if kernel == '2.6.32':
146
# if distro == '9.10':
147
# if kernel == '2.6.31':
149
# elif distro == '9.04':
150
# if kernel == '2.6.28':
152
# elif distro == '8.10':
153
# if kernel == '2.6.27':
161
# print "{0} {1} {2} {3}".format(bug.id, match, distro, kernel)
163
print "{0} / {1}".format(count, ttl_count)