X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Fchanges.py;h=d6ccaa0095d01cad07780be8d57d1bdda57507d9;hb=391f5ec09a119131dc846b796ca791f4cecc69e4;hp=48da0e580ae5c62ef4fa36b592a05601bd928f7d;hpb=63f95b9219d820a00bb4048a9b08b48c3ed09f4b;p=dak.git diff --git a/daklib/changes.py b/daklib/changes.py index 48da0e58..d6ccaa00 100644 --- a/daklib/changes.py +++ b/daklib/changes.py @@ -34,10 +34,9 @@ import datetime from cPickle import Unpickler, Pickler from errno import EPERM -from apt_inst import debExtractControl -from apt_pkg import ParseSection +from apt_pkg import TagSection -from utils import open_file, fubar, poolify +from utils import open_file, fubar, poolify, deb_extract_control from config import * from dbconn import * @@ -127,7 +126,7 @@ class Changes(object): if entry["type"] == "deb": deb_fh = open_file(name) - summary += ParseSection(debExtractControl(deb_fh))["Description"] + '\n' + summary += TagSection(deb_extract_control(deb_fh))["Description"] + '\n' deb_fh.close() else: @@ -187,7 +186,7 @@ class Changes(object): if (not self.changes.has_key(key)) or (not self.changes[key]): self.changes[key]='missing' - def __get_file_from_pool(self, filename, entry, session): + def __get_file_from_pool(self, filename, entry, session, logger): cnf = Config() if cnf.has_key("Dinstall::SuiteSuffix"): @@ -205,20 +204,23 @@ class Changes(object): session=session) if found is None: - Logger.log(["E: Found multiple files for pool (%s) for %s" % (filename, component)]) + if logger is not None: + logger.log(["E: Found multiple files for pool (%s) for %s" % (filename, component)]) return None elif found is False and poolfile is not None: - Logger.log(["E: md5sum/size mismatch for %s in pool" % (filename)]) + if logger is not None: + logger.log(["E: md5sum/size mismatch for %s in pool" % (filename)]) return None else: if poolfile is None: - Logger.log(["E: Could not find %s in pool" % (filename)]) + if logger is not None: + logger.log(["E: Could not find %s in pool" % (filename)]) return None else: return poolfile @session_wrapper - def add_known_changes(self, dirpath, in_queue=None, session=None): + def add_known_changes(self, dirpath, in_queue=None, session=None, logger=None): """add "missing" in fields which we will require for the known_changes table""" cnf = Config() @@ -290,7 +292,7 @@ class Changes(object): continue entry['source'] = self.changes['source'] - poolfile = self.__get_file_from_pool(name, entry, session) + poolfile = self.__get_file_from_pool(name, entry, session, logger) if poolfile: chg.poolfiles.append(poolfile)