| 1 |
tbm |
5 |
# Copyright (C) 2001 Martin Michlmayr <tbm@cyrius.com>
|
| 2 |
tbm |
21 |
# $Id$
|
| 3 |
tbm |
5 |
|
| 4 |
|
|
# This program is free software; you can redistribute it and/or modify
|
| 5 |
|
|
# it under the terms of the GNU General Public License as published by
|
| 6 |
|
|
# the Free Software Foundation; either version 2 of the License, or
|
| 7 |
|
|
# (at your option) any later version.
|
| 8 |
|
|
|
| 9 |
|
|
# This program is distributed in the hope that it will be useful,
|
| 10 |
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 11 |
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 12 |
|
|
# GNU General Public License for more details.
|
| 13 |
|
|
|
| 14 |
|
|
# You should have received a copy of the GNU General Public License
|
| 15 |
|
|
# along with this program; if not, write to the Free Software
|
| 16 |
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
| 17 |
|
|
|
| 18 |
|
|
|
| 19 |
|
|
# This is a collection of software to track down developers who are
|
| 20 |
|
|
# Missing In Action (MIA).
|
| 21 |
|
|
|
| 22 |
|
|
# To Veronika, who is missing in action -- action's not the same without her.
|
| 23 |
|
|
# -- tbm
|
| 24 |
|
|
|
| 25 |
|
|
|
| 26 |
tbm |
134 |
import os, stat, sys, re, time, string
|
| 27 |
tbm |
5 |
|
| 28 |
|
|
days = 21
|
| 29 |
|
|
origin = '/org/qa.debian.org/mia/db'
|
| 30 |
|
|
|
| 31 |
|
|
info = { }
|
| 32 |
|
|
|
| 33 |
|
|
def find_status(path=origin):
|
| 34 |
|
|
files = []
|
| 35 |
|
|
|
| 36 |
|
|
for file in os.listdir(path):
|
| 37 |
tbm |
11 |
root, ext = os.path.splitext(file)
|
| 38 |
tbm |
5 |
if ext == '.summary':
|
| 39 |
|
|
files.append(root)
|
| 40 |
|
|
|
| 41 |
|
|
return files
|
| 42 |
|
|
|
| 43 |
|
|
def read_status(files):
|
| 44 |
|
|
for file in files:
|
| 45 |
|
|
try:
|
| 46 |
|
|
summary = open(origin + '/' + file + '.summary', 'r')
|
| 47 |
|
|
except IOError:
|
| 48 |
|
|
print 'Cannot open summary file %s' % file
|
| 49 |
|
|
sys.exit(1)
|
| 50 |
|
|
|
| 51 |
|
|
info[file] = { }
|
| 52 |
|
|
|
| 53 |
|
|
for line in summary.readlines():
|
| 54 |
|
|
result = re.search("(\d+):\s*(.*)", line)
|
| 55 |
|
|
|
| 56 |
|
|
if result is not None:
|
| 57 |
|
|
info[file][result.group(1)] = result.group(2)
|
| 58 |
|
|
else:
|
| 59 |
|
|
print 'Error parsing file %s: %s' % (file, line)
|
| 60 |
|
|
sys.exit(1)
|
| 61 |
|
|
|
| 62 |
|
|
summary.close()
|
| 63 |
|
|
|
| 64 |
|
|
|
| 65 |
|
|
def write_status(file, id, summary):
|
| 66 |
|
|
try:
|
| 67 |
|
|
status = open(origin + '/' + file + '.summary', 'a')
|
| 68 |
|
|
except IOError:
|
| 69 |
|
|
print 'Cannot open summary file to write!'
|
| 70 |
|
|
sys.exit(1)
|
| 71 |
|
|
|
| 72 |
tbm |
12 |
string = str(id) + ': ' + summary + '\n'
|
| 73 |
tbm |
5 |
status.write(string)
|
| 74 |
|
|
status.close()
|
| 75 |
|
|
|
| 76 |
|
|
def print_history(file):
|
| 77 |
|
|
all_contacts = info[file].keys()
|
| 78 |
|
|
all_contacts.sort()
|
| 79 |
|
|
for when in all_contacts:
|
| 80 |
|
|
date = time.gmtime(int(when))
|
| 81 |
|
|
print ' %s: %.60s' % (time.strftime('%Y-%m-%d', date), info[file][when])
|
| 82 |
|
|
|
| 83 |
tbm |
134 |
|
| 84 |
|
|
def latest(file):
|
| 85 |
|
|
return max(map(int, info[file].keys()))
|
| 86 |
|
|
|
| 87 |
|
|
def has_stuff_todo(file):
|
| 88 |
|
|
|
| 89 |
|
|
matches = { }
|
| 90 |
|
|
matches['ignore'] = [ 'willfix' ]
|
| 91 |
tbm |
143 |
matches['in'] = [ 'S-V', 'FHS', 'RC', 'NMU', 'Hint' ]
|
| 92 |
|
|
matches['out'] = [ 'Fixed', 'Orphaned', 'Orphaning', 'Removed',
|
| 93 |
|
|
'Removing' ]
|
| 94 |
tbm |
147 |
matches['latest'] = [ 'Maintainer has no packages anymore', 'Retired',
|
| 95 |
|
|
'Retiring' ]
|
| 96 |
tbm |
134 |
|
| 97 |
|
|
found = { }
|
| 98 |
|
|
for key in matches.keys():
|
| 99 |
|
|
matches[key] = map(string.lower, matches[key])
|
| 100 |
tbm |
148 |
found[key] = { }
|
| 101 |
tbm |
134 |
|
| 102 |
|
|
last = str(latest(file))
|
| 103 |
|
|
if string.lower(info[file][last]) in matches['latest']:
|
| 104 |
|
|
return
|
| 105 |
|
|
|
| 106 |
|
|
for entry in info[file].values():
|
| 107 |
|
|
fields = re.split(':\s+', entry, 2)
|
| 108 |
|
|
if len(fields) > 1:
|
| 109 |
tbm |
136 |
what = re.split('\s+|&', fields[0])[0]
|
| 110 |
tbm |
134 |
packages = re.split(',\s*', fields[1])
|
| 111 |
|
|
for key in matches.keys():
|
| 112 |
|
|
if string.lower(what) in matches[key]:
|
| 113 |
tbm |
148 |
for package in packages:
|
| 114 |
|
|
found[key][package] = 1
|
| 115 |
tbm |
144 |
break
|
| 116 |
tbm |
134 |
else:
|
| 117 |
|
|
print 'Error: do not know what to do with "%s"' % what
|
| 118 |
|
|
sys.exit(1)
|
| 119 |
|
|
|
| 120 |
tbm |
135 |
# temporary hack to show cases without any INs.
|
| 121 |
|
|
if not len(found['in']):
|
| 122 |
|
|
return [ 'no-todo-list' ]
|
| 123 |
|
|
|
| 124 |
tbm |
148 |
for item in found['out'].keys():
|
| 125 |
tbm |
134 |
try:
|
| 126 |
tbm |
148 |
del found['in'][item]
|
| 127 |
|
|
except KeyError:
|
| 128 |
tbm |
134 |
print 'Warning: "%s" was not on the TODO list' % item
|
| 129 |
|
|
|
| 130 |
|
|
if len(found['in']):
|
| 131 |
|
|
# something has not been dealt with yet
|
| 132 |
tbm |
149 |
outstanding = found['in'].keys()
|
| 133 |
|
|
outstanding.sort()
|
| 134 |
|
|
return outstanding
|
| 135 |
tbm |
134 |
|