3 # Compares Packages-Arch-Specific (from Quinn-Diff) against the archive
4 # Copyright (C) 2000, 2001 James Troup <james@nocrew.org>
5 # $Id: christina,v 1.2 2001-07-07 03:15:36 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 # 23:12|<aj> I will not hush!
25 # 23:12|<aj> Where there is injustice in the world, I shall be there!
26 # 23:13|<aj> I shall not be silenced!
27 # 23:13|<aj> The world shall know!
28 # 23:13|<aj> The world *must* know!
29 # 23:13|<elmo> oh dear, he's gone back to powerpuff girls... ;-)
30 # 23:13|<aj> yay powerpuff girls!!
31 # 23:13|<aj> buttercup's my favourite, who's yours?
32 # 23:14|<aj> you're backing away from the keyboard right now aren't you?
33 # 23:14|<aj> *AREN'T YOU*?!
34 # 23:15|<aj> I will not be treated like this.
35 # 23:15|<aj> I shall have my revenge.
36 # 23:15|<aj> I SHALL!!!
38 ################################################################################
40 import pg, sys, os, string
41 import utils, db_access
44 ################################################################################
49 ################################################################################
51 def rev_cmp_by_suite (a, b):
52 ai = Cnf["Suite::%s::Priority" % (a)];
53 bi = Cnf["Suite::%s::Priority" % (b)];
63 sys.stderr.write("Sorting... ");
66 suites.sort(rev_cmp_by_suite);
68 sys.stderr.write("done.\n");
76 if not d.has_key(package):
78 d[package].append(suite);
82 sys.stderr.write("Binaries query... ");
83 q = projectB.query("SELECT DISTINCT b.package, su.suite_name FROM binaries b, bin_associations ba, suite su WHERE b.id = ba.bin AND su.id = ba.suite");
84 sys.stderr.write("done.\n");
85 binaries = add_to_dict (q);
90 sys.stderr.write("Source query... ");
91 q = projectB.query("SELECT DISTINCT s.source, su.suite_name FROM source s, src_associations sa, suite su WHERE s.id = sa.source AND su.id = sa.suite");
92 sys.stderr.write("done.\n");
93 source = add_to_dict (q);
102 Cnf = apt_pkg.newConfiguration();
103 apt_pkg.ReadConfigFileISC(Cnf,utils.which_conf_file());
105 Arguments = [('d',"debug","Christina::Options::Debug", "IntVal"),
106 ('h',"help","Christina::Options::Help"),
107 ('v',"version","Christina::Options::Version")];
109 apt_pkg.ParseCommandLine(Cnf,Arguments,sys.argv);
110 projectB = pg.connect(Cnf["DB::Name"], Cnf["DB::Host"], int(Cnf["DB::Port"]));
111 db_access.init(Cnf, projectB);
113 # Get a list of binaries and source with their latest suite
114 binaries = get_binaries();
115 source = get_source();
120 filename = "/org/buildd.debian.org/web/quinn-diff/Packages-arch-specific";
121 file = utils.open_file(filename, 'r');
123 for line in file.readlines():
124 line = string.strip(utils.re_comments.sub("", line));
125 line_count = line_count + 1;
128 sline = string.split(line, ':');
130 utils.warn("parse error on line %s; skipping" % (line_count));
132 (package, architectures) = map(string.strip, sline);
134 if package[0] != '%':
135 if not binaries.has_key(package):
136 if source.has_key(package):
137 print "SHOULD BE SOURCE: %s ==> %s" % (package, architectures);
139 print "MISSING: %s ==> %s" % (package, architectures);
141 if binaries[package] == "unstable":
142 as_binaries[package] = architectures;
146 package = package[1:]
147 if not source.has_key(package):
148 if binaries.has_key(package):
149 print "SHOULD BE BINARY: %s ==> %s" % (package, architectures);
151 print "[source] MISSING: %s ==> %s" % (package, architectures);
153 if source[package] == "unstable":
154 as_source[package] = architectures;
156 suite_id = db_access.get_suite_id("unstable");
157 for package in as_binaries.keys():
158 as_architectures = string.split(as_binaries[package]);
159 arches_arch_specific = {};
160 for i in as_architectures:
161 arches_arch_specific[i] = "";
163 q = projectB.query("SELECT a.arch_string FROM bin_associations ba, binaries b, architecture a WHERE a.id = b.architecture AND b.package = '%s' AND ba.suite = %s AND ba.bin = b.id" % (package, suite_id));
166 print "%s: %s vs. %s" % (package, ql, as_architectures);
168 arches_in_archive = {};
170 arches_in_archive[i[0]] = "";
172 for arch in as_architectures:
175 if arches_in_archive.has_key(arch):
176 utils.warn("%s is excluded from %s but is in the archive for %s.[1]" % (package, arch, arch));
178 if not arches_in_archive.has_key(arch):
179 utils.warn("%s is listed as buildable on %s but isn't in the archive for %s." % (package, arch, arch));
181 for arch in arches_in_archive.keys():
182 if not arches_arch_specific.has_key(arch):
183 utils.warn("%s is excluded from %s but is in the archive for %s.[2]" % (package, arch, arch));
185 # HO HUM; maybe have control words in the comments like "<STABLE>" ? bit icky
186 # see if package exists at all
187 # see if package exists for excluded arch
188 # see if package in specific suite
189 # compare against source package's .dsc!
192 #######################################################################################
194 if __name__ == '__main__':