Function alpm_sys::alpm_db_update
source · pub unsafe extern "C" fn alpm_db_update(
handle: *mut alpm_handle_t,
dbs: *mut alpm_list_t,
force: c_int
) -> c_int
Expand description
Update package databases.
An update of the package databases in the list \a dbs will be attempted. Unless \a force is true, the update will only be performed if the remote databases were 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: @code alpm_list_t *dbs = alpm_get_syncdbs(config->handle); ret = alpm_db_update(config->handle, dbs, force); if(ret < 0) { pm_printf(ALPM_LOG_ERROR, _(“failed to synchronize all databases (%s)\n”), alpm_strerror(alpm_errno(config->handle))); } @endcode
@note After a successful update, the \link alpm_db_get_pkgcache() package cache \endlink will be invalidated @param handle the context handle @param dbs list of package databases to update @param force if true, then forces the update, otherwise update only in case the databases aren’t up to date @return 0 on success, -1 on error (pm_errno is set accordingly), 1 if all databases are up to to date