#!/usr/bin/env python
# Generate Maintainers file used by e.g. the Debian Bug Tracking System
-# Copyright (C) 2000, 2001 James Troup <james@nocrew.org>
-# $Id: charisma,v 1.11 2001-09-27 01:23:41 troup Exp $
+# Copyright (C) 2000, 2001, 2002, 2003, 2004 James Troup <james@nocrew.org>
+# $Id: charisma,v 1.17 2004-03-11 00:20:51 troup Exp $
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
################################################################################
-import os, pg, re, string, sys
-import db_access, utils
-import apt_pkg
+import pg, sys;
+import db_access, utils;
+import apt_pkg;
################################################################################
def main():
global Cnf, projectB;
- apt_pkg.init();
-
- Cnf = apt_pkg.newConfiguration();
- apt_pkg.ReadConfigFileISC(Cnf,utils.which_conf_file());
+ Cnf = utils.get_conf()
Arguments = [('h',"help","Charisma::Options::Help")];
- Cnf["Charisma::Options::Help"] = "";
+ if not Cnf.has_key("Charisma::Options::Help"):
+ Cnf["Charisma::Options::Help"] = "";
+
extra_files = apt_pkg.ParseCommandLine(Cnf,Arguments,sys.argv);
Options = Cnf.SubTree("Charisma::Options");
db_access.init(Cnf, projectB);
for suite in Cnf.SubTree("Suite").List():
- suite = string.lower(suite);
+ suite = suite.lower();
suite_priority = int(Cnf["Suite::%s::Priority" % (suite)]);
# Source packages
source_id = binary[1];
version = binary[3];
# Use the source maintainer first; falling back on the binary maintainer as a last resort only
- if source_id != 0 and source_id != None:
+ if source_id:
maintainer = get_maintainer_from_source(source_id);
else:
maintainer = get_maintainer(binary[2]);
for filename in extra_files:
file = utils.open_file(filename);
for line in file.readlines():
- line = string.strip(utils.re_comments.sub('', line[:-1]))
+ line = utils.re_comments.sub('', line).strip();
if line == "":
continue;
- split = string.split(line);
+ split = line.split();
lhs = split[0];
- maintainer = fix_maintainer(string.join(split[1:]));
- if string.find(lhs,'~') != -1:
- lhs_split = string.split(lhs, '~');
- package = lhs_split[0];
- version = lhs_split[1];
+ maintainer = fix_maintainer(" ".join(split[1:]));
+ if lhs.find('~') != -1:
+ (package, version) = lhs.split('~');
else:
package = lhs;
version = '*';
package_keys = packages.keys()
package_keys.sort()
for package in package_keys:
- lhs = string.join([package, packages[package]["version"]], '~');
+ lhs = "~".join([package, packages[package]["version"]]);
print "%-30s %s" % (lhs, packages[package]["maintainer"]);
################################################################################