From a479e0300baf48781d145e204e11a20059ad4caa Mon Sep 17 00:00:00 2001 From: Rémy Oudompheng Date: Sat, 9 Apr 2011 13:31:15 +0200 Subject: libalpm: set pm_errno correctly in alpm_trans_get_flags() Signed-off-by: Dan McGee --- lib/libalpm/trans.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/libalpm/trans.c') diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c index 4b29f9a8..08856d07 100644 --- a/lib/libalpm/trans.c +++ b/lib/libalpm/trans.c @@ -465,8 +465,8 @@ cleanup: int SYMEXPORT alpm_trans_get_flags() { /* Sanity checks */ - ASSERT(handle != NULL, return(-1)); - ASSERT(handle->trans != NULL, return(-1)); + ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1)); + ASSERT(handle->trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1)); return handle->trans->flags; } -- cgit v1.2.3-54-g00ecf From ff6f6027f09beaac9e387ca12f75583bba1dac21 Mon Sep 17 00:00:00 2001 From: Rémy Oudompheng Date: Sat, 9 Apr 2011 16:04:18 +0200 Subject: Fix broken documentation for alpm_trans_prepare() The current state of the code does not allow to see immediately that it returns a list of pmdepmissing_t structures. Signed-off-by: Dan McGee --- lib/libalpm/deps.c | 2 +- lib/libalpm/remove.c | 8 ++++++++ lib/libalpm/trans.c | 4 ++-- 3 files changed, 11 insertions(+), 3 deletions(-) (limited to 'lib/libalpm/trans.c') diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c index dc85b318..36d6e1aa 100644 --- a/lib/libalpm/deps.c +++ b/lib/libalpm/deps.c @@ -261,7 +261,7 @@ pmpkg_t SYMEXPORT *alpm_find_satisfier(alpm_list_t *pkgs, const char *depstring) * @param reversedeps handles the backward dependencies * @param remove an alpm_list_t* of packages to be removed * @param upgrade an alpm_list_t* of packages to be upgraded (remove-then-upgrade) - * @return an alpm_list_t* of pmpkg_t* of pmdepmissing_t pointers. + * @return an alpm_list_t* of pmdepmissing_t pointers. */ alpm_list_t SYMEXPORT *alpm_checkdeps(alpm_list_t *pkglist, int reversedeps, alpm_list_t *remove, alpm_list_t *upgrade) diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c index 5def92a6..7c8a99fb 100644 --- a/lib/libalpm/remove.c +++ b/lib/libalpm/remove.c @@ -129,6 +129,14 @@ static void remove_prepare_keep_needed(pmtrans_t *trans, pmdb_t *db, } } +/** Transaction preparation for remove actions. + * This functions takes a pointer to a alpm_list_t which will be + * filled with a list of pmdepmissing_t* objects representing + * the packages blocking the transaction. + * @param trans the transaction object + * @param db the database of local packages + * @param data a pointer to an alpm_list_t* to fill + */ int _alpm_remove_prepare(pmtrans_t *trans, pmdb_t *db, alpm_list_t **data) { alpm_list_t *lp; diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c index 08856d07..309a56a3 100644 --- a/lib/libalpm/trans.c +++ b/lib/libalpm/trans.c @@ -177,8 +177,8 @@ static alpm_list_t *check_arch(alpm_list_t *pkgs) } /** Prepare a transaction. - * @param data the address of an alpm_list where detailed description - * of an error can be dumped (ie. list of conflicting files) + * @param data the address of an alpm_list where a list + * of pmdepmissing_t objects is dumped (conflicting packages) * @return 0 on success, -1 on error (pm_errno is set accordingly) */ int SYMEXPORT alpm_trans_prepare(alpm_list_t **data) -- cgit v1.2.3-54-g00ecf From aac9e7c280a9686520e0f8f4bd7ffe4ed901716d Mon Sep 17 00:00:00 2001 From: Rémy Oudompheng Date: Sun, 6 Mar 2011 17:50:01 +0100 Subject: Move documentation of public transaction functions to alpm.h --- lib/libalpm/alpm.h | 65 ++++++++++++++++++++++++++++++++++++++++------------- lib/libalpm/trans.c | 28 +++++------------------ 2 files changed, 54 insertions(+), 39 deletions(-) (limited to 'lib/libalpm/trans.c') diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index 0f3b7166..b1f9542a 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -263,12 +263,13 @@ alpm_list_t *alpm_find_grp_pkgs(alpm_list_t *dbs, const char *name); pmpkg_t *alpm_sync_newversion(pmpkg_t *pkg, alpm_list_t *dbs_sync); -/* - * Transactions +/** + * @addtogroup alpm_api_trans Transaction Functions + * Functions to manipulate libalpm transactions + * @{ */ - -/* Flags */ +/** Transaction flags */ typedef enum _pmtransflag_t { PM_TRANS_FLAG_NODEPS = 1, PM_TRANS_FLAG_FORCE = (1 << 1), @@ -290,12 +291,7 @@ typedef enum _pmtransflag_t { PM_TRANS_FLAG_NOLOCK = (1 << 17) } pmtransflag_t; -/** - * @addtogroup alpm_trans - * @{ - */ -/** - * @brief Transaction events. +/** Transaction events. * NULL parameters are passed to in all events unless specified otherwise. */ typedef enum _pmtransevt_t { @@ -374,9 +370,8 @@ typedef enum _pmtransevt_t { /** Disk space usage was computed for a package */ PM_TRANS_EVT_DISKSPACE_DONE, } pmtransevt_t; -/*@}*/ -/* Transaction Conversations (ie, questions) */ +/** Transaction Conversations (ie, questions) */ typedef enum _pmtransconv_t { PM_TRANS_CONV_INSTALL_IGNOREPKG = 1, PM_TRANS_CONV_REPLACE_PKG = (1 << 1), @@ -387,7 +382,7 @@ typedef enum _pmtransconv_t { PM_TRANS_CONV_SELECT_PROVIDER = (1 << 6), } pmtransconv_t; -/* Transaction Progress */ +/** Transaction Progress */ typedef enum _pmtransprog_t { PM_TRANS_PROGRESS_ADD_START, PM_TRANS_PROGRESS_UPGRADE_START, @@ -397,27 +392,65 @@ typedef enum _pmtransprog_t { PM_TRANS_PROGRESS_INTEGRITY_START, } pmtransprog_t; -/* Transaction Event callback */ +/** Transaction Event callback */ typedef void (*alpm_trans_cb_event)(pmtransevt_t, void *, void *); -/* Transaction Conversation callback */ +/** Transaction Conversation callback */ typedef void (*alpm_trans_cb_conv)(pmtransconv_t, void *, void *, void *, int *); -/* Transaction Progress callback */ +/** Transaction Progress callback */ typedef void (*alpm_trans_cb_progress)(pmtransprog_t, const char *, int, size_t, size_t); int alpm_trans_get_flags(void); + +/** Returns a list of packages added by the transaction. + * @return a list of pmpkg_t structures + */ alpm_list_t * alpm_trans_get_add(void); + +/** Returns the list of packages removed by the transaction. + * @return a list of pmpkg_t structures + */ alpm_list_t * alpm_trans_get_remove(void); + +/** Initialize the transaction. + * @param flags flags of the transaction (like nodeps, etc) + * @param event event callback function pointer + * @param conv question callback function pointer + * @param progress progress callback function pointer + * @return 0 on success, -1 on error (pm_errno is set accordingly) + */ int alpm_trans_init(pmtransflag_t flags, alpm_trans_cb_event cb_event, alpm_trans_cb_conv conv, alpm_trans_cb_progress cb_progress); + +/** Prepare a transaction. + * @param data the address of an alpm_list where a list + * of pmdepmissing_t objects is dumped (conflicting packages) + * @return 0 on success, -1 on error (pm_errno is set accordingly) + */ int alpm_trans_prepare(alpm_list_t **data); + +/** Commit a transaction. + * @param data the address of an alpm_list where detailed description + * of an error can be dumped (ie. list of conflicting files) + * @return 0 on success, -1 on error (pm_errno is set accordingly) + */ int alpm_trans_commit(alpm_list_t **data); + +/** Interrupt a transaction. + * @return 0 on success, -1 on error (pm_errno is set accordingly) + */ int alpm_trans_interrupt(void); + +/** Release a transaction. + * @return 0 on success, -1 on error (pm_errno is set accordingly) + */ int alpm_trans_release(void); +/** @} */ + int alpm_sync_sysupgrade(int enable_downgrade); int alpm_add_pkg(pmpkg_t *pkg); int alpm_remove_pkg(pmpkg_t *pkg); diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c index 309a56a3..c5af7c69 100644 --- a/lib/libalpm/trans.c +++ b/lib/libalpm/trans.c @@ -97,13 +97,7 @@ static int remove_lock(pmhandle_t *handle) return(0); } -/** Initialize the transaction. - * @param flags flags of the transaction (like nodeps, etc) - * @param event event callback function pointer - * @param conv question callback function pointer - * @param progress progress callback function pointer - * @return 0 on success, -1 on error (pm_errno is set accordingly) - */ +/** Initialize the transaction. */ int SYMEXPORT alpm_trans_init(pmtransflag_t flags, alpm_trans_cb_event event, alpm_trans_cb_conv conv, alpm_trans_cb_progress progress) @@ -176,11 +170,7 @@ static alpm_list_t *check_arch(alpm_list_t *pkgs) return(invalid); } -/** Prepare a transaction. - * @param data the address of an alpm_list where a list - * of pmdepmissing_t objects is dumped (conflicting packages) - * @return 0 on success, -1 on error (pm_errno is set accordingly) - */ +/** Prepare a transaction. */ int SYMEXPORT alpm_trans_prepare(alpm_list_t **data) { pmtrans_t *trans; @@ -226,11 +216,7 @@ int SYMEXPORT alpm_trans_prepare(alpm_list_t **data) return(0); } -/** Commit a transaction. - * @param data the address of an alpm_list where detailed description - * of an error can be dumped (ie. list of conflicting files) - * @return 0 on success, -1 on error (pm_errno is set accordingly) - */ +/** Commit a transaction. */ int SYMEXPORT alpm_trans_commit(alpm_list_t **data) { pmtrans_t *trans; @@ -271,9 +257,7 @@ int SYMEXPORT alpm_trans_commit(alpm_list_t **data) return(0); } -/** Interrupt a transaction. - * @return 0 on success, -1 on error (pm_errno is set accordingly) - */ +/** Interrupt a transaction. */ int SYMEXPORT alpm_trans_interrupt(void) { pmtrans_t *trans; @@ -293,9 +277,7 @@ int SYMEXPORT alpm_trans_interrupt(void) return(0); } -/** Release a transaction. - * @return 0 on success, -1 on error (pm_errno is set accordingly) - */ +/** Release a transaction. */ int SYMEXPORT alpm_trans_release(void) { pmtrans_t *trans; -- cgit v1.2.3-54-g00ecf