[Yum-devel] RFD - Change sqlite schema to preserve requires pre attribute
Paul Nasrat
pnasrat at redhat.com
Wed Jun 28 15:24:56 UTC 2006
We have pre= on some requires but don't capture that within the sqlite
cache. I'd like to suggest a schema change to requires table of primary
to add this:
CREATE TABLE requires (
name TEXT,
flags TEXT,
epoch TEXT,
version TEXT,
release TEXT,
pkgKey TEXT ,
pre BOOL DEFAULT FALSE);
Obviously both the python and the C metadata parsers would need to be
adjusted to work with this. A patch to make the python cache code do
this follows. Does this seem reasonable?
yum/primary.xml
Index: yum/sqlitecache.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/sqlitecache.py,v
retrieving revision 1.12
diff -u -u -r1.12 sqlitecache.py
--- yum/sqlitecache.py 23 Jun 2006 14:26:17 -0000 1.12
+++ yum/sqlitecache.py 28 Jun 2006 15:19:55 -0000
@@ -29,7 +29,7 @@
# This version refers to the internal structure of the sqlite cache
files
# increasing this number forces all caches of a lower version number
# to be re-generated
-dbversion = '7'
+dbversion = '8'
class RepodataParserSqlite:
def __init__(self, storedir, repoid, callback=None):
@@ -168,14 +168,17 @@
# Create requires, provides, conflicts and obsoletes tables
# to store prco data
for t in ('requires','provides','conflicts','obsoletes'):
+ extraCol = ""
+ if t == 'requires':
+ extraCol= ", pre BOOL DEFAULT FALSE"
cur.execute("""CREATE TABLE %s (
name TEXT,
flags TEXT,
epoch TEXT,
version TEXT,
release TEXT,
- pkgKey TEXT)
- """ % (t))
+ pkgKey TEXT %s)
+ """ % (t, extraCol))
# Create the files table to hold all the file information
cur.execute("""CREATE TABLE files (
name TEXT,
@@ -266,6 +269,9 @@
'version': entry.get('ver'),
'release': entry.get('rel'),
}
+ if ptype == 'requires' and entry.has_key('pre'):
+ if entry.get('pre'):
+ data['pre'] = True
self.insertHash(ptype,data,cur)
# Now store all file information
More information about the Yum-devel
mailing list