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.4 2001-11-18 19:57:58 rmurray 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);
100 Cnf = utils.get_conf()
102 Arguments = [('d',"debug","Christina::Options::Debug", "IntVal"),
103 ('h',"help","Christina::Options::Help"),
104 ('v',"version","Christina::Options::Version")];
106 apt_pkg.ParseCommandLine(Cnf,Arguments,sys.argv);
107 projectB = pg.connect(Cnf["DB::Name"], Cnf["DB::Host"], int(Cnf["DB::Port"]));
108 db_access.init(Cnf, projectB);
110 # Get a list of binaries and source with their latest suite
111 binaries = get_binaries();
112 source = get_source();
117 filename = "/org/buildd.debian.org/web/quinn-diff/Packages-arch-specific";
118 file = utils.open_file(filename);
120 for line in file.readlines():
121 line = string.strip(utils.re_comments.sub("", line));
122 line_count = line_count + 1;
125 sline = string.split(line, ':');
127 utils.warn("parse error on line %s; skipping" % (line_count));
129 (package, architectures) = map(string.strip, sline);
131 if package[0] != '%':
132 if not binaries.has_key(package):
133 if source.has_key(package):
134 print "SHOULD BE SOURCE: %s ==> %s" % (package, architectures);
136 print "MISSING: %s ==> %s" % (package, architectures);
138 if binaries[package] == "unstable":
139 as_binaries[package] = architectures;
143 package = package[1:]
144 if not source.has_key(package):
145 if binaries.has_key(package):
146 print "SHOULD BE BINARY: %s ==> %s" % (package, architectures);
148 print "[source] MISSING: %s ==> %s" % (package, architectures);
150 if source[package] == "unstable":
151 as_source[package] = architectures;
153 suite_id = db_access.get_suite_id("unstable");
154 for package in as_binaries.keys():
155 as_architectures = string.split(as_binaries[package]);
156 arches_arch_specific = {};
157 for i in as_architectures:
158 arches_arch_specific[i] = "";
160 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));
163 print "%s: %s vs. %s" % (package, ql, as_architectures);
165 arches_in_archive = {};
167 arches_in_archive[i[0]] = "";
169 for arch in as_architectures:
172 if arches_in_archive.has_key(arch):
173 utils.warn("%s is excluded from %s but is in the archive for %s.[1]" % (package, arch, arch));
175 if not arches_in_archive.has_key(arch):
176 utils.warn("%s is listed as buildable on %s but isn't in the archive for %s." % (package, arch, arch));
178 for arch in arches_in_archive.keys():
179 if not arches_arch_specific.has_key(arch):
180 utils.warn("%s is excluded from %s but is in the archive for %s.[2]" % (package, arch, arch));
182 # HO HUM; maybe have control words in the comments like "<STABLE>" ? bit icky
183 # see if package exists at all
184 # see if package exists for excluded arch
185 # see if package in specific suite
186 # compare against source package's .dsc!
189 #######################################################################################
191 if __name__ == '__main__':