summaryrefslogtreecommitdiff
path: root/lib/libalpm/be_local.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-06-07 20:42:15 -0500
committerDan McGee <dan@archlinux.org>2011-06-24 03:46:12 -0500
commit79e98316ea89486d107466858543e965bcfbb0a9 (patch)
treee22572124cffc7275a200e4964c4ea112457fa52 /lib/libalpm/be_local.c
parent1150d9e15aaea2ae1f259995d11442f491ef0af7 (diff)
downloadpacman-79e98316ea89486d107466858543e965bcfbb0a9.tar.xz
Add a 'valid' flag to the database object
Start by converting all of our flags to a 'status' bitmask (pkgcache status, grpcache status). Add a new 'valid' flag as well. This will let us keep track if the database itself has been marked valid in whatever fashion. For local databases at the moment we ensure there are no depends files; for sync databases we ensure the PGP signature is valid if required/requested. The loading of the pkgcache is prohibited if the database is invalid. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/be_local.c')
-rw-r--r--lib/libalpm/be_local.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c
index 0ff51deb..96f04c51 100644
--- a/lib/libalpm/be_local.c
+++ b/lib/libalpm/be_local.c
@@ -321,6 +321,10 @@ static int local_db_validate(pmdb_t *db)
DIR *dbdir;
int ret = -1;
+ if(db->status & DB_STATUS_VALID) {
+ return 0;
+ }
+
dbpath = _alpm_db_path(db);
if(dbpath == NULL) {
RET_ERR(db->handle, PM_ERR_DB_OPEN, -1);
@@ -329,6 +333,7 @@ static int local_db_validate(pmdb_t *db)
if(dbdir == NULL) {
if(errno == ENOENT) {
/* database dir doesn't exist yet */
+ db->status |= DB_STATUS_VALID;
return 0;
} else {
RET_ERR(db->handle, PM_ERR_DB_OPEN, -1);
@@ -354,6 +359,7 @@ static int local_db_validate(pmdb_t *db)
}
}
/* we found no depends file after full scan */
+ db->status |= DB_STATUS_VALID;
ret = 0;
done: