]> err.no Git - dak/commitdiff
daklib/changes.py: add logger parameter
authorAnsgar Burchardt <ansgar@debian.org>
Sat, 26 Mar 2011 21:03:35 +0000 (21:03 +0000)
committerAnsgar Burchardt <ansgar@debian.org>
Sat, 26 Mar 2011 21:03:35 +0000 (21:03 +0000)
Signed-off-by: Ansgar Burchardt <ansgar@debian.org>
dak/process_upload.py
daklib/changes.py

index 13474071c34600cb82d3eae1d7a1e37df857ef21..22c333c9910a86cf8148492f28a18ea1c724a1e2 100755 (executable)
@@ -207,6 +207,8 @@ def byebye():
 
 
 def action(u, session):
+    global Logger
+
     cnf = Config()
     holding = Holding()
 
@@ -293,7 +295,7 @@ def action(u, session):
         u.do_reject(0, pi)
     elif answer == 'A':
         if not chg:
-            chg = u.pkg.add_known_changes(holding.holding_dir, session=session)
+            chg = u.pkg.add_known_changes(holding.holding_dir, session=session, logger=Logger)
         session.commit()
         u.accept(summary, short_summary, session)
         u.check_override()
@@ -302,13 +304,13 @@ def action(u, session):
         u.remove()
     elif answer == 'P':
         if not chg:
-            chg = u.pkg.add_known_changes(holding.holding_dir, session=session)
+            chg = u.pkg.add_known_changes(holding.holding_dir, session=session, logger=Logger)
         package_to_queue(u, summary, short_summary, policyqueue, chg, session)
         session.commit()
         u.remove()
     elif answer == queuekey:
         if not chg:
-            chg = u.pkg.add_known_changes(holding.holding_dir, session=session)
+            chg = u.pkg.add_known_changes(holding.holding_dir, session=session, logger=Logger)
         QueueInfo[qu]["process"](u, summary, short_summary, chg, session)
         session.commit()
         u.remove()
index 48da0e580ae5c62ef4fa36b592a05601bd928f7d..1214b03bffb06e9843dcdcc2cdf64b893ba35448 100644 (file)
@@ -187,7 +187,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 +205,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 +293,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)