- session = DBConn().session()
- cnf = Config()
-
- 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()
- os.chdir(cnf["Dir::Queue::Disembargo"])
- disdir = os.getcwd()
- os.chdir(oldcwd)
-
- ret = False
-
- if u.pkg.directory == disdir:
- if u.pkg.changes["architecture"].has_key("source"):
- session.execute("INSERT INTO disembargo (package, version) VALUES (:package, :version)", u.pkg.changes)
- session.commit()
-
- ret = True
-
- session.close()
-
- return ret
-
-def queue_unembargo(u, summary, short_summary):
- return package_to_queue(u, summary, short_summary, "Unembargoed",
- perms=0660, build=True, announce='process-unchecked.accepted')
-
-################################################################################
-
+ session = DBConn().session()
+
+ # If we dont have the disembargo queue we are not on security and so not interested
+ # in doing any security queue handling
+ disembargo_queue = get_policy_queue("unembargoed")
+ if not disembargo_queue:
+ return False
+
+ # If we already are in newstage, then it means this just got passed through and accepted
+ # by a security team member. Don't try to accept it for disembargo again
+ dbc = get_dbchange(u.pkg.changes_file, session)
+ if dbc and dbc.in_queue.queue_name in [ 'newstage' ]:
+ return False
+
+ q = session.execute("SELECT package FROM disembargo WHERE package = :source AND version = :version",
+ {'source': u.pkg.changes["source"],
+ 'version': u.pkg.changes["version"]})
+ if q.rowcount > 0:
+ session.close()
+ return True
+
+ # Ensure we don't have a / on the end or something
+ disdir = os.path.abspath(disembargo_queue.path)
+
+ ret = False
+
+ if u.pkg.directory == disdir:
+ if u.pkg.changes["architecture"].has_key("source"):
+ session.execute("INSERT INTO disembargo (package, version) VALUES (:source, :version)",
+ {'source': u.pkg.changes["source"],
+ 'version': u.pkg.changes["version"]})
+ session.commit()
+
+ ret = True
+
+ session.close()
+
+ return ret
+
+def do_unembargo(u, summary, short_summary, chg, session=None):
+ polq=get_policy_queue('unembargoed')
+ package_to_queue(u, summary, short_summary,
+ polq, chg, session,
+ announce=None)
+#
+#################################################################################
+#