X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Fdbconn.py;h=ca6befea8677dfd1ad5f94a51a42ef85410638d3;hb=f2b3db04952a94011b8f459f701d6aff2ef9b2ed;hp=80a1f233ad29341a3e13972372811c466c25ff4c;hpb=6b3c8ccbd61325e2b833ed252b5545a190bff92f;p=dak.git diff --git a/daklib/dbconn.py b/daklib/dbconn.py index 80a1f233..ca6befea 100755 --- a/daklib/dbconn.py +++ b/daklib/dbconn.py @@ -75,7 +75,6 @@ from sqlalchemy.orm.exc import NoResultFound from config import Config from textutils import fix_maintainer from dak_exceptions import DBUpdateError, NoSourceFieldError, FileExistsError -import utils # suppress some deprecation warnings in squeeze related to sqlalchemy import warnings @@ -501,7 +500,7 @@ def subprocess_setup(): class DBBinary(ORMObject): def __init__(self, package = None, source = None, version = None, \ maintainer = None, architecture = None, poolfile = None, \ - binarytype = 'deb'): + binarytype = 'deb', fingerprint=None): self.package = package self.source = source self.version = version @@ -509,6 +508,7 @@ class DBBinary(ORMObject): self.architecture = architecture self.poolfile = poolfile self.binarytype = binarytype + self.fingerprint = fingerprint @property def pkid(self): @@ -559,7 +559,7 @@ class DBBinary(ORMObject): @rtype: text @return: stanza text of the control section. ''' - import apt_inst + import utils fullpath = self.poolfile.fullpath deb_file = open(fullpath, 'r') stanza = utils.deb_extract_control(deb_file) @@ -2460,13 +2460,14 @@ class Dak822(Deb822): class DBSource(ORMObject): def __init__(self, source = None, version = None, maintainer = None, \ - changedby = None, poolfile = None, install_date = None): + changedby = None, poolfile = None, install_date = None, fingerprint = None): self.source = source self.version = version self.maintainer = maintainer self.changedby = changedby self.poolfile = poolfile self.install_date = install_date + self.fingerprint = fingerprint @property def pkid(self): @@ -2479,7 +2480,7 @@ class DBSource(ORMObject): def not_null_constraints(self): return ['source', 'version', 'install_date', 'maintainer', \ - 'changedby', 'poolfile', 'install_date'] + 'changedby', 'poolfile'] def read_control_fields(self): ''' @@ -2998,6 +2999,10 @@ class Suite(ORMObject): else: return object_session(self).query(Suite).filter_by(suite_name=self.overridesuite).one() + @property + def path(self): + return os.path.join(self.archive.path, 'dists', self.suite_name) + __all__.append('Suite') @session_wrapper @@ -3595,7 +3600,8 @@ class DBConn(object): copy_queues = relation(BuildQueue, secondary=self.tbl_suite_build_queue_copy), srcformats = relation(SrcFormat, secondary=self.tbl_suite_src_formats, - backref=backref('suites', lazy='dynamic'))), + backref=backref('suites', lazy='dynamic')), + archive = relation(Archive, backref='suites')), extension = validator) mapper(Uid, self.tbl_uid,