summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorSebastian Nowicki <sebnow@gmail.com>2009-04-09 07:42:14 +0200
committerDan McGee <dan@archlinux.org>2009-04-11 19:50:37 +0200
commit63fc93607b3fb9950f927d0533742f0e1fc37dd0 (patch)
tree9d3f49cfea7d93d3fc732e9f4fdcb9e194060b67 /lib
parentd15d4f923dcfbe4afe97fb89322ff1234e2445cd (diff)
downloadpacman-63fc93607b3fb9950f927d0533742f0e1fc37dd0.tar.gz
pacman-63fc93607b3fb9950f927d0533742f0e1fc37dd0.tar.xz
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 <dan@archlinux.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/libalpm/be_files.c31
1 files changed, 31 insertions, 0 deletions
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