X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Fqueue.py;h=ca3c133e1fd23e3b62bc00fca013124e2c973064;hb=d34d27f3196d602d8957463b4495cefbf402dc66;hp=6accba0696faa3b84134e95df6e293764fe81302;hpb=7aad4c6ec0c430b8f885f8237a0b33274c641258;p=dak.git diff --git a/daklib/queue.py b/daklib/queue.py index 6accba06..ca3c133e 100755 --- a/daklib/queue.py +++ b/daklib/queue.py @@ -187,7 +187,7 @@ def determine_new(changes, files, warn=1): ################################################################################ -def check_valid(new): +def check_valid(new, session = None): """ Check if section and priority for NEW packages exist in database. Additionally does sanity checks: @@ -204,13 +204,13 @@ def check_valid(new): priority_name = new[pkg]["priority"] file_type = new[pkg]["type"] - section = get_section(section_name) + section = get_section(section_name, session) if section is None: new[pkg]["section id"] = -1 else: new[pkg]["section id"] = section.section_id - priority = get_priority(priority_name) + priority = get_priority(priority_name, session) if priority is None: new[pkg]["priority id"] = -1 else: @@ -569,8 +569,8 @@ class Upload(object): architecture = control.Find("Architecture") upload_suite = self.pkg.changes["distribution"].keys()[0] - if architecture not in [a.arch_string for a in get_suite_architectures(default_suite, session)] \ - and architecture not in [a.arch_string for a in get_suite_architectures(upload_suite, session)]: + if architecture not in [a.arch_string for a in get_suite_architectures(default_suite, session = session)] \ + and architecture not in [a.arch_string for a in get_suite_architectures(upload_suite, session = session)]: self.rejects.append("Unknown architecture '%s'." % (architecture)) # Ensure the architecture of the .deb is one of the ones @@ -2686,6 +2686,15 @@ distribution.""" session = DBConn().session() + # Check if upload already has a changelog entry + query = """SELECT changelog_id FROM changes WHERE source = :source + AND version = :version AND architecture = :architecture AND changelog_id != 0""" + if session.execute(query, {'source': self.pkg.changes['source'], \ + 'version': self.pkg.changes['version'], \ + 'architecture': " ".join(self.pkg.changes['architecture'].keys())}).rowcount: + session.commit() + return + # Add current changelog text into changelogs_text table, return created ID query = "INSERT INTO changelogs_text (changelog) VALUES (:changelog) RETURNING id" ID = session.execute(query, {'changelog': self.pkg.changes['changes']}).fetchone()[0]