]> git.decadent.org.uk Git - dak.git/commitdiff
generate-filelist: create fewer DB sessions
authorTorsten Werner <twerner@debian.org>
Thu, 15 Jul 2010 21:47:44 +0000 (21:47 +0000)
committerTorsten Werner <twerner@debian.org>
Thu, 15 Jul 2010 21:47:44 +0000 (21:47 +0000)
Signed-off-by: Torsten Werner <twerner@debian.org>
dak/generate_filelist.py

index f9e9dad6ed54c8d4e1a19bfb7aecbf7d4eabb806..a2246f5cd3707dbf656886ffcee2bb356140064f 100755 (executable)
@@ -191,14 +191,15 @@ def main():
                  ('c', "component",    "Filelist::Options::Component", "HasArg"),
                  ('a', "architecture", "Filelist::Options::Architecture", "HasArg"),
                  ('i', "incremental",  "Filelist::Options::Incremental")]
-    query_suites = DBConn().session().query(Suite)
+    session = DBConn().session()
+    query_suites = session.query(Suite)
     suites = [suite.suite_name for suite in query_suites.all()]
     if not cnf.has_key('Filelist::Options::Suite'):
         cnf['Filelist::Options::Suite'] = ','.join(suites)
     # we can ask the database for components if 'mixed' is gone
     if not cnf.has_key('Filelist::Options::Component'):
         cnf['Filelist::Options::Component'] = 'main,contrib,non-free'
-    query_architectures = DBConn().session().query(Architecture)
+    query_architectures = session.query(Architecture)
     architectures = \
         [architecture.arch_string for architecture in query_architectures.all()]
     if not cnf.has_key('Filelist::Options::Architecture'):
@@ -209,7 +210,6 @@ def main():
     Options = cnf.SubTree("Filelist::Options")
     if Options['Help']:
         usage()
-    session = DBConn().session()
     suite_arch = session.query(SuiteArchitecture)
     threadpool = ThreadPool()
     for suite_name in utils.split_args(Options['Suite']):