#!/usr/bin/env python
# Manually reject packages for proprosed-updates
-# Copyright (C) 2001, 2002, 2003 James Troup <james@nocrew.org>
-# $Id: lauren,v 1.1 2003-02-21 19:18:05 troup Exp $
+# Copyright (C) 2001, 2002, 2003, 2004 James Troup <james@nocrew.org>
+# $Id: lauren,v 1.4 2004-04-01 17:13:11 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, sys, tempfile;
+import os, pg, sys;
import db_access, katie, logging, utils;
import apt_pkg;
################################################################################
# Globals
-lauren_version = "$Revision: 1.1 $";
+lauren_version = "$Revision: 1.4 $";
Cnf = None;
Options = None;
# If we weren't given a manual rejection message, spawn an editor
# so the user can add one in...
if not reject_message:
- temp_filename = tempfile.mktemp();
- fd = os.open(temp_filename, os.O_RDWR|os.O_CREAT|os.O_EXCL, 0700);
- os.close(fd);
+ temp_filename = utils.temp_filename();
editor = os.environ.get("EDITOR","vi")
answer = 'E';
while answer == 'E':
architecture = files[file]["architecture"];
q = projectB.query("SELECT b.id FROM binaries b, architecture a WHERE b.package = '%s' AND b.version = '%s' AND (a.arch_string = '%s' OR a.arch_string = 'all') AND b.architecture = a.id" % (package, version, architecture));
ql = q.getresult();
+
+ # Horrible hack to work around partial replacement of
+ # packages with newer versions (from different source
+ # packages). This, obviously, should instead check for a
+ # newer version of the package and only do the
+ # warn&continue thing if it finds one.
if not ql:
- utils.fubar("reject: Couldn't find %s_%s_%s in binaries table." % (package, version, architecture));
- binary_id = ql[0][0];
- projectB.query("DELETE FROM bin_associations WHERE suite = '%s' AND bin = '%s'" % (suite_id, binary_id));
+ utils.warn("reject: Couldn't find %s_%s_%s in binaries table." % (package, version, architecture));
+ else:
+ binary_id = ql[0][0];
+ projectB.query("DELETE FROM bin_associations WHERE suite = '%s' AND bin = '%s'" % (suite_id, binary_id));
projectB.query("COMMIT WORK");
# Send the rejection mail if appropriate
if not Options["No-Mail"]:
- utils.send_mail (reject_mail_message, "");
+ utils.send_mail(reject_mail_message);
# Finally remove the .katie file
katie_file = os.path.join(Cnf["Suite::Proposed-Updates::CopyKatie"], os.path.basename(changes_file[:-8]+".katie"));