X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Fqueue.py;h=58fdf7f3115acc306807405457aa88386cf87881;hb=b31278febbe7fa99b8d703a0ee70a872c2e3882c;hp=907e98c3211a5f7efe41c61927aa4c3f5726639d;hpb=ad27548cafad40e498924bc6942be8339b8ee9d3;p=dak.git diff --git a/daklib/queue.py b/daklib/queue.py index 907e98c3..58fdf7f3 100755 --- a/daklib/queue.py +++ b/daklib/queue.py @@ -929,7 +929,7 @@ class Upload(object): # Parse the .dsc file try: - self.pkg.dsc.update(utils.parse_changes(dsc_filename, signing_rules=1)) + self.pkg.dsc.update(utils.parse_changes(dsc_filename, signing_rules=1, dsc_file=1)) except CantOpenError: # if not -n copy_to_holding() will have done this for us... if not action: @@ -1225,7 +1225,7 @@ class Upload(object): found = False # Look in the pool - for poolfile in get_poolfile_like_name('/%s' % filename, session_): + for poolfile in get_poolfile_like_name('%s' % filename, session_): poolfile_path = os.path.join( poolfile.location.path, poolfile.filename ) @@ -1899,6 +1899,9 @@ distribution.""" # Make sure that our source object is up-to-date session.expire(source) + # Add changelog information to the database + self.store_changelog() + # Install the files into the pool for newfile, entry in self.pkg.files.items(): destination = os.path.join(cnf["Dir::Pool"], entry["pool name"], newfile) @@ -2672,3 +2675,26 @@ distribution.""" os.chdir(cwd) return too_new + + def store_changelog(self): + + # Skip binary-only upload if it is not a bin-NMU + if not self.pkg.changes['architecture'].has_key('source'): + from daklib.regexes import re_bin_only_nmu + if not re_bin_only_nmu.search(self.pkg.changes['version']): + return + + session = DBConn().session() + + # 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] + + # Link ID to the upload available in changes table + query = """UPDATE changes SET changelog_id = :id WHERE source = :source + AND version = :version AND architecture = :architecture""" + session.execute(query, {'id': ID, 'source': self.pkg.changes['source'], \ + 'version': self.pkg.changes['version'], \ + 'architecture': " ".join(self.pkg.changes['architecture'].keys())}) + + session.commit()