/[qa]/trunk/mia/status.py
ViewVC logotype

Contents of /trunk/mia/status.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 136 - (hide annotations) (download) (as text)
Fri Apr 13 02:21:20 2001 UTC (12 years, 2 months ago) by tbm
File MIME type: text/x-python
File size: 3833 byte(s)
Change match so that S-V is matched better (i.e. match only the first word)
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     matches['in'] = [ 'S-V', 'FHS', 'RC' ]
92     matches['out'] = [ 'Fixed', 'Orphaned', 'Orphaning' ]
93     matches['latest'] = [ 'Active', 'Maintainer has no packages anymore',
94     'Retired' ]
95    
96     found = { }
97     for key in matches.keys():
98     matches[key] = map(string.lower, matches[key])
99     found[key] = [ ]
100    
101     last = str(latest(file))
102     if string.lower(info[file][last]) in matches['latest']:
103     return
104    
105     for entry in info[file].values():
106     fields = re.split(':\s+', entry, 2)
107     if len(fields) > 1:
108 tbm 136 what = re.split('\s+|&', fields[0])[0]
109 tbm 134 packages = re.split(',\s*', fields[1])
110     for key in matches.keys():
111     if string.lower(what) in matches[key]:
112     found[key] = found[key] + packages
113     else:
114     print 'Error: do not know what to do with "%s"' % what
115     sys.exit(1)
116    
117 tbm 135 # temporary hack to show cases without any INs.
118     if not len(found['in']):
119     return [ 'no-todo-list' ]
120    
121 tbm 134 for item in found['out']:
122     try:
123     found['in'].remove(item)
124     except ValueError:
125     print 'Warning: "%s" was not on the TODO list' % item
126    
127     if len(found['in']):
128     # something has not been dealt with yet
129     return found['in']
130    

Properties

Name Value
svn:eol-style native
svn:executable *
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.5