[yum-cvs] yum/yum repos.py, 1.66, 1.67 sqlitecache.py, 1.5, 1.6 sqlitesack.py, 1.9, 1.10

Gijs Hollestelle gijs at login.linux.duke.edu
Wed Mar 2 20:07:40 UTC 2005


Update of /home/groups/yum/cvs/yum/yum
In directory login:/tmp/cvs-serv27016/yum

Modified Files:
	repos.py sqlitecache.py sqlitesack.py 
Log Message:
- No longer subclass RepodataParserSqlite from mdcache.
- Report repo id while caching
- Update TODOs


Index: repos.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/repos.py,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -r1.66 -r1.67
--- repos.py	25 Feb 2005 19:30:23 -0000	1.66
+++ repos.py	2 Mar 2005 20:07:37 -0000	1.67
@@ -212,7 +212,7 @@
         for repo in myrepos:
             if not hasattr(repo, 'cacheHandler'):
                 if (self.sqlite):
-                    repo.cacheHandler = self.sqlitecache.RepodataParserSqlite(storedir=repo.cachedir, callback=callback)
+                    repo.cacheHandler = self.sqlitecache.RepodataParserSqlite(storedir=repo.cachedir, repoid=repo.id, callback=callback)
                 else:
                     repo.cacheHandler = mdcache.RepodataParser(storedir=repo.cachedir, callback=callback)
             for item in data:

Index: sqlitecache.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/sqlitecache.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- sqlitecache.py	2 Mar 2005 14:24:57 -0000	1.5
+++ sqlitecache.py	2 Mar 2005 20:07:37 -0000	1.6
@@ -19,13 +19,12 @@
 # TODO
 # - Add support for multiple checksums per rpm (is this required??)
 # - Store filetypes as one char per type instead of a string
-# - display the name of the repository when caching metadata
 # - don't use print for output, use yum's output functions instead
-# - Move the stuff that turns a list of files into a string into a helper
-#   unit
+# - Move the stuff that turns a list of files into a string into a helper unit
+# - Don't fall back to a memory sqlite cache but to pickles if a cache
+#   file can't be created.
 
 import os
-import mdcache
 import sqlite
 import time
 import mdparser
@@ -35,12 +34,18 @@
 # to be re-generated
 dbversion = '5'
 
-# TODO
-# We probably don't really need to subclass RepodataParser anymore, just use
-# the same interface. sqlitecache.py and mdparser.py combined replaces all the
-# functionality from mdcache.py. We should aim for removal of mdcache.py.
-class RepodataParserSqlite(mdcache.RepodataParser):
-    
+class RepodataParserSqlite:
+    def __init__(self, storedir, repoid, callback=None):
+        self.storedir = storedir
+        self.callback = callback
+        self.repodata = {
+            'metadata': {},
+            'filelists': {},
+            'otherdata': {}
+        }
+        self.repoid = repoid
+        self.debug = 0
+
     def loadCache(self,filename):
         """Load cache from filename, check if it is valid and that dbversion 
         matches the required dbversion"""
@@ -221,11 +226,6 @@
 
         # Try to create the databse in filename, or use in memory when
         # this fails
-        # TODO in memory sqlite probably is not worth the overhead of creating
-        # the database, maybe we should fall back to using old skool pickle
-        # caches if this fails, i.e. raise some exception that yum
-        # will catch and will cause it to fall back to non-sqlite for
-        # this repo
         try:
             f = open(filename,'w')
             db = sqlite.connect(filename) 
@@ -343,7 +343,7 @@
         for package in parser:
 
             if self.callback is not None:
-                self.callback(parser.count, parser.total, "Caching")
+                self.callback(parser.count, parser.total, self.repoid)
 
             pkgId = package['pkgId']
             all_pkgIds[pkgId] = 1

Index: sqlitesack.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/sqlitesack.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- sqlitesack.py	2 Mar 2005 16:55:21 -0000	1.9
+++ sqlitesack.py	2 Mar 2005 20:07:37 -0000	1.10
@@ -331,7 +331,7 @@
         # If naTup is set do it from the database otherwise use our parent's
         # returnNewestByNameArch
         if (not naTup):
-            # TODO process obsoletes here
+            # TODO process excludes here
             return repos.YumPackageSack.returnNewestByNameArch(self, naTup)
 
         # First find all packages that fulfill naTup




More information about the Yum-cvs-commits mailing list