+ sorted_list = [];
+ cache = {};
+ # Read in all the .changes files
+ for filename in changes_files:
+ try:
+ Katie.pkg.changes_file = filename;
+ Katie.init_vars();
+ Katie.update_vars();
+ cache[filename] = copy.copy(Katie.pkg.changes);
+ cache[filename]["filename"] = filename;
+ except:
+ sorted_list.append(filename);
+ break;
+ # Divide the .changes into per-source groups
+ per_source = {};
+ for filename in cache.keys():
+ source = cache[filename]["source"];
+ if not per_source.has_key(source):
+ per_source[source] = {};
+ per_source[source]["list"] = [];
+ per_source[source]["list"].append(cache[filename]);
+ # Determine oldest time and have note status for each source group
+ for source in per_source.keys():
+ source_list = per_source[source]["list"];
+ first = source_list[0];
+ oldest = os.stat(first["filename"])[stat.ST_MTIME];
+ have_note = 0;
+ for d in per_source[source]["list"]:
+ mtime = os.stat(d["filename"])[stat.ST_MTIME];
+ if mtime < oldest:
+ oldest = mtime;
+ have_note += (d.has_key("lisa note"));
+ per_source[source]["oldest"] = oldest;
+ if not have_note:
+ per_source[source]["note_state"] = 0; # none
+ elif have_note < len(source_list):
+ per_source[source]["note_state"] = 1; # some
+ else:
+ per_source[source]["note_state"] = 2; # all
+ per_source[source]["list"].sort(indiv_sg_compare);
+ per_source_items = per_source.items();
+ per_source_items.sort(sg_compare);
+ for i in per_source_items:
+ for j in i[1]["list"]:
+ sorted_list.append(j["filename"]);
+ return sorted_list;