aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dbgenerator/backend.py10
-rw-r--r--dbgenerator/core.py19
-rw-r--r--dbgenerator/database.py38
3 files changed, 56 insertions, 11 deletions
diff --git a/dbgenerator/backend.py b/dbgenerator/backend.py
index df3c577..bdd8691 100644
--- a/dbgenerator/backend.py
+++ b/dbgenerator/backend.py
@@ -136,7 +136,15 @@ class domain_repo_interface:
category, package, "ChangeLog")
mtime = file_mtime(filename)
sha1 = file_sha1(filename)
- return ( mtime, sha1)
+ return (mtime, sha1)
+
+ def get_manifest_meta(self, (category, package)):
+ """Return the Manifest mtime and SHA1"""
+ filename = pjoin(self.current_repo.location,
+ category, package, "Manifest")
+ mtime = file_mtime(filename)
+ sha1 = file_sha1(filename)
+ return (mtime, sha1)
def get_changelog(self, (category, package)):
"""Return the changelog contents"""
diff --git a/dbgenerator/core.py b/dbgenerator/core.py
index 2dc048d..d96a042 100644
--- a/dbgenerator/core.py
+++ b/dbgenerator/core.py
@@ -60,13 +60,16 @@ def process_metadata(backend, database, cat, pn):
full_changelog = backend.get_changelog((cat, pn))
changelog = latest_changelog(full_changelog)
- (mtime, sha1) = backend.get_changelog_meta((cat, pn))
+ (changelog_mtime, changelog_sha1) = backend.get_changelog_meta((cat, pn))
+ (manifest_mtime, manifest_sha1) = backend.get_manifest_meta((cat, pn))
#store metadata
database.add_metadata(cat, pn,
description, homepage,
pkglicense, changelog,
- mtime, sha1)
+ changelog_mtime, changelog_sha1,
+ manifest_mtime, manifest_sha1
+ )
def cleanup_database(database, old_cps, old_cpvs):
for cpi in old_cps:
@@ -103,10 +106,18 @@ def main():
# Check for the changelog changing
(changelog_mtime, changelog_sha1) = \
backend.get_changelog_meta((cat, pn))
+ (manifest_mtime, manifest_sha1) = \
+ backend.get_manifest_meta((cat, pn))
(dummy, changelog_mtime_old, changelog_sha1_old) = \
database.get_changelog(cat, pn)
- if changelog_mtime == changelog_mtime_old and \
- changelog_sha1 == changelog_sha1_old:
+ (manifest_mtime_old, manifest_sha1_old) = \
+ database.get_manifest(cat, pn)
+ if (manifest_mtime_old <= 0 and \
+ changelog_mtime == changelog_mtime_old and \
+ changelog_sha1 == changelog_sha1_old) \
+ or (False and manifest_mtime_old > 0 and \
+ manifest_mtime == manifest_mtime_old and \
+ manifest_sha1 == manifest_sha1_old):
if cpi and cpi in old_cps:
old_cps.discard(cpi)
old_cpvs.difference_update(database.child_cpv(cpi))
diff --git a/dbgenerator/database.py b/dbgenerator/database.py
index 57f5533..08e6cd1 100644
--- a/dbgenerator/database.py
+++ b/dbgenerator/database.py
@@ -29,7 +29,7 @@ class SQLPackageDatabase(object):
arches = frozenset(ConstData.arches['all'])
# If you change the database structure below, you should
# increment this number
- schema_version = 71
+ schema_version = 72
# These are used to cache the various relations and
# avoid more SELECT queries just to find the relations.
@@ -76,8 +76,11 @@ class SQLPackageDatabase(object):
changelog TEXT,
changelog_mtime INT,
changelog_sha1 CHAR(40),
+ manifest_mtime INT,
+ manifest_sha1 CHAR(40),
PRIMARY KEY (cp),
- INDEX (changelog_mtime)
+ INDEX (changelog_mtime),
+ INDEX (manifest_mtime)
)"""
sql['CREATE_versions'] = """
CREATE TABLE versions (
@@ -222,13 +225,18 @@ class SQLPackageDatabase(object):
sql['INSERT_metadata'] = """
INSERT INTO metadata
(cp, homepage, description, license,
- changelog, changelog_mtime, changelog_sha1)
+ changelog, changelog_mtime, changelog_sha1,
+ manifest_mtime, manifest_sha1
+ )
VALUES
- (?, ?, ?, ?, ?, ?, ?)
+ (?, ?, ?, ?, ?, ?, ?, ?, ?)
"""
def add_metadata(self, category, pn,
description, homepage, pkglicense,
- changelog, changelog_mtime, changelog_sha1):
+ changelog,
+ changelog_mtime, changelog_sha1,
+ manifest_mtime, manifest_sha1
+ ):
"""Replace the metadata for the CP with new metadata"""
cp = self.find_cp(category, pn)
if cp is None:
@@ -238,7 +246,8 @@ class SQLPackageDatabase(object):
self.del_metadata(cp)
sql = self.sql['INSERT_metadata']
params = (cp, homepage, description, str(pkglicense),
- changelog, changelog_mtime, changelog_sha1)
+ changelog, changelog_mtime, changelog_sha1,
+ manifest_mtime, manifest_sha1)
self.cursor.execute(sql, params)
self.db.commit()
@@ -258,6 +267,23 @@ class SQLPackageDatabase(object):
if row:
result = (unicode(row[0]), int(row[1]), str(row[2]))
return result
+
+ sql['SELECT_get_manifest'] = """
+ SELECT manifest_mtime, manifest_sha1
+ FROM metadata
+ WHERE cp = ?
+ """
+ def get_manifest(self, cat, pn):
+ cp = self.find_cp(cat, pn)
+ result = (-1, None)
+ if cp is None:
+ return result
+ sql = self.sql['SELECT_get_manifest']
+ self.cursor.execute(sql, (cp, ))
+ row = self.cursor.fetchone()
+ if row:
+ result = (int(row[1]), str(row[2]))
+ return result
sql['INSERT_versions'] = """
INSERT INTO versions