# Handles NEW and BYHAND packages
# Copyright (C) 2001 James Troup <james@nocrew.org>
-# $Id: lisa,v 1.3 2002-02-22 01:03:07 troup Exp $
+# $Id: lisa,v 1.5 2002-03-26 22:05:47 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 errno, os, readline, string, stat, sys, tempfile;
+import copy, errno, os, readline, string, stat, sys, tempfile;
import apt_pkg, apt_inst;
import db_access, fernanda, katie, logging, utils;
# Globals
-lisa_version = "$Revision: 1.3 $";
+lisa_version = "$Revision: 1.5 $";
Cnf = None;
Options = None;
pkg = f["package"];
priority = f["priority"];
section = f["section"];
+ # FIXME: unhardcode
+ if section == "non-US/main":
+ section = "non-US";
type = get_type(f);
component = f["component"];
if f.has_key("othercomponents"):
new[pkg]["othercomponents"] = f["othercomponents"];
- for suite in changes["distribution"].keys():
+ for suite in changes["suite"].keys():
suite_id = db_access.get_suite_id(suite);
for pkg in new.keys():
component_id = db_access.get_component_id(new[pkg]["component"]);
del files[file]["new"];
del new[pkg];
+ if changes["suite"].has_key("stable"):
+ print "WARNING: overrides will be added for stable!";
+ for pkg in new.keys():
+ if new[pkg].has_key("othercomponents"):
+ print "WARNING: %s already present in %s distribution." % (pkg, new[pkg]["othercomponents"]);
+
return new;
################################################################################
else:
line = "%-20s %-20s %-20s" % (pkg, priority, section);
line = string.strip(line)+'\n';
- if new[pkg].has_key("othercomponents"):
- line = line + "WARNING: Already present in %s distribution.\n" % (new[pkg]["othercomponents"]);
file.write(line);
return ret_code;
edit_priority = edit_section = 0;
while string.find(prompt, answer) == -1:
- answer = raw_input(prompt);
+ answer = utils.our_raw_input(prompt);
m = katie.re_default_answer.match(prompt)
if answer == "":
answer = m.group(1)
readline.set_completer(Priorities.complete);
got_priority = 0;
while not got_priority:
- new_priority = string.strip(raw_input("New priority: "));
+ new_priority = string.strip(utils.our_raw_input("New priority: "));
if Priorities.priorities.count(new_priority) == 0:
print "E: '%s' is not a valid priority, try again." % (new_priority);
else:
readline.set_completer(Sections.complete);
got_section = 0;
while not got_section:
- new_section = string.strip(raw_input("New section: "));
+ new_section = string.strip(utils.our_raw_input("New section: "));
if Sections.sections.count(new_section) == 0:
print "E: '%s' is not a valid section, try again." % (new_section);
else:
got_answer = 0
while not got_answer:
- answer = raw_input(prompt)
- answer = string.upper(answer[:1])
+ answer = utils.our_raw_input(prompt);
+ answer = string.upper(answer[:1]);
if answer == "E" or answer == "D":
got_answer = 1;
elif katie.re_isanum.match (answer):
files = Katie.pkg.files;
projectB.query("BEGIN WORK");
- for suite in changes["distribution"].keys():
+ for suite in changes["suite"].keys():
suite_id = db_access.get_suite_id(suite);
for pkg in new.keys():
component_id = db_access.get_component_id(new[pkg]["component"]);
files = Katie.pkg.files;
changes = Katie.pkg.changes;
+ # Make a copy of distribution we can happily trample on
+ changes["suite"] = copy.copy(changes["distribution"]);
+
# Fix up the list of target suites
- for suite in changes["distribution"].keys():
+ for suite in changes["suite"].keys():
override = Cnf.Find("Suite::%s::OverrideSuite" % (suite));
if override:
- del changes["distribution"][suite];
- changes["distribution"][override] = 1;
+ del changes["suite"][suite];
+ changes["suite"][override] = 1;
# Validate suites
- for suite in changes["distribution"].keys():
+ for suite in changes["suite"].keys():
suite_id = db_access.get_suite_id(suite);
if suite_id == -1:
utils.fubar("%s has invalid suite '%s' (possibly overriden). say wha?" % (changes, suite));
answer = "XXX";
if Options["No-Action"] or Options["Automatic"]:
- answer = 'S'
- if Options["Automatic"]:
- answer = 'A';
+ answer = 'S';
broken = print_new(new, 0);
prompt = "";
if not broken:
- prompt = "[A]dd overrides, ";
+ prompt = "Add overrides, ";
else:
print "W: [!] marked entries must be fixed before package can be processed.";
if answer == 'A':
answer = 'E';
- prompt = prompt + "Edit overrides, Check, Manual reject, Skip, Quit ?";
+ prompt = prompt + "Edit overrides, Check, Manual reject, [S]kip, Quit ?";
while string.find(prompt, answer) == -1:
- answer = raw_input(prompt)
- m = katie.re_default_answer.match(prompt)
+ answer = utils.our_raw_input(prompt);
+ m = katie.re_default_answer.search(prompt);
if answer == "":
answer = m.group(1)
answer = string.upper(answer[:1])
prompt = "Manual reject, [S]kip, Quit ?";
while string.find(prompt, answer) == -1:
- answer = raw_input(prompt)
- m = katie.re_default_answer.match(prompt)
+ answer = utils.our_raw_input(prompt);
+ m = katie.re_default_answer.search(prompt);
if answer == "":
- answer = m.group(1)
- answer = string.upper(answer[:1])
+ answer = m.group(1);
+ answer = string.upper(answer[:1]);
if answer == 'A':
done = 1;