FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

 
 
LinkBack Thread Tools
 
Old 06-08-2011, 07:51 AM
Dan McGee
 
Default Add an alpm_db_valid public function

Signed-off-by: Dan McGee <dan@archlinux.org>
---
lib/libalpm/alpm.h | 8 ++++++++
lib/libalpm/db.c | 7 +++++++
2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index 1e1bfdd..329ffd7 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -307,6 +307,14 @@ const char *alpm_db_get_name(const pmdb_t *db);
*/
const char *alpm_db_get_url(const pmdb_t *db);

+/** Check the validity of a database.
+ * This is most useful for sync databases and verifying signature status.
+ * If invalid, the handle error code will be set accordingly.
+ * @param db pointer to the package database
+ * @return 0 if valid, -1 if invalid (pm_errno is set accordingly)
+ */
+int alpm_db_valid(pmdb_t *db);
+
/** @name Accessors to the list of servers for a database.
* @{
*/
diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c
index 508870f..e740acb 100644
--- a/lib/libalpm/db.c
+++ b/lib/libalpm/db.c
@@ -245,6 +245,13 @@ const char SYMEXPORT *alpm_db_get_url(const pmdb_t *db)
return url;
}

+/** Check the validity of a database. */
+int SYMEXPORT alpm_db_valid(pmdb_t *db)
+{
+ ASSERT(db != NULL, return -1);
+ db->handle->pm_errno = 0;
+ return db->ops->validate(db);
+}

/** Get a package entry from a package database. */
pmpkg_t SYMEXPORT *alpm_db_get_pkg(pmdb_t *db, const char *name)
--
1.7.5.2
 

Thread Tools




All times are GMT. The time now is 05:56 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org