some fixmes and starts - and recommit a working --database-only
authorSeth Vidal <skvidal@fedoraproject.org>
Thu, 5 Jun 2008 16:06:04 +0000 (12:06 -0400)
committerSeth Vidal <skvidal@fedoraproject.org>
Thu, 5 Jun 2008 16:09:22 +0000 (12:09 -0400)
createrepo/__init__.py
createrepo/yumbased.py
genpkgmetadata.py

index 9c9659d67460d1ff5d754c79221bd69f55a8fb9c..93d094a4abe37765738c5ec50dcb438dc44a0d86 100644 (file)
@@ -913,7 +913,6 @@ class MetaDataSqlite(object):
         self.file_cx = sqlite.Connection(self.file_sqlite_file)
         self.other_sqlite_file = os.path.join(destdir, 'other.sqlite')
         self.other_cx = sqlite.Connection(self.other_sqlite_file)
-
         self.primary_cursor = self.pri_cx.cursor()
 
         self.filelists_cursor = self.file_cx.cursor()
@@ -927,8 +926,8 @@ class MetaDataSqlite(object):
     def create_primary_db(self):
         # make the tables
         schema = [
-        """PRAGMA synchronous = 0;""",
-        """pragma locking_mode = EXCLUSIVE;""",
+        """PRAGMA synchronous="OFF";""",
+        """pragma locking_mode="EXCLUSIVE";""",
         """CREATE TABLE conflicts (  name TEXT,  flags TEXT,  epoch TEXT,  version TEXT,  release TEXT,  pkgKey INTEGER );""",
         """CREATE TABLE db_info (dbversion INTEGER, checksum TEXT);""",
         """CREATE TABLE files (  name TEXT,  type TEXT,  pkgKey INTEGER);""",
@@ -961,8 +960,8 @@ class MetaDataSqlite(object):
 
     def create_filelists_db(self):
         schema = [
-            """PRAGMA synchronous = 0;""",
-            """pragma locking_mode = EXCLUSIVE;""",
+            """PRAGMA synchronous="0FF";""",
+            """pragma locking_mode="EXCLUSIVE";""",
             """CREATE TABLE db_info (dbversion INTEGER, checksum TEXT);""",
             """CREATE TABLE filelist (  pkgKey INTEGER,  dirname TEXT,  filenames TEXT,  filetypes TEXT);""",
             """CREATE TABLE packages (  pkgKey INTEGER PRIMARY KEY,  pkgId TEXT);""",
@@ -980,8 +979,8 @@ class MetaDataSqlite(object):
         
     def create_other_db(self):
         schema = [
-            """PRAGMA synchronous = 0;""",
-            """pragma locking_mode = EXCLUSIVE;""",
+            """PRAGMA synchronous="OFF";""",
+            """pragma locking_mode="EXCLUSIVE";""",
             """CREATE TABLE changelog (  pkgKey INTEGER,  author TEXT,  date INTEGER,  changelog TEXT);""",
             """CREATE TABLE db_info (dbversion INTEGER, checksum TEXT);""",
             """CREATE TABLE packages (  pkgKey INTEGER PRIMARY KEY,  pkgId TEXT);""",
index f5f9ab967bc12cc3ad0dfa4268c853eb8b572717..6c462c64e936aa425743308ee0b158214cea61b9 100644 (file)
@@ -438,7 +438,14 @@ class CreateRepoPackage(YumLocalPackage):
         q = """insert into packages values (?, ?, ?, ?, ?, ?,
                ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?, ?, ?, ?, ?, 
                ?, ?, ?)"""
-
+        
+        # write out all of do_primary_sqlite as an executescript - work on the 
+        # quoting for pretty much any contingency - take from sqlutils.py
+        # 
+        # e
+        #p = None
+        #q = """insert into packages values (%s, %s, %s, %s, """
+        
         cur.execute(q, p)
 
         # provides, obsoletes, conflicts        
@@ -541,6 +548,7 @@ class CreateRepoPackage(YumLocalPackage):
         md_sqlite.file_cx.commit()
         self.do_other_sqlite_dump(md_sqlite.other_cursor)
         md_sqlite.other_cx.commit()
+
         
         
         
index b12b8682fb8c12603331e5bf4bab9a399a17e493..2d30dd6e4ef8281da3f8262f0e8e5699ba586752 100755 (executable)
@@ -22,6 +22,7 @@ import os
 import sys
 import re
 from optparse import OptionParser
+import time
 
 import createrepo
 from createrepo import MDError
@@ -144,9 +145,13 @@ class MDCallBack(object):
         sys.stdout.flush()
         
 def main(args):
+    start_st = time.time()
     conf = createrepo.MetaDataConfig()
     conf = parseArgs(args, conf)
+    if conf.verbose:
+        print ('start time: %0.3f' % (time.time() - start_st))
 
+    mid_st = time.time()       
     try:
         if conf.split:
             mdgen = createrepo.SplitMetaDataGenerator(config_obj=conf, callback=MDCallBack())
@@ -157,9 +162,22 @@ def main(args):
                     print _('repo is up to date')
                 sys.exit(0)
 
+        if conf.verbose:
+            print ('mid time: %0.3f' % (time.time() - mid_st))
+                
+        pm_st = time.time()
         mdgen.doPkgMetadata()
+        if conf.verbose:
+            print ('pm time: %0.3f' % (time.time() - pm_st))
+        rm_st = time.time()
         mdgen.doRepoMetadata()
+        if conf.verbose:
+            print ('rm time: %0.3f' % (time.time() - rm_st))
+        fm_st = time.time()       
         mdgen.doFinalMove()
+        if conf.verbose:
+            print ('fm time: %0.3f' % (time.time() - fm_st))
+        
         
     except MDError, e:
         errorprint(_('%s') % e)