for comm in [ x for x in os.listdir(dir) if x.startswith(opref) ]:
lines = open("%s/%s" % (dir, comm)).readlines()
if len(lines) == 0 or lines[0] != line + "\n": continue
- changes_files = [ x for x in os.listdir(".") if x.startswith(comm[7:]+"_")
+ changes_files = [ x for x in os.listdir(".") if x.startswith(comm[len(opref):]+"_")
and x.endswith(".changes") ]
changes_files = sort_changes(changes_files, session)
for f in changes_files:
continue
fn(f, srcqueue, "".join(lines[1:]), session)
- if len(changes_files) and not Options["No-Action"]:
- store_changelog(changes_files[0], srcqueue)
-
if opref != npref and not Options["No-Action"]:
newcomm = npref + comm[len(opref):]
os.rename("%s/%s" % (dir, comm), "%s/%s" % (dir, newcomm))
################################################################################
-def store_changelog(changes_file, srcqueue):
- Cnf = Config()
- u = Upload()
- u.pkg.changes_file = os.path.join(Cnf['Dir::Queue::Newstage'], changes_file)
- u.load_changes(u.pkg.changes_file)
- u.update_subst()
- query = """INSERT INTO changelogs (source, version, suite, changelog)
- VALUES (:source, :version, :suite, :changelog)"""
- session = DBConn().session()
- session.execute(query, {'source': u.pkg.changes['source'], 'version': u.pkg.changes['version'], \
- 'suite': srcqueue.queue_name, 'changelog': u.pkg.changes['changes']})
- session.commit()
-
-################################################################################
-
def main():
global Options, Logger
if not Options["No-Action"]:
try:
- Logger = daklog.Logger(cnf, "process-policy")
- except CantOpenError, e:
+ Logger = daklog.Logger("process-policy")
+ except CantOpenError as e:
Logger = None
# Find policy queue
# The comments stuff relies on being in the right directory
os.chdir(pq.path)
do_comments(commentsdir, pq, "ACCEPT.", "ACCEPTED.", "OK", comment_accept, session)
+ do_comments(commentsdir, pq, "ACCEPTED.", "ACCEPTED.", "OK", comment_accept, session)
do_comments(commentsdir, pq, "REJECT.", "REJECTED.", "NOTOK", comment_reject, session)