summaryrefslogtreecommitdiff
path: root/portato
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--portato/db/eix_sql.py4
-rw-r--r--portato/db/sql.py16
2 files changed, 19 insertions, 1 deletions
diff --git a/portato/db/eix_sql.py b/portato/db/eix_sql.py
index 3a0c6e9..c2d2292 100644
--- a/portato/db/eix_sql.py
+++ b/portato/db/eix_sql.py
@@ -49,6 +49,10 @@ class EixSQLDatabase (SQLDatabase):
return old < mtime
+ def generate_cat_expr (self, cat):
+ # be a noop
+ return cat
+
@SQLDatabase.con
def populate (self, category = None, connection = None):
inst = set(system.find_packages(pkgSet = system.SET_INSTALLED, key = category, with_version = False))
diff --git a/portato/db/sql.py b/portato/db/sql.py
index e79a27d..fbc01e6 100644
--- a/portato/db/sql.py
+++ b/portato/db/sql.py
@@ -213,12 +213,26 @@ class SQLDatabase (Database):
for cat in l:
yield cat["cat"]
+ def generate_cat_expr (self, cat):
+ """
+ Generates an expression from a category name to match all packages of the category.
+
+ E.g. as SQLDatabase uses regexps internally, return cat/*
+
+ @param cat: the category
+ @type cat: string
+
+ @returns: expression
+ """
+
+ return cat+"/*"
+
@con
def reload (self, cat = None, connection = None):
if cat:
connection.execute("DELETE FROM packages WHERE cat = ?", (cat,))
connection.commit()
- self.populate(cat+"/*", connection = connection)
+ self.populate(self.generate_cat_expr(cat), connection = connection)
else:
connection.execute("DELETE FROM packages")
connection.commit()