From 63fc93607b3fb9950f927d0533742f0e1fc37dd0 Mon Sep 17 00:00:00 2001 From: Sebastian Nowicki Date: Thu, 9 Apr 2009 13:42:14 +0800 Subject: [PATCH] Add detail documentation for alpm_db_update() This adds alpm_db_update() to the alpm_databases Doxygen group. The function is described in more detail and a code example is given. Signed-off-by: Dan McGee --- lib/libalpm/be_files.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/lib/libalpm/be_files.c b/lib/libalpm/be_files.c index 93a2cc9f..8ac253ae 100644 --- a/lib/libalpm/be_files.c +++ b/lib/libalpm/be_files.c @@ -134,6 +134,37 @@ static int checkdbdir(pmdb_t *db) } /** Update a package database + * + * An update of the package database \a db will be attempted. Unless + * \a force is true, the update will only be performed if the remote + * database was modified since the last update. + * + * A transaction is necessary for this operation, in order to obtain a + * database lock. During this transaction the front-end will be informed + * of the download progress of the database via the download callback. + * + * Example: + * @code + * pmdb_t *db; + * int result; + * db = alpm_list_getdata(alpm_option_get_syncdbs()); + * if(alpm_trans_init(PM_TRANS_TYPE_SYNC, 0, NULL, NULL, NULL) == 0) { + * result = alpm_db_update(0, db); + * alpm_trans_release(); + * + * if(result > 0) { + * printf("Unable to update database: %s\n", alpm_strerrorlast()); + * } else if(result < 0) { + * printf("Database already up to date\n"); + * } else { + * printf("Database updated\n"); + * } + * } + * @endcode + * + * @ingroup alpm_databases + * @note After a successful update, the \link alpm_db_get_pkgcache() + * package cache \endlink will be invalidated * @param force if true, then forces the update, otherwise update only in case * the database isn't up to date * @param db pointer to the package database to update