libalpm
Arch Linux Package Manager Library
|
Functions to query and manipulate the database of libalpm. More...
Functions | |
int | alpm_db_update (int force, alpm_db_t *db) |
Update a package database. | |
alpm_db_t * | alpm_db_register_sync (alpm_handle_t *handle, const char *treename, alpm_siglevel_t level) |
Register a sync database of packages. | |
void | _alpm_db_unregister (alpm_db_t *db) |
int | alpm_db_unregister_all (alpm_handle_t *handle) |
Unregister all package databases. | |
int | alpm_db_unregister (alpm_db_t *db) |
Unregister a package database. | |
alpm_list_t * | alpm_db_get_servers (const alpm_db_t *db) |
Get the serverlist of a database. | |
int | alpm_db_set_servers (alpm_db_t *db, alpm_list_t *servers) |
Set the serverlist of a database. | |
int | alpm_db_add_server (alpm_db_t *db, const char *url) |
Add a download server to a database. | |
int | alpm_db_remove_server (alpm_db_t *db, const char *url) |
Remove a download server from a database. | |
const char * | alpm_db_get_name (const alpm_db_t *db) |
Get the name of a package database. | |
alpm_siglevel_t | alpm_db_get_siglevel (alpm_db_t *db) |
Get the signature verification level for a database. | |
int | alpm_db_get_valid (alpm_db_t *db) |
Check the validity of a database. | |
alpm_pkg_t * | alpm_db_get_pkg (alpm_db_t *db, const char *name) |
Get a package entry from a package database. | |
alpm_list_t * | alpm_db_get_pkgcache (alpm_db_t *db) |
Get the package cache of a package database. | |
alpm_group_t * | alpm_db_readgroup (alpm_db_t *db, const char *name) |
Get a group entry from a package database. | |
alpm_list_t * | alpm_db_get_groupcache (alpm_db_t *db) |
Get the group cache of a package database. | |
alpm_list_t * | alpm_db_search (alpm_db_t *db, const alpm_list_t *needles) |
Searches a database. | |
int | alpm_db_set_pkgreason (alpm_handle_t *handle, alpm_pkg_t *pkg, alpm_pkgreason_t reason) |
Set install reason for a package in db. |
Functions to query and manipulate the database of libalpm.
void _alpm_db_unregister | ( | alpm_db_t * | db | ) |
Definition at line 60 of file db.c.
References _alpm_db_free(), _alpm_log(), ALPM_LOG_DEBUG, __alpm_db_t::handle, and __alpm_db_t::treename.
int alpm_db_add_server | ( | alpm_db_t * | db, |
const char * | url | ||
) |
Add a download server to a database.
db | database pointer |
url | url of the server |
Definition at line 162 of file db.c.
References _alpm_log(), ALPM_ERR_WRONG_ARGS, alpm_list_add(), ALPM_LOG_DEBUG, ASSERT, __alpm_db_t::handle, __alpm_handle_t::pm_errno, RET_ERR, __alpm_db_t::servers, and __alpm_db_t::treename.
alpm_list_t* alpm_db_get_groupcache | ( | alpm_db_t * | db | ) |
Get the group cache of a package database.
Definition at line 275 of file db.c.
References _alpm_db_get_groupcache(), ASSERT, __alpm_db_t::handle, and __alpm_handle_t::pm_errno.
const char* alpm_db_get_name | ( | const alpm_db_t * | db | ) |
Get the name of a package database.
Definition at line 214 of file db.c.
References ASSERT, and __alpm_db_t::treename.
Referenced by check_syncdbs(), dump_pkg_full(), print_packages(), and select_display().
alpm_pkg_t* alpm_db_get_pkg | ( | alpm_db_t * | db, |
const char * | name | ||
) |
Get a package entry from a package database.
Definition at line 240 of file db.c.
References _alpm_db_get_pkgfromcache(), ALPM_ERR_PKG_NOT_FOUND, ALPM_ERR_WRONG_ARGS, ASSERT, __alpm_db_t::handle, __alpm_handle_t::pm_errno, and RET_ERR.
Referenced by display_targets(), pacman_database(), and pacman_query().
alpm_list_t* alpm_db_get_pkgcache | ( | alpm_db_t * | db | ) |
Get the package cache of a package database.
Definition at line 256 of file db.c.
References _alpm_db_get_pkgcache(), ASSERT, __alpm_db_t::handle, and __alpm_handle_t::pm_errno.
Referenced by pacman_deptest(), and pacman_query().
alpm_list_t* alpm_db_get_servers | ( | const alpm_db_t * | db | ) |
Get the serverlist of a database.
Definition at line 129 of file db.c.
References ASSERT, and __alpm_db_t::servers.
Get the signature verification level for a database.
Definition at line 221 of file db.c.
References ALPM_SIG_USE_DEFAULT, ASSERT, __alpm_db_t::handle, __alpm_db_t::siglevel, and __alpm_handle_t::siglevel.
Referenced by alpm_db_update().
int alpm_db_get_valid | ( | alpm_db_t * | db | ) |
Check the validity of a database.
Definition at line 232 of file db.c.
References ASSERT, __alpm_db_t::handle, __alpm_db_t::ops, __alpm_handle_t::pm_errno, and db_operations::validate.
Referenced by check_syncdbs().
alpm_group_t* alpm_db_readgroup | ( | alpm_db_t * | db, |
const char * | name | ||
) |
Get a group entry from a package database.
Definition at line 264 of file db.c.
References _alpm_db_get_groupfromcache(), ALPM_ERR_WRONG_ARGS, ASSERT, __alpm_db_t::handle, __alpm_handle_t::pm_errno, and RET_ERR.
Referenced by alpm_find_group_pkgs().
alpm_db_t* alpm_db_register_sync | ( | alpm_handle_t * | handle, |
const char * | treename, | ||
alpm_siglevel_t | level | ||
) |
Register a sync database of packages.
Definition at line 46 of file db.c.
References _alpm_db_register_sync(), ALPM_ERR_TRANS_NOT_NULL, ALPM_ERR_WRONG_ARGS, ASSERT, CHECK_HANDLE, RET_ERR, and __alpm_handle_t::trans.
int alpm_db_remove_server | ( | alpm_db_t * | db, |
const char * | url | ||
) |
Remove a download server from a database.
db | database pointer |
url | url of the server |
Definition at line 188 of file db.c.
References _alpm_log(), ALPM_ERR_WRONG_ARGS, alpm_list_remove_str(), ALPM_LOG_DEBUG, ASSERT, __alpm_db_t::handle, __alpm_handle_t::pm_errno, RET_ERR, __alpm_db_t::servers, and __alpm_db_t::treename.
alpm_list_t* alpm_db_search | ( | alpm_db_t * | db, |
const alpm_list_t * | needles | ||
) |
Searches a database.
Searches a database with regular expressions.
Definition at line 284 of file db.c.
References _alpm_db_search(), ASSERT, __alpm_db_t::handle, and __alpm_handle_t::pm_errno.
int alpm_db_set_pkgreason | ( | alpm_handle_t * | handle, |
alpm_pkg_t * | pkg, | ||
alpm_pkgreason_t | reason | ||
) |
Set install reason for a package in db.
Definition at line 293 of file db.c.
References _alpm_local_db_write(), _alpm_log(), ALPM_ERR_DB_WRITE, ALPM_ERR_WRONG_ARGS, ALPM_LOG_DEBUG, alpm_pkg_get_reason(), ASSERT, CHECK_HANDLE, __alpm_pkg_t::db, __alpm_handle_t::db_local, INFRQ_DESC, __alpm_pkg_t::name, __alpm_pkg_t::origin, __alpm_pkg_t::origin_data, PKG_FROM_LOCALDB, __alpm_pkg_t::reason, and RET_ERR.
Referenced by pacman_database().
int alpm_db_set_servers | ( | alpm_db_t * | db, |
alpm_list_t * | servers | ||
) |
Set the serverlist of a database.
Definition at line 136 of file db.c.
References ASSERT, FREELIST, and __alpm_db_t::servers.
int alpm_db_unregister | ( | alpm_db_t * | db | ) |
Unregister a package database.
Definition at line 92 of file db.c.
References _alpm_db_cmp(), ALPM_ERR_DB_NOT_FOUND, ALPM_ERR_TRANS_NOT_NULL, alpm_list_remove(), ASSERT, __alpm_handle_t::db_local, __alpm_handle_t::dbs_sync, handle, __alpm_db_t::handle, __alpm_db_t::ops, __alpm_handle_t::pm_errno, RET_ERR, __alpm_handle_t::trans, and db_operations::unregister.
int alpm_db_unregister_all | ( | alpm_handle_t * | handle | ) |
Unregister all package databases.
Definition at line 71 of file db.c.
References ALPM_ERR_TRANS_NOT_NULL, ASSERT, CHECK_HANDLE, __alpm_list_t::data, __alpm_handle_t::dbs_sync, FREELIST, __alpm_list_t::next, __alpm_db_t::ops, RET_ERR, __alpm_handle_t::trans, and db_operations::unregister.
Referenced by alpm_release().
int alpm_db_update | ( | int | force, |
alpm_db_t * | db | ||
) |
Update a package database.
An update of the package database db will be attempted. Unless force is true, the update will only be performed if the remote database was modified since the last update.
This operation requires a database lock, and will return an applicable error if the lock could not be obtained.
Example:
alpm_list_t *syncs = alpm_option_get_syncdbs(); for(i = syncs; i; i = alpm_list_next(i)) { alpm_db_t *db = alpm_list_getdata(i); result = alpm_db_update(0, db); if(result < 0) { printf("Unable to update database: %s\n", alpm_strerrorlast()); } else if(result == 1) { printf("Database already up to date\n"); } else { printf("Database updated\n"); } }
force | if true, then forces the update, otherwise update only in case the database isn't up to date |
db | pointer to the package database to update |
Definition at line 169 of file be_sync.c.
References _, _alpm_db_free_pkgcache(), _alpm_db_path(), _alpm_dload_payload_reset(), _alpm_download(), _alpm_handle_lock(), _alpm_handle_unlock(), _alpm_log(), _alpm_sigpath(), alpm_db_get_siglevel(), ALPM_ERR_HANDLE_LOCK, ALPM_ERR_MEMORY, ALPM_ERR_SERVER_NONE, ALPM_ERR_WRONG_ARGS, ALPM_LOG_DEBUG, ALPM_LOG_WARNING, ALPM_SIG_DATABASE_OPTIONAL, alpm_strerror(), ASSERT, __alpm_list_t::data, __alpm_handle_t::db_local, DB_STATUS_EXISTS, DB_STATUS_INVALID, DB_STATUS_MISSING, DB_STATUS_VALID, dload_payload::errors_ok, dload_payload::fileurl, dload_payload::force, dload_payload::handle, handle, __alpm_db_t::handle, __alpm_handle_t::lockfile, MALLOC, dload_payload::max_size, __alpm_list_t::next, __alpm_handle_t::pm_errno, RET_ERR, __alpm_db_t::servers, __alpm_db_t::status, __alpm_db_t::treename, and dload_payload::unlink_on_fail.