import pakfire.packages as packages
from pakfire.constants import *
+from pakfire.errors import *
from pakfire.i18n import _
class Cursor(sqlite3.Cursor):
Database.__init__(self, pakfire, filename)
+ def initialize(self):
+ # Open the database.
+ self.open()
+
# Check if we actually can open the database.
if not self.format in DATABASE_FORMATS_SUPPORTED:
raise DatabaseFormatError, _("The format of the database is not supported by this version of pakfire.")
if self.format < 5:
c.execute("ALTER TABLE files ADD COLUMN datafile INTEGER AFTER config")
+ if self.format < 6:
+ c.execute("ALTER TABLE packages ADD COLUMN inst_size INTEGER AFTER size")
+
# In the end, we can easily update the version of the database.
c.execute("UPDATE settings SET val = ? WHERE key = 'version'", (DATABASE_FORMAT,))
self.__format = DATABASE_FORMAT
groups,
filename,
size,
+ inst_size,
hash1,
provides,
requires,
installed,
repository,
reason
- ) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""",
+ ) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""",
(
pkg.name,
pkg.epoch,
" ".join(pkg.groups),
pkg.filename,
pkg.size,
+ pkg.inst_size,
pkg.hash1,
"\n".join(pkg.provides),
"\n".join(pkg.requires),