From 4dbff62f35fdab0d7452a81a6f93956436caa0f1 Mon Sep 17 00:00:00 2001 From: Mike O'Connor Date: Wed, 28 Oct 2009 19:20:12 +0000 Subject: [PATCH] bootstrap_bin working --- dak/contents.py | 34 +++++- dak/dakdb/update17.py | 264 ++---------------------------------------- dak/update_db.py | 14 +-- daklib/config.py | 3 +- daklib/dbconn.py | 70 +++-------- 5 files changed, 65 insertions(+), 320 deletions(-) diff --git a/dak/contents.py b/dak/contents.py index c435afc5..834cbccf 100755 --- a/dak/contents.py +++ b/dak/contents.py @@ -55,8 +55,8 @@ COMMANDS generate generate Contents-$arch.gz files - bootstrap - scan the debs in the existing pool and load contents in the the database + bootstrap_bin + scan the debs in the existing pool and load contents into the bin_contents table cruft remove files/paths which are no longer referenced by a binary @@ -230,6 +230,34 @@ class Contents(object): s.commit() + def bootstrap_bin(self): + """ + scan the existing debs in the pool to populate the bin_contents table + """ + pooldir = Config()[ 'Dir::Pool' ] + + s = DBConn().session() + + # for binary in s.query(DBBinary).all() ): + binary = s.query(DBBinary).first() + if binary: + filename = binary.poolfile.filename + # Check for existing contents + existingq = s.execute( "select 1 from bin_contents where binary_id=:id", {'id':binary.binary_id} ); + if existingq.fetchone(): + log.debug( "already imported: %s" % (filename)) + else: + # We don't have existing contents so import them + log.debug( "scanning: %s" % (filename) ) + + debfile = os.path.join(pooldir, filename) + if os.path.exists(debfile): + Binary(debfile, self.reject).scan_package(binary.binary_id, True) + else: + log.error("missing .deb: %s" % filename) + + + def bootstrap(self): """ scan the existing debs in the pool to populate the contents database tables @@ -320,7 +348,7 @@ def main(): ] commands = {'generate' : Contents.generate, - 'bootstrap' : Contents.bootstrap, + 'bootstrap_bin' : Contents.bootstrap_bin, 'cruft' : Contents.cruft, } diff --git a/dak/dakdb/update17.py b/dak/dakdb/update17.py index a3e134af..0d7efa9e 100644 --- a/dak/dakdb/update17.py +++ b/dak/dakdb/update17.py @@ -2,7 +2,7 @@ # coding=utf8 """ -Adding a trainee field to the process-new notes +adding a bin_contents table to hold lists of files contained in .debs and .udebs @contact: Debian FTP Master @copyright: 2009 Mike O'Connor @@ -34,277 +34,29 @@ from daklib.dak_exceptions import DBUpdateError ################################################################################ -def suites(): - """ - return a list of suites to operate on - """ - if Config().has_key( "%s::%s" %(options_prefix,"Suite")): - suites = utils.split_args(Config()[ "%s::%s" %(options_prefix,"Suite")]) - else: - suites = [ 'unstable', 'testing' ] -# suites = Config().SubTree("Suite").List() - - return suites - -def arches(cursor, suite): - """ - return a list of archs to operate on - """ - arch_list = [] - cursor.execute("EXECUTE arches_q(%d)" % (suite)) - while True: - r = cursor.fetchone() - if not r: - break - - if r[1] != "source" and r[1] != "all": - arch_list.append((r[0], r[1])) - - return arch_list - def do_update(self): - """ - Adding contents table as first step to maybe, finally getting rid - of apt-ftparchive - """ - print __doc__ + print "adding a bin_contents table to hold lists of files contained in .debs and .udebs" try: c = self.db.cursor() - c.execute("""CREATE TABLE deb_contents ( + c.execute("""CREATE TABLE bin_contents ( file text, - section text, - package text, binary_id integer, - arch integer, - suite integer, - component integer)""" ) + UNIQUE(file,binary_id))""" ) - c.execute("""CREATE TABLE udeb_contents ( - file text, - section text, - package text, - binary_id integer, - suite integer, - component integer )""" ) - - c.execute("""ALTER TABLE ONLY deb_contents - ADD CONSTRAINT deb_contents_arch_fkey - FOREIGN KEY (arch) REFERENCES architecture(id) - ON DELETE CASCADE;""") - - c.execute("""ALTER TABLE ONLY udeb_contents - ADD CONSTRAINT udeb_contents_arch_fkey - FOREIGN KEY (arch) REFERENCES architecture(id) - ON DELETE CASCADE;""") - - c.execute("""ALTER TABLE ONLY deb_contents - ADD CONSTRAINT deb_contents_suite_fkey - FOREIGN KEY (suite) REFERENCES suite(id) - ON DELETE CASCADE;""") - - c.execute("""ALTER TABLE ONLY udeb_contents - ADD CONSTRAINT udeb_contents_suite_fkey - FOREIGN KEY (suite) REFERENCES suite(id) - ON DELETE CASCADE;""") - - c.execute("""ALTER TABLE ONLY deb_contents - ADD CONSTRAINT deb_contents_binary_fkey + c.execute("""ALTER TABLE ONLY bin_contents + ADD CONSTRAINT bin_contents_bin_fkey FOREIGN KEY (binary_id) REFERENCES binaries(id) ON DELETE CASCADE;""") - c.execute("""ALTER TABLE ONLY udeb_contents - ADD CONSTRAINT udeb_contents_binary_fkey - FOREIGN KEY (binary_id) REFERENCES binaries(id) - ON DELETE CASCADE;""") - - c.execute("""CREATE INDEX ind_deb_contents_binary ON deb_contents(binary_id);""" ) - - arches_q = """PREPARE arches_q(int) as - SELECT s.architecture, a.arch_string - FROM suite_architectures s - JOIN architecture a ON (s.architecture=a.id) - WHERE suite = $1""" - - suites = self.suites() - - for suite in [i.lower() for i in suites]: - suite_id = DBConn().get_suite_id(suite) - arch_list = arches(c, suite_id) - arch_list = arches(c, suite_id) - - for (arch_id,arch_str) in arch_list: - c.execute( "CREATE INDEX ind_deb_contents_%s_%s ON deb_contents (arch,suite) WHERE (arch=2 OR arch=%d) AND suite=$d"%(arch_str,suite,arch_id,suite_id) ) - - for section, sname in [("debian-installer","main"), - ("non-free/debian-installer", "nonfree")]: - c.execute( "CREATE INDEX ind_udeb_contents_%s_%s ON udeb_contents (section,suite) WHERE section=%s AND suite=$d"%(sname,suite,section,suite_id) ) - - - Column | Type | Modifiers - ------------+---------+----------- - package | text | not null - suite | integer | not null - component | integer | not null - priority | integer | - section | integer | not null - type | integer | not null - maintainer | text | - - c.execute("""CREATE TABLE deb_contents ( - file text, - section text, - package text, - binary_id integer, - arch integer, - suite integer, - component integer)""" ) - - -CREATE FUNCTION update_contents_for_override() RETURNS trigger AS $update_contents_for_override$ -BEGIN - UPDATE deb_contents SET section=NEW.section, component=NEW.component - WHERE deb_contents.package=OLD.package - - -DELETE FROM -NEW.last_date := current_timestamp; -NEW.last_user := current_user; -RETURN NEW; -END; -$update_contents_for_override$ LANGUAGE plpgsql; - + c.execute("""CREATE INDEX ind_bin_contents_binary ON bin_contents(binary_id);""" ) self.db.commit() except psycopg2.ProgrammingError, msg: self.db.rollback() - raise DBUpdateError, "Unable to apply process-new update 14, rollback issued. Error message : %s" % (str(msg)) -""" - INSERT INTO deb_contents SELECT (p.path||'/'||n.file) AS file, - s.section AS section, - b.package AS package, - b.id AS binary_id, - b.architecture AS arch, - o.suite AS suited, - o.component AS componentd, - o.type AS otype_id - FROM content_associations c - JOIN content_file_paths p ON (c.filepath=p.id) - JOIN content_file_names n ON (c.filename=n.id) - JOIN binaries b ON (b.id=c.binary_pkg) - JOIN architecture a ON (b.architecture = a.id) - JOIN override o ON (o.package=b.package) - JOIN bin_associations ba on ba.suite=o.suite and ba.bin=b.id - JOIN section s ON (s.id=o.section) - where b.type='deb'; - - INSERT INTO udeb_contents SELECT (p.path||'/'||n.file) AS file, - s.section AS section, - b.package AS package, - b.id AS binary_id, - b.architecture AS arch, - o.suite AS suited, - o.component AS componentd, - o.type AS otype_id - FROM content_associations c - JOIN content_file_paths p ON (c.filepath=p.id) - JOIN content_file_names n ON (c.filename=n.id) - JOIN binaries b ON (b.id=c.binary_pkg) - JOIN architecture a ON (b.architecture = a.id) - JOIN override o ON (o.package=b.package) - JOIN section s ON (s.id=o.section) - where b.type='udeb' -""" - -""" -CREATE INDEX ind_archid ON contents(arch); -CREATE INDEX ind_archid_amd64 ON contents(arch) WHERE arch=16; -CREATE INDEX ind_suite ON contents(suite); -CREATE INDEX ind_suite_unstable ON contents(suite) WHERE suite=5; -CREATE INDEX ind_overridetype ON contents(otype); -CREATE INDEX ind_overridetype_deb ON contents(otype) WHERE otype=7; -CREATE INDEX ind_packagetype ON contents(packagetype); -CREATE INDEX ind_packagetype_deb ON contents(packagetype) WHERE packagetype='deb'; -CREATE INDEX ind_package ON contents(package); - - CREATE INDEX ind_suite_otype ON contents(suite, otype) WHERE suite=5 AND otype=7; - CREATE INDEX ind_suite_otype_arch ON contents(suite, otype, arch) WHERE suite=5 AND otype=7 AND arch=16; - CREATE INDEX ind_suite_otype_package ON contents(suite, otype, packagetype) WHERE suite=5 AND otype=7 AND packagetype='deb'; - CREATE INDEX ind_suite_otype_package_notdeb ON contents(suite, otype, packagetype) WHERE suite=5 AND otype=7 AND packagetype!='deb'; - """ - -CREATE INDEX ind_deb_contents_binary ON deb_contents(binary_id); - -CREATE INDEX ind_deb_contents_arch_alpha_unstable ON deb_contents(arch) where (arch=2 or arch=3) AND suite=5 AND otype=7; -CREATE INDEX ind_deb_contents_arch_hurd_i386_unstable ON deb_contents(arch) where (arch=2 or arch=4) AND suite=5 AND otype=7; -CREATE INDEX ind_deb_contents_arch_hppa_unstable ON deb_contents(arch) where (arch=2 or arch=5) AND suite=5 AND otype=7; -CREATE INDEX ind_deb_contents_arch_arm_unstable ON deb_contents(arch) where (arch=2 or arch=6) AND suite=5 AND otype=7; -CREATE INDEX ind_deb_contents_arch_i386_unstable ON deb_contents(arch) where (arch=2 or arch=7) AND suite=5 AND otype=7; -CREATE INDEX ind_deb_contents_arch_m68k_unstable ON deb_contents(arch) where (arch=2 or arch=8) AND suite=5 AND otype=7; -CREATE INDEX ind_deb_contents_arch_mips_unstable ON deb_contents(arch) where (arch=2 or arch=9) AND suite=5 AND otype=7; -CREATE INDEX ind_deb_contents_arch_mipsel_unstable ON deb_contents(arch) where (arch=2 or arch=10) AND suite=5 AND otype=7; -CREATE INDEX ind_deb_contents_arch_powerpc_unstable ON deb_contents(arch) where (arch=2 or arch=11) AND suite=5 AND otype=7; -CREATE INDEX ind_deb_contents_arch_sh_unstable ON deb_contents(arch) where (arch=2 or arch=12) AND suite=5 AND otype=7; -CREATE INDEX ind_deb_contents_arch_sparc_unstable ON deb_contents(arch) where (arch=2 or arch=13) AND suite=5 AND otype=7; -CREATE INDEX ind_deb_contents_arch_s390_unstable ON deb_contents(arch) where (arch=2 or arch=14) AND suite=5 AND otype=7; -CREATE INDEX ind_deb_contents_arch_ia64_unstable ON deb_contents(arch) where (arch=2 or arch=15) AND suite=5 AND otype=7; -CREATE INDEX ind_deb_contents_arch_amd64_unstable ON deb_contents(arch) where (arch=2 or arch=16) AND suite=5 AND otype=7; -CREATE INDEX ind_deb_contents_arch_armel_unstable ON deb_contents(arch) where (arch=2 or arch=17) AND suite=5 AND otype=7; -CREATE INDEX ind_deb_contents_arch_kfreebsd_i386_unstable ON deb_contents(arch) where (arch=2 or arch=25) AND suite=5 AND otype=7; -CREATE INDEX ind_deb_contents_arch_kfreebsd_amd64_unstable ON deb_contents(arch) where (arch=2 or arch=26) AND suite=5 AND otype=7; + raise DBUpdateError, "Unable to apply process-new update 17, rollback issued. Error message : %s" % (str(msg)) -CREATE INDEX ind_deb_contents_arch_alpha_stable ON deb_contents(arch) where (arch=2 or arch=3) AND suite=2 AND otype=7; -CREATE INDEX ind_deb_contents_arch_hurd_i386_stable ON deb_contents(arch) where (arch=2 or arch=4) AND suite=2 AND otype=7; -CREATE INDEX ind_deb_contents_arch_hppa_stable ON deb_contents(arch) where (arch=2 or arch=5) AND suite=2 AND otype=7; -CREATE INDEX ind_deb_contents_arch_arm_stable ON deb_contents(arch) where (arch=2 or arch=6) AND suite=2 AND otype=7; -CREATE INDEX ind_deb_contents_arch_i386_stable ON deb_contents(arch) where (arch=2 or arch=7) AND suite=2 AND otype=7; -CREATE INDEX ind_deb_contents_arch_m68k_stable ON deb_contents(arch) where (arch=2 or arch=8) AND suite=2 AND otype=7; -CREATE INDEX ind_deb_contents_arch_mips_stable ON deb_contents(arch) where (arch=2 or arch=9) AND suite=2 AND otype=7; -CREATE INDEX ind_deb_contents_arch_mipsel_stable ON deb_contents(arch) where (arch=2 or arch=10) AND suite=2 AND otype=7; -CREATE INDEX ind_deb_contents_arch_powerpc_stable ON deb_contents(arch) where (arch=2 or arch=11) AND suite=2 AND otype=7; -CREATE INDEX ind_deb_contents_arch_sh_stable ON deb_contents(arch) where (arch=2 or arch=12) AND suite=2 AND otype=7; -CREATE INDEX ind_deb_contents_arch_sparc_stable ON deb_contents(arch) where (arch=2 or arch=13) AND suite=2 AND otype=7; -CREATE INDEX ind_deb_contents_arch_s390_stable ON deb_contents(arch) where (arch=2 or arch=14) AND suite=2 AND otype=7; -CREATE INDEX ind_deb_contents_arch_ia64_stable ON deb_contents(arch) where (arch=2 or arch=15) AND suite=2 AND otype=7; -CREATE INDEX ind_deb_contents_arch_amd64_stable ON deb_contents(arch) where (arch=2 or arch=16) AND suite=2 AND otype=7; -CREATE INDEX ind_deb_contents_arch_armel_stable ON deb_contents(arch) where (arch=2 or arch=17) AND suite=2 AND otype=7; -CREATE INDEX ind_deb_contents_arch_kfreebsd_i386_stable ON deb_contents(arch) where (arch=2 or arch=25) AND suite=2 AND otype=7; -CREATE INDEX ind_deb_contents_arch_kfreebsd_amd64_stable ON deb_contents(arch) where (arch=2 or arch=26) AND suite=2 AND otype=7; -CREATE INDEX ind_deb_contents_arch_alpha_testing ON deb_contents(arch) where (arch=2 or arch=3) AND suite=4 AND otype=7; -CREATE INDEX ind_deb_contents_arch_hurd_i386_testing ON deb_contents(arch) where (arch=2 or arch=4) AND suite=4 AND otype=7; -CREATE INDEX ind_deb_contents_arch_hppa_testing ON deb_contents(arch) where (arch=2 or arch=5) AND suite=4 AND otype=7; -CREATE INDEX ind_deb_contents_arch_arm_testing ON deb_contents(arch) where (arch=2 or arch=6) AND suite=4 AND otype=7; -CREATE INDEX ind_deb_contents_arch_i386_testing ON deb_contents(arch) where (arch=2 or arch=7) AND suite=4 AND otype=7; -CREATE INDEX ind_deb_contents_arch_m68k_testing ON deb_contents(arch) where (arch=2 or arch=8) AND suite=4 AND otype=7; -CREATE INDEX ind_deb_contents_arch_mips_testing ON deb_contents(arch) where (arch=2 or arch=9) AND suite=4 AND otype=7; -CREATE INDEX ind_deb_contents_arch_mipsel_testing ON deb_contents(arch) where (arch=2 or arch=10) AND suite=4 AND otype=7; -CREATE INDEX ind_deb_contents_arch_powerpc_testing ON deb_contents(arch) where (arch=2 or arch=11) AND suite=4 AND otype=7; -CREATE INDEX ind_deb_contents_arch_sh_testing ON deb_contents(arch) where (arch=2 or arch=12) AND suite=4 AND otype=7; -CREATE INDEX ind_deb_contents_arch_sparc_testing ON deb_contents(arch) where (arch=2 or arch=13) AND suite=4 AND otype=7; -CREATE INDEX ind_deb_contents_arch_s390_testing ON deb_contents(arch) where (arch=2 or arch=14) AND suite=4 AND otype=7; -CREATE INDEX ind_deb_contents_arch_ia64_testing ON deb_contents(arch) where (arch=2 or arch=15) AND suite=4 AND otype=7; -CREATE INDEX ind_deb_contents_arch_amd64_testing ON deb_contents(arch) where (arch=2 or arch=16) AND suite=4 AND otype=7; -CREATE INDEX ind_deb_contents_arch_armel_testing ON deb_contents(arch) where (arch=2 or arch=17) AND suite=4 AND otype=7; -CREATE INDEX ind_deb_contents_arch_kfreebsd_i386_testing ON deb_contents(arch) where (arch=2 or arch=25) AND suite=4 AND otype=7; -CREATE INDEX ind_deb_contents_arch_kfreebsd_amd64_testing ON deb_contents(arch) where (arch=2 or arch=26) AND suite=4 AND otype=7; -CREATE INDEX ind_deb_contents_arch_alpha_oldstable ON deb_contents(arch) where (arch=2 or arch=3) AND suite=14 AND otype=7; -CREATE INDEX ind_deb_contents_arch_hurd_i386_oldstable ON deb_contents(arch) where (arch=2 or arch=4) AND suite=14 AND otype=7; -CREATE INDEX ind_deb_contents_arch_hppa_oldstable ON deb_contents(arch) where (arch=2 or arch=5) AND suite=14 AND otype=7; -CREATE INDEX ind_deb_contents_arch_arm_oldstable ON deb_contents(arch) where (arch=2 or arch=6) AND suite=14 AND otype=7; -CREATE INDEX ind_deb_contents_arch_i386_oldstable ON deb_contents(arch) where (arch=2 or arch=7) AND suite=14 AND otype=7; -CREATE INDEX ind_deb_contents_arch_m68k_oldstable ON deb_contents(arch) where (arch=2 or arch=8) AND suite=14 AND otype=7; -CREATE INDEX ind_deb_contents_arch_mips_oldstable ON deb_contents(arch) where (arch=2 or arch=9) AND suite=14 AND otype=7; -CREATE INDEX ind_deb_contents_arch_mipsel_oldstable ON deb_contents(arch) where (arch=2 or arch=10) AND suite=14 AND otype=7; -CREATE INDEX ind_deb_contents_arch_powerpc_oldstable ON deb_contents(arch) where (arch=2 or arch=11) AND suite=14 AND otype=7; -CREATE INDEX ind_deb_contents_arch_sh_oldstable ON deb_contents(arch) where (arch=2 or arch=12) AND suite=14 AND otype=7; -CREATE INDEX ind_deb_contents_arch_sparc_oldstable ON deb_contents(arch) where (arch=2 or arch=13) AND suite=14 AND otype=7; -CREATE INDEX ind_deb_contents_arch_s390_oldstable ON deb_contents(arch) where (arch=2 or arch=14) AND suite=14 AND otype=7; -CREATE INDEX ind_deb_contents_arch_ia64_oldstable ON deb_contents(arch) where (arch=2 or arch=15) AND suite=14 AND otype=7; -CREATE INDEX ind_deb_contents_arch_amd64_oldstable ON deb_contents(arch) where (arch=2 or arch=16) AND suite=14 AND otype=7; -CREATE INDEX ind_deb_contents_arch_armel_oldstable ON deb_contents(arch) where (arch=2 or arch=17) AND suite=14 AND otype=7; -CREATE INDEX ind_deb_contents_arch_kfreebsd_i386_oldstable ON deb_contents(arch) where (arch=2 or arch=25) AND suite=14 AND otype=7; -CREATE INDEX ind_deb_contents_arch_kfreebsd_amd64_oldstable ON deb_contents(arch) where (arch=2 or arch=26) AND suite=14 AND otype=7; diff --git a/dak/update_db.py b/dak/update_db.py index f35521f4..7d7fe9fe 100755 --- a/dak/update_db.py +++ b/dak/update_db.py @@ -44,7 +44,7 @@ from daklib.dak_exceptions import DBUpdateError ################################################################################ Cnf = None -required_database_schema = 15 +required_database_schema = 17 ################################################################################ @@ -177,12 +177,12 @@ Updates dak's database schema to the lastest version. You should disable crontab self.update_db() - try: - lock_fd = os.open(Cnf["Dinstall::LockFile"], os.O_RDWR | os.O_CREAT) - fcntl.lockf(lock_fd, fcntl.LOCK_EX | fcntl.LOCK_NB) - except IOError, e: - if errno.errorcode[e.errno] == 'EACCES' or errno.errorcode[e.errno] == 'EAGAIN': - utils.fubar("Couldn't obtain lock; assuming another 'dak process-unchecked' is already running.") +#STU try: +#STU lock_fd = os.open(Cnf["Dinstall::LockFile"], os.O_RDWR | os.O_CREAT) +#STU fcntl.lockf(lock_fd, fcntl.LOCK_EX | fcntl.LOCK_NB) +#STU except IOError, e: +#STU if errno.errorcode[e.errno] == 'EACCES' or errno.errorcode[e.errno] == 'EAGAIN': +#STU utils.fubar("Couldn't obtain lock; assuming another 'dak process-unchecked' is already running.") ################################################################################ diff --git a/daklib/config.py b/daklib/config.py index 09df17bb..b98a6fc9 100755 --- a/daklib/config.py +++ b/daklib/config.py @@ -35,7 +35,8 @@ from singleton import Singleton ################################################################################ -default_config = "/etc/dak/dak.conf" +#default_config = "/etc/dak/dak.conf" +default_config = "/home/stew/etc/dak/dak.conf" #: default dak config, defines host properties def which_conf_file(Cnf): res = socket.gethostbyaddr(socket.gethostname()) diff --git a/daklib/dbconn.py b/daklib/dbconn.py index 9421b28f..3c0bc50d 100755 --- a/daklib/dbconn.py +++ b/daklib/dbconn.py @@ -230,6 +230,17 @@ __all__.append('BinAssociation') ################################################################################ +class BinContents(object): + def __init__(self, *args, **kwargs): + pass + + def __repr__(self): + return '' % (self.binary, self.filename) + +__all__.append('BinContents') + +################################################################################ + class DBBinary(object): def __init__(self, *args, **kwargs): pass @@ -435,15 +446,6 @@ __all__.append('DBConfig') ################################################################################ -class ContentFilename(object): - def __init__(self, *args, **kwargs): - pass - - def __repr__(self): - return '' % self.filename - -__all__.append('ContentFilename') - @session_wrapper def get_or_set_contents_file_id(filename, session=None): """ @@ -610,28 +612,14 @@ def insert_content_paths(binary_id, fullpaths, session=None): # Insert paths pathcache = {} for fullpath in fullpaths: - # Get the necessary IDs ... - (path, file) = os.path.split(fullpath) + if fullpath.startswith( './' ): + fullpath = fullpath[2:] + + session.execute( "INSERT INTO bin_contents ( file, binary_id ) VALUES ( :filename, :id )", { 'filename': fullpath, 'id': binary_id} ) - filepath_id = get_or_set_contents_path_id(path, session) - filename_id = get_or_set_contents_file_id(file, session) - - pathcache[fullpath] = (filepath_id, filename_id) - - for fullpath, dat in pathcache.items(): - ca = ContentAssociation() - ca.binary_id = binary_id - ca.filepath_id = dat[0] - ca.filename_id = dat[1] - session.add(ca) - - # Only commit if we set up the session ourself + session.commit() if privatetrans: - session.commit() session.close() - else: - session.flush() - return True except: @@ -2129,6 +2117,7 @@ class DBConn(Singleton): binary_id = self.tbl_bin_associations.c.bin, binary = relation(DBBinary))) + mapper(DBBinary, self.tbl_binaries, properties = dict(binary_id = self.tbl_binaries.c.id, package = self.tbl_binaries.c.package, @@ -2155,24 +2144,6 @@ class DBConn(Singleton): mapper(DBConfig, self.tbl_config, properties = dict(config_id = self.tbl_config.c.id)) - mapper(ContentAssociation, self.tbl_content_associations, - properties = dict(ca_id = self.tbl_content_associations.c.id, - filename_id = self.tbl_content_associations.c.filename, - filename = relation(ContentFilename), - filepath_id = self.tbl_content_associations.c.filepath, - filepath = relation(ContentFilepath), - binary_id = self.tbl_content_associations.c.binary_pkg, - binary = relation(DBBinary))) - - - mapper(ContentFilename, self.tbl_content_file_names, - properties = dict(cafilename_id = self.tbl_content_file_names.c.id, - filename = self.tbl_content_file_names.c.file)) - - mapper(ContentFilepath, self.tbl_content_file_paths, - properties = dict(cafilepath_id = self.tbl_content_file_paths.c.id, - filepath = self.tbl_content_file_paths.c.path)) - mapper(DSCFile, self.tbl_dsc_files, properties = dict(dscfile_id = self.tbl_dsc_files.c.id, source_id = self.tbl_dsc_files.c.source, @@ -2227,13 +2198,6 @@ class DBConn(Singleton): properties = dict(overridetype = self.tbl_override_type.c.type, overridetype_id = self.tbl_override_type.c.id)) - mapper(PendingContentAssociation, self.tbl_pending_content_associations, - properties = dict(pca_id = self.tbl_pending_content_associations.c.id, - filepath_id = self.tbl_pending_content_associations.c.filepath, - filepath = relation(ContentFilepath), - filename_id = self.tbl_pending_content_associations.c.filename, - filename = relation(ContentFilename))) - mapper(Priority, self.tbl_priority, properties = dict(priority_id = self.tbl_priority.c.id)) -- 2.39.2