X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Fimport_new_files.py;h=5b132c82d7ee2a09f2283e9da1c5272cd2274467;hb=e92bd768962e2d6145907ccc01962c36934975b7;hp=54e85eba151a29bfedac4828311497a87d8f7de9;hpb=d7d8bdc42c05967a2fa56567822dfde2d3256c88;p=dak.git diff --git a/dak/import_new_files.py b/dak/import_new_files.py index 54e85eba..5b132c82 100755 --- a/dak/import_new_files.py +++ b/dak/import_new_files.py @@ -34,9 +34,10 @@ import logging import threading import glob import apt_pkg -from daklib.dbconn import DBConn, get_dbchange, get_policy_queue, session_wrapper, ChangePendingFile +from daklib.dbconn import DBConn, get_dbchange, get_policy_queue, session_wrapper, ChangePendingFile, get_location, check_poolfile from daklib.config import Config from daklib.queue import Upload +from daklib.utils import poolify # where in dak.conf all of our configuration will be stowed options_prefix = "NewFiles" @@ -113,7 +114,7 @@ class ImportNewFiles(object): f.close() except IOError: # Can't find the file, try to look it up in the pool - poolname = utils.poolify(u.pkg.changes["source"], u.pkg.files[chg_fn]["component"]) + poolname = poolify(u.pkg.changes["source"], u.pkg.files[chg_fn]["component"]) l = get_location(cnf["Dir::Pool"], u.pkg.files[chg_fn]["component"], session=session) if not l: log.critical("ERROR: Can't find location for %s (component %s)" % (chg_fn, u.pkg.files[chg_fn]["component"])) @@ -121,7 +122,7 @@ class ImportNewFiles(object): found, poolfile = check_poolfile(os.path.join(poolname, chg_fn), u.pkg.files[chg_fn]['size'], u.pkg.files[chg_fn]["md5sum"], - l, + l.location_id, session=session) if found is None: @@ -135,14 +136,14 @@ class ImportNewFiles(object): log.critical("ERROR: Could not find %s in pool" % chg_fn) sys.exit(1) else: - chg.changeslinks.append(poolfile) + chg.poolfiles.append(poolfile) chg.files = files session.commit() - + except KeyboardInterrupt: print("Caught C-c; terminating.") utils.warn("Caught C-c; terminating.")