3 # Produces a report on NEW and BYHAND packages
4 # Copyright (C) 2001, 2002 James Troup <james@nocrew.org>
5 # $Id: helena,v 1.1 2002-06-05 00:17:22 troup Exp $
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 ################################################################################
23 # <o-o> XP runs GCC, XFREE86, SSH etc etc,.,, I feel almost like linux....
24 # <o-o> I am very confident that I can replicate any Linux application on XP
25 # <willy> o-o: *boggle*
26 # <o-o> building from source.
27 # <o-o> Viiru: I already run GIMP under XP
28 # <willy> o-o: why do you capitalise the names of all pieces of software?
29 # <o-o> willy: because I want the EMPHASIZE them....
31 # <willy> o-o: it makes you look like ZIPPY the PINHEAD
32 # <o-o> willy: no idea what you are talking about.
33 # <willy> o-o: do some research
34 # <o-o> willy: for what reason?
36 ################################################################################
38 import copy, glob, os, stat, string, sys, time;
45 ################################################################################
53 ################################################################################
77 return "%s %s%s" % (x, unit, plural(x));
79 ################################################################################
81 def sg_compare (a, b):
84 """Sort by have note, time of oldest upload."""
86 a_note_state = a["note_state"];
87 b_note_state = b["note_state"];
88 if a_note_state < b_note_state:
90 elif a_note_state > b_note_state:
93 # Sort by time of oldest upload
94 return cmp(a["oldest"], b["oldest"]);
96 ############################################################
98 def process_changes_files(changes_files, type):
101 # Read in all the .changes files
102 for filename in changes_files:
104 Katie.pkg.changes_file = filename;
107 cache[filename] = copy.copy(Katie.pkg.changes);
108 cache[filename]["filename"] = filename;
111 # Divide the .changes into per-source groups
113 for filename in cache.keys():
114 source = cache[filename]["source"];
115 if not per_source.has_key(source):
116 per_source[source] = {};
117 per_source[source]["list"] = [];
118 per_source[source]["list"].append(cache[filename]);
119 # Determine oldest time and have note status for each source group
120 for source in per_source.keys():
121 source_list = per_source[source]["list"];
122 first = source_list[0];
123 oldest = os.stat(first["filename"])[stat.ST_CTIME];
125 for d in per_source[source]["list"]:
126 ctime = os.stat(d["filename"])[stat.ST_CTIME];
129 have_note = have_note + (d.has_key("lisa note"));
130 per_source[source]["oldest"] = oldest;
132 per_source[source]["note_state"] = 0; # none
133 elif have_note < len(source_list):
134 per_source[source]["note_state"] = 1; # some
136 per_source[source]["note_state"] = 2; # all
137 per_source_items = per_source.items();
138 per_source_items.sort(sg_compare);
140 for i in per_source_items:
141 last_modified = time.time()-i[1]["oldest"];
142 source = i[1]["list"][0]["source"];
145 for j in i[1]["list"]:
146 for arch in j["architecture"].keys():
148 versions[j["version"]] = "";
149 arch_list = string.join(arches.keys(), ", ");
150 version_list = string.join(versions.keys(), ", ");
151 if i[1]["note_state"]:
155 msg = msg + "%10s | %10s | %10s%s | %s old\n" % (source, version_list, arch_list, note, time_pp(last_modified));
158 total_count = len(changes_files);
159 source_count = len(per_source_items);
160 print string.upper(type)
164 print "%s %s source package%s / %s %s package%s in total." % (source_count, type, plural(source_count), total_count, type, plural(total_count));
167 ################################################################################
172 Cnf = utils.get_conf();
173 apt_pkg.ParseCommandLine(Cnf,[],sys.argv);
174 Katie = katie.Katie(Cnf);
176 changes_files = glob.glob("%s/*.changes" % (Cnf["Dir::Queue::Byhand"]));
177 process_changes_files(changes_files, "byhand");
178 changes_files = glob.glob("%s/*.changes" % (Cnf["Dir::Queue::New"]));
179 process_changes_files(changes_files, "new");
181 ################################################################################
183 if __name__ == '__main__':