createrepo/__init__.py createrepo/yumbased.py genpkgmetadata.py

[email protected] (Seth Vidal)
Newsgroups gmane.linux.rpm.metadata
Message-ID <[email protected]>
 createrepo/__init__.py |   13 ++++++-------
 createrepo/yumbased.py |   10 +++++++++-
 genpkgmetadata.py      |   18 ++++++++++++++++++
 3 files changed, 33 insertions(+), 8 deletions(-)

New commits:
commit b236034609f70cd7cf1c3178e119c1405343953f
Author: Seth Vidal <[email protected]>
Date:   Thu Jun 5 12:06:04 2008 -0400

    some fixmes and starts - and recommit a working --database-only

diff --git a/createrepo/__init__.py b/createrepo/__init__.py
index 9c9659d..93d094a 100644
--- a/createrepo/__init__.py
+++ b/createrepo/__init__.py
@@ -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);""",
diff --git a/createrepo/yumbased.py b/createrepo/yumbased.py
index f5f9ab9..6c462c6 100644
--- a/createrepo/yumbased.py
+++ b/createrepo/yumbased.py
@@ -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()
+
         
         
         
diff --git a/genpkgmetadata.py b/genpkgmetadata.py
index b12b868..2d30dd6 100755
--- a/genpkgmetadata.py
+++ b/genpkgmetadata.py
@@ -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)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.