X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Fprocess_unchecked.py;h=a40118d4969b8f90dbdb7252ce92355f0ab8ad35;hb=689f597c251aa4e08e0e9980e4a80c1e3172c5c9;hp=fab21cbf4492a7d3bf4447e0dbf28be6c793e911;hpb=4db4a1577f7971458d41966083b82e46d50b8a04;p=dak.git diff --git a/dak/process_unchecked.py b/dak/process_unchecked.py index fab21cbf..a40118d4 100755 --- a/dak/process_unchecked.py +++ b/dak/process_unchecked.py @@ -124,6 +124,7 @@ def usage (exit_code=0): def action(u): cnf = Config() + # changes["distribution"] may not exist in corner cases # (e.g. unreadable changes files) if not u.pkg.changes.has_key("distribution") or not isinstance(u.pkg.changes["distribution"], DictType): @@ -214,6 +215,8 @@ def package_to_suite(u, suite): if not u.pkg.changes["distribution"].has_key(suite): return False + ret = True + if not u.pkg.changes["architecture"].has_key("source"): s = DBConn().session() q = s.query(SrcAssociation.sa_id) @@ -222,9 +225,11 @@ def package_to_suite(u, suite): q = q.filter_by(version=u.pkg.changes['version']).limit(1) if q.count() < 1: - return False + ret = False - return True + s.close() + + return ret def package_to_queue(u, summary, short_summary, queue, perms=0660, build=True, announce=None): cnf = Config() @@ -258,6 +263,7 @@ def is_unembargo(u): q = session.execute("SELECT package FROM disembargo WHERE package = :source AND version = :version", u.pkg.changes) if q.rowcount > 0: + session.close() return True oldcwd = os.getcwd() @@ -265,15 +271,19 @@ def is_unembargo(u): disdir = os.getcwd() os.chdir(oldcwd) + ret = False + if u.pkg.directory == disdir: if u.pkg.changes["architecture"].has_key("source"): if not Options["No-Action"]: session.execute("INSERT INTO disembargo (package, version) VALUES (:package, :version)", u.pkg.changes) session.commit() - return True + ret = True - return False + session.close() + + return ret def queue_unembargo(u, summary, short_summary): return package_to_queue(u, summary, short_summary, "Unembargoed", @@ -443,6 +453,7 @@ def process_it(changes_file): u.pkg.changes_file = changes_file u.pkg.directory = os.getcwd() u.logger = Logger + origchanges = os.path.join(u.pkg.directory, u.pkg.changes_file) # Some defaults in case we can't fully process the .changes file u.pkg.changes["maintainer2047"] = cnf["Dinstall::MyEmailAddress"] @@ -472,7 +483,7 @@ def process_it(changes_file): # Absolutize the filename to avoid the requirement of being in the # same directory as the .changes file. - holding.copy_to_holding(os.path.abspath(changes_file)) + holding.copy_to_holding(origchanges) # Relativize the filename so we use the copy in holding # rather than the original...