mirror of
https://github.com/moparisthebest/pacman
synced 2024-11-13 12:55:08 -05:00
Add an alpm_db_get_valid() public function
This allows one to check if a database is valid or invalid. Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
6633b8e5c2
commit
68284da0d7
@ -382,6 +382,14 @@ int alpm_db_unregister_all(alpm_handle_t *handle);
|
||||
*/
|
||||
const char *alpm_db_get_name(const alpm_db_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_get_valid(alpm_db_t *db);
|
||||
|
||||
/** @name Accessors to the list of servers for a database.
|
||||
* @{
|
||||
*/
|
||||
|
@ -915,6 +915,7 @@ int _alpm_local_db_remove(alpm_db_t *db, alpm_pkg_t *info)
|
||||
}
|
||||
|
||||
struct db_operations local_db_ops = {
|
||||
.validate = local_db_validate,
|
||||
.populate = local_db_populate,
|
||||
.unregister = _alpm_db_unregister,
|
||||
};
|
||||
|
@ -580,6 +580,7 @@ error:
|
||||
}
|
||||
|
||||
struct db_operations sync_db_ops = {
|
||||
.validate = sync_db_validate,
|
||||
.populate = sync_db_populate,
|
||||
.unregister = _alpm_db_unregister,
|
||||
};
|
||||
|
@ -219,6 +219,14 @@ const char SYMEXPORT *alpm_db_get_name(const alpm_db_t *db)
|
||||
return db->treename;
|
||||
}
|
||||
|
||||
/** Check the validity of a database. */
|
||||
int SYMEXPORT alpm_db_get_valid(alpm_db_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. */
|
||||
alpm_pkg_t SYMEXPORT *alpm_db_get_pkg(alpm_db_t *db, const char *name)
|
||||
{
|
||||
|
@ -51,6 +51,7 @@ enum _alpm_dbstatus_t {
|
||||
};
|
||||
|
||||
struct db_operations {
|
||||
int (*validate) (alpm_db_t *);
|
||||
int (*populate) (alpm_db_t *);
|
||||
void (*unregister) (alpm_db_t *);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user