Former transaction callback rename refactor
Put all the callback stuff in alpm.h in one spot, and make the following renames for clarity with the new structure: ALPM_TRANS_EVT_* --> ALPM_EVENT_* ALPM_TRANS_CONV_* --> ALPM_QUESTION_* ALPM_TRANS_PROGRESS_* --> ALPM_PROGRESS_* alpm_option_get_convcb() --> alpm_option_get_questioncb() alpm_option_set_convcb() --> alpm_option_set_questioncb() Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
37da18aee8
commit
98fdfa1968
|
@ -473,7 +473,7 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg,
|
|||
goto cleanup;
|
||||
}
|
||||
|
||||
EVENT(handle, ALPM_TRANS_EVT_UPGRADE_START, newpkg, local);
|
||||
EVENT(handle, ALPM_EVENT_UPGRADE_START, newpkg, local);
|
||||
_alpm_log(handle, ALPM_LOG_DEBUG, "upgrading package %s-%s\n",
|
||||
newpkg->name, newpkg->version);
|
||||
|
||||
|
@ -488,7 +488,7 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg,
|
|||
} else {
|
||||
is_upgrade = 0;
|
||||
|
||||
EVENT(handle, ALPM_TRANS_EVT_ADD_START, newpkg, NULL);
|
||||
EVENT(handle, ALPM_EVENT_ADD_START, newpkg, NULL);
|
||||
_alpm_log(handle, ALPM_LOG_DEBUG, "adding package %s-%s\n",
|
||||
newpkg->name, newpkg->version);
|
||||
|
||||
|
@ -567,10 +567,10 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg,
|
|||
|
||||
/* call PROGRESS once with 0 percent, as we sort-of skip that here */
|
||||
if(is_upgrade) {
|
||||
PROGRESS(handle, ALPM_TRANS_PROGRESS_UPGRADE_START,
|
||||
PROGRESS(handle, ALPM_PROGRESS_UPGRADE_START,
|
||||
newpkg->name, 0, pkg_count, pkg_current);
|
||||
} else {
|
||||
PROGRESS(handle, ALPM_TRANS_PROGRESS_ADD_START,
|
||||
PROGRESS(handle, ALPM_PROGRESS_ADD_START,
|
||||
newpkg->name, 0, pkg_count, pkg_current);
|
||||
}
|
||||
|
||||
|
@ -594,10 +594,10 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg,
|
|||
}
|
||||
|
||||
if(is_upgrade) {
|
||||
PROGRESS(handle, ALPM_TRANS_PROGRESS_UPGRADE_START,
|
||||
PROGRESS(handle, ALPM_PROGRESS_UPGRADE_START,
|
||||
newpkg->name, percent, pkg_count, pkg_current);
|
||||
} else {
|
||||
PROGRESS(handle, ALPM_TRANS_PROGRESS_ADD_START,
|
||||
PROGRESS(handle, ALPM_PROGRESS_ADD_START,
|
||||
newpkg->name, percent, pkg_count, pkg_current);
|
||||
}
|
||||
|
||||
|
@ -649,10 +649,10 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg,
|
|||
}
|
||||
|
||||
if(is_upgrade) {
|
||||
PROGRESS(handle, ALPM_TRANS_PROGRESS_UPGRADE_START,
|
||||
PROGRESS(handle, ALPM_PROGRESS_UPGRADE_START,
|
||||
newpkg->name, 100, pkg_count, pkg_current);
|
||||
} else {
|
||||
PROGRESS(handle, ALPM_TRANS_PROGRESS_ADD_START,
|
||||
PROGRESS(handle, ALPM_PROGRESS_ADD_START,
|
||||
newpkg->name, 100, pkg_count, pkg_current);
|
||||
}
|
||||
|
||||
|
@ -669,9 +669,9 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg,
|
|||
}
|
||||
|
||||
if(is_upgrade) {
|
||||
EVENT(handle, ALPM_TRANS_EVT_UPGRADE_DONE, newpkg, oldpkg);
|
||||
EVENT(handle, ALPM_EVENT_UPGRADE_DONE, newpkg, oldpkg);
|
||||
} else {
|
||||
EVENT(handle, ALPM_TRANS_EVT_ADD_DONE, newpkg, oldpkg);
|
||||
EVENT(handle, ALPM_EVENT_ADD_DONE, newpkg, oldpkg);
|
||||
}
|
||||
|
||||
cleanup:
|
||||
|
|
|
@ -256,6 +256,116 @@ typedef enum _alpm_loglevel_t {
|
|||
typedef void (*alpm_cb_log)(alpm_loglevel_t, const char *, va_list);
|
||||
int alpm_logaction(alpm_handle_t *handle, const char *fmt, ...);
|
||||
|
||||
/** Events.
|
||||
* NULL parameters are passed to in all events unless specified otherwise.
|
||||
*/
|
||||
typedef enum _alpm_event_t {
|
||||
/** Dependencies will be computed for a package. */
|
||||
ALPM_EVENT_CHECKDEPS_START = 1,
|
||||
/** Dependencies were computed for a package. */
|
||||
ALPM_EVENT_CHECKDEPS_DONE,
|
||||
/** File conflicts will be computed for a package. */
|
||||
ALPM_EVENT_FILECONFLICTS_START,
|
||||
/** File conflicts were computed for a package. */
|
||||
ALPM_EVENT_FILECONFLICTS_DONE,
|
||||
/** Dependencies will be resolved for target package. */
|
||||
ALPM_EVENT_RESOLVEDEPS_START,
|
||||
/** Dependencies were resolved for target package. */
|
||||
ALPM_EVENT_RESOLVEDEPS_DONE,
|
||||
/** Inter-conflicts will be checked for target package. */
|
||||
ALPM_EVENT_INTERCONFLICTS_START,
|
||||
/** Inter-conflicts were checked for target package. */
|
||||
ALPM_EVENT_INTERCONFLICTS_DONE,
|
||||
/** Package will be installed.
|
||||
* A pointer to the target package is passed to the callback.
|
||||
*/
|
||||
ALPM_EVENT_ADD_START,
|
||||
/** Package was installed.
|
||||
* A pointer to the new package is passed to the callback.
|
||||
*/
|
||||
ALPM_EVENT_ADD_DONE,
|
||||
/** Package will be removed.
|
||||
* A pointer to the target package is passed to the callback.
|
||||
*/
|
||||
ALPM_EVENT_REMOVE_START,
|
||||
/** Package was removed.
|
||||
* A pointer to the removed package is passed to the callback.
|
||||
*/
|
||||
ALPM_EVENT_REMOVE_DONE,
|
||||
/** Package will be upgraded.
|
||||
* A pointer to the upgraded package is passed to the callback.
|
||||
*/
|
||||
ALPM_EVENT_UPGRADE_START,
|
||||
/** Package was upgraded.
|
||||
* A pointer to the new package, and a pointer to the old package is passed
|
||||
* to the callback, respectively.
|
||||
*/
|
||||
ALPM_EVENT_UPGRADE_DONE,
|
||||
/** Target package's integrity will be checked. */
|
||||
ALPM_EVENT_INTEGRITY_START,
|
||||
/** Target package's integrity was checked. */
|
||||
ALPM_EVENT_INTEGRITY_DONE,
|
||||
/** Target deltas's integrity will be checked. */
|
||||
ALPM_EVENT_DELTA_INTEGRITY_START,
|
||||
/** Target delta's integrity was checked. */
|
||||
ALPM_EVENT_DELTA_INTEGRITY_DONE,
|
||||
/** Deltas will be applied to packages. */
|
||||
ALPM_EVENT_DELTA_PATCHES_START,
|
||||
/** Deltas were applied to packages. */
|
||||
ALPM_EVENT_DELTA_PATCHES_DONE,
|
||||
/** Delta patch will be applied to target package.
|
||||
* The filename of the package and the filename of the patch is passed to the
|
||||
* callback.
|
||||
*/
|
||||
ALPM_EVENT_DELTA_PATCH_START,
|
||||
/** Delta patch was applied to target package. */
|
||||
ALPM_EVENT_DELTA_PATCH_DONE,
|
||||
/** Delta patch failed to apply to target package. */
|
||||
ALPM_EVENT_DELTA_PATCH_FAILED,
|
||||
/** Scriptlet has printed information.
|
||||
* A line of text is passed to the callback.
|
||||
*/
|
||||
ALPM_EVENT_SCRIPTLET_INFO,
|
||||
/** Files will be downloaded from a repository.
|
||||
* The repository's tree name is passed to the callback.
|
||||
*/
|
||||
ALPM_EVENT_RETRIEVE_START,
|
||||
/** Disk space usage will be computed for a package */
|
||||
ALPM_EVENT_DISKSPACE_START,
|
||||
/** Disk space usage was computed for a package */
|
||||
ALPM_EVENT_DISKSPACE_DONE,
|
||||
} alpm_event_t;
|
||||
|
||||
/** Event callback */
|
||||
typedef void (*alpm_cb_event)(alpm_event_t, void *, void *);
|
||||
|
||||
/** Questions */
|
||||
typedef enum _alpm_question_t {
|
||||
ALPM_QUESTION_INSTALL_IGNOREPKG = 1,
|
||||
ALPM_QUESTION_REPLACE_PKG = (1 << 1),
|
||||
ALPM_QUESTION_CONFLICT_PKG = (1 << 2),
|
||||
ALPM_QUESTION_CORRUPTED_PKG = (1 << 3),
|
||||
ALPM_QUESTION_LOCAL_NEWER = (1 << 4),
|
||||
ALPM_QUESTION_REMOVE_PKGS = (1 << 5),
|
||||
ALPM_QUESTION_SELECT_PROVIDER = (1 << 6),
|
||||
} alpm_question_t;
|
||||
|
||||
/** Question callback */
|
||||
typedef void (*alpm_cb_question)(alpm_question_t, void *, void *, void *, int *);
|
||||
|
||||
/** Progress */
|
||||
typedef enum _alpm_progress_t {
|
||||
ALPM_PROGRESS_ADD_START,
|
||||
ALPM_PROGRESS_UPGRADE_START,
|
||||
ALPM_PROGRESS_REMOVE_START,
|
||||
ALPM_PROGRESS_CONFLICTS_START,
|
||||
ALPM_PROGRESS_DISKSPACE_START,
|
||||
ALPM_PROGRESS_INTEGRITY_START,
|
||||
} alpm_progress_t;
|
||||
|
||||
/** Progress callback */
|
||||
typedef void (*alpm_cb_progress)(alpm_progress_t, const char *, int, size_t, size_t);
|
||||
|
||||
/*
|
||||
* Downloading
|
||||
*/
|
||||
|
@ -312,6 +422,21 @@ alpm_cb_totaldl alpm_option_get_totaldlcb(alpm_handle_t *handle);
|
|||
/** Sets the callback used to report total download size. */
|
||||
int alpm_option_set_totaldlcb(alpm_handle_t *handle, alpm_cb_totaldl cb);
|
||||
|
||||
/** Returns the callback used for events. */
|
||||
alpm_cb_event alpm_option_get_eventcb(alpm_handle_t *handle);
|
||||
/** Sets the callback used for events. */
|
||||
int alpm_option_set_eventcb(alpm_handle_t *handle, alpm_cb_event cb);
|
||||
|
||||
/** Returns the callback used for questions. */
|
||||
alpm_cb_question alpm_option_get_questioncb(alpm_handle_t *handle);
|
||||
/** Sets the callback used for questions. */
|
||||
int alpm_option_set_questioncb(alpm_handle_t *handle, alpm_cb_question cb);
|
||||
|
||||
/** Returns the callback used for operation progress. */
|
||||
alpm_cb_progress alpm_option_get_progresscb(alpm_handle_t *handle);
|
||||
/** Sets the callback used for operation progress. */
|
||||
int alpm_option_set_progresscb(alpm_handle_t *handle, alpm_cb_progress cb);
|
||||
|
||||
/** Returns the root of the destination filesystem. Read-only. */
|
||||
const char *alpm_option_get_root(alpm_handle_t *handle);
|
||||
|
||||
|
@ -863,131 +988,6 @@ typedef enum _alpm_transflag_t {
|
|||
ALPM_TRANS_FLAG_NOLOCK = (1 << 17)
|
||||
} alpm_transflag_t;
|
||||
|
||||
/** Events.
|
||||
* NULL parameters are passed to in all events unless specified otherwise.
|
||||
*/
|
||||
typedef enum _alpm_transevt_t {
|
||||
/** Dependencies will be computed for a package. */
|
||||
ALPM_TRANS_EVT_CHECKDEPS_START = 1,
|
||||
/** Dependencies were computed for a package. */
|
||||
ALPM_TRANS_EVT_CHECKDEPS_DONE,
|
||||
/** File conflicts will be computed for a package. */
|
||||
ALPM_TRANS_EVT_FILECONFLICTS_START,
|
||||
/** File conflicts were computed for a package. */
|
||||
ALPM_TRANS_EVT_FILECONFLICTS_DONE,
|
||||
/** Dependencies will be resolved for target package. */
|
||||
ALPM_TRANS_EVT_RESOLVEDEPS_START,
|
||||
/** Dependencies were resolved for target package. */
|
||||
ALPM_TRANS_EVT_RESOLVEDEPS_DONE,
|
||||
/** Inter-conflicts will be checked for target package. */
|
||||
ALPM_TRANS_EVT_INTERCONFLICTS_START,
|
||||
/** Inter-conflicts were checked for target package. */
|
||||
ALPM_TRANS_EVT_INTERCONFLICTS_DONE,
|
||||
/** Package will be installed.
|
||||
* A pointer to the target package is passed to the callback.
|
||||
*/
|
||||
ALPM_TRANS_EVT_ADD_START,
|
||||
/** Package was installed.
|
||||
* A pointer to the new package is passed to the callback.
|
||||
*/
|
||||
ALPM_TRANS_EVT_ADD_DONE,
|
||||
/** Package will be removed.
|
||||
* A pointer to the target package is passed to the callback.
|
||||
*/
|
||||
ALPM_TRANS_EVT_REMOVE_START,
|
||||
/** Package was removed.
|
||||
* A pointer to the removed package is passed to the callback.
|
||||
*/
|
||||
ALPM_TRANS_EVT_REMOVE_DONE,
|
||||
/** Package will be upgraded.
|
||||
* A pointer to the upgraded package is passed to the callback.
|
||||
*/
|
||||
ALPM_TRANS_EVT_UPGRADE_START,
|
||||
/** Package was upgraded.
|
||||
* A pointer to the new package, and a pointer to the old package is passed
|
||||
* to the callback, respectively.
|
||||
*/
|
||||
ALPM_TRANS_EVT_UPGRADE_DONE,
|
||||
/** Target package's integrity will be checked. */
|
||||
ALPM_TRANS_EVT_INTEGRITY_START,
|
||||
/** Target package's integrity was checked. */
|
||||
ALPM_TRANS_EVT_INTEGRITY_DONE,
|
||||
/** Target deltas's integrity will be checked. */
|
||||
ALPM_TRANS_EVT_DELTA_INTEGRITY_START,
|
||||
/** Target delta's integrity was checked. */
|
||||
ALPM_TRANS_EVT_DELTA_INTEGRITY_DONE,
|
||||
/** Deltas will be applied to packages. */
|
||||
ALPM_TRANS_EVT_DELTA_PATCHES_START,
|
||||
/** Deltas were applied to packages. */
|
||||
ALPM_TRANS_EVT_DELTA_PATCHES_DONE,
|
||||
/** Delta patch will be applied to target package.
|
||||
* The filename of the package and the filename of the patch is passed to the
|
||||
* callback.
|
||||
*/
|
||||
ALPM_TRANS_EVT_DELTA_PATCH_START,
|
||||
/** Delta patch was applied to target package. */
|
||||
ALPM_TRANS_EVT_DELTA_PATCH_DONE,
|
||||
/** Delta patch failed to apply to target package. */
|
||||
ALPM_TRANS_EVT_DELTA_PATCH_FAILED,
|
||||
/** Scriptlet has printed information.
|
||||
* A line of text is passed to the callback.
|
||||
*/
|
||||
ALPM_TRANS_EVT_SCRIPTLET_INFO,
|
||||
/** Files will be downloaded from a repository.
|
||||
* The repository's tree name is passed to the callback.
|
||||
*/
|
||||
ALPM_TRANS_EVT_RETRIEVE_START,
|
||||
/** Disk space usage will be computed for a package */
|
||||
ALPM_TRANS_EVT_DISKSPACE_START,
|
||||
/** Disk space usage was computed for a package */
|
||||
ALPM_TRANS_EVT_DISKSPACE_DONE,
|
||||
} alpm_transevt_t;
|
||||
|
||||
/** Conversations (ie, questions) */
|
||||
typedef enum _alpm_transconv_t {
|
||||
ALPM_TRANS_CONV_INSTALL_IGNOREPKG = 1,
|
||||
ALPM_TRANS_CONV_REPLACE_PKG = (1 << 1),
|
||||
ALPM_TRANS_CONV_CONFLICT_PKG = (1 << 2),
|
||||
ALPM_TRANS_CONV_CORRUPTED_PKG = (1 << 3),
|
||||
ALPM_TRANS_CONV_LOCAL_NEWER = (1 << 4),
|
||||
ALPM_TRANS_CONV_REMOVE_PKGS = (1 << 5),
|
||||
ALPM_TRANS_CONV_SELECT_PROVIDER = (1 << 6),
|
||||
} alpm_transconv_t;
|
||||
|
||||
/** Progress */
|
||||
typedef enum _alpm_transprog_t {
|
||||
ALPM_TRANS_PROGRESS_ADD_START,
|
||||
ALPM_TRANS_PROGRESS_UPGRADE_START,
|
||||
ALPM_TRANS_PROGRESS_REMOVE_START,
|
||||
ALPM_TRANS_PROGRESS_CONFLICTS_START,
|
||||
ALPM_TRANS_PROGRESS_DISKSPACE_START,
|
||||
ALPM_TRANS_PROGRESS_INTEGRITY_START,
|
||||
} alpm_transprog_t;
|
||||
|
||||
/** Event callback */
|
||||
typedef void (*alpm_cb_event)(alpm_transevt_t, void *, void *);
|
||||
|
||||
/** Conversation callback */
|
||||
typedef void (*alpm_cb_conv)(alpm_transconv_t, void *, void *, void *, int *);
|
||||
|
||||
/** Progress callback */
|
||||
typedef void (*alpm_cb_progress)(alpm_transprog_t, const char *, int, size_t, size_t);
|
||||
|
||||
/** Returns the callback used for events. */
|
||||
alpm_cb_event alpm_option_get_eventcb(alpm_handle_t *handle);
|
||||
/** Sets the callback used for events. */
|
||||
int alpm_option_set_eventcb(alpm_handle_t *handle, alpm_cb_event cb);
|
||||
|
||||
/** Returns the callback used for conversations (questions). */
|
||||
alpm_cb_conv alpm_option_get_convcb(alpm_handle_t *handle);
|
||||
/** Sets the callback used for conversations (questions). */
|
||||
int alpm_option_set_convcb(alpm_handle_t *handle, alpm_cb_conv cb);
|
||||
|
||||
/** Returns the callback used for operation progress. */
|
||||
alpm_cb_progress alpm_option_get_progresscb(alpm_handle_t *handle);
|
||||
/** Sets the callback used for operation progress. */
|
||||
int alpm_option_set_progresscb(alpm_handle_t *handle, alpm_cb_progress cb);
|
||||
|
||||
/** Returns the bitfield of flags for the current transaction.
|
||||
* @param handle the context handle
|
||||
* @return the bitfield of transaction flags
|
||||
|
|
|
@ -401,7 +401,7 @@ alpm_list_t *_alpm_db_find_fileconflicts(alpm_handle_t *handle,
|
|||
size_t filenum;
|
||||
|
||||
int percent = (current * 100) / numtargs;
|
||||
PROGRESS(handle, ALPM_TRANS_PROGRESS_CONFLICTS_START, "", percent,
|
||||
PROGRESS(handle, ALPM_PROGRESS_CONFLICTS_START, "", percent,
|
||||
numtargs, current);
|
||||
/* CHECK 1: check every target against every target */
|
||||
_alpm_log(handle, ALPM_LOG_DEBUG, "searching for file conflicts: %s\n",
|
||||
|
@ -584,7 +584,7 @@ alpm_list_t *_alpm_db_find_fileconflicts(alpm_handle_t *handle,
|
|||
free(tmpfiles.files);
|
||||
}
|
||||
}
|
||||
PROGRESS(handle, ALPM_TRANS_PROGRESS_CONFLICTS_START, "", 100,
|
||||
PROGRESS(handle, ALPM_PROGRESS_CONFLICTS_START, "", 100,
|
||||
numtargs, current);
|
||||
|
||||
return conflicts;
|
||||
|
|
|
@ -582,7 +582,7 @@ static alpm_pkg_t *resolvedep(alpm_handle_t *handle, alpm_depend_t *dep,
|
|||
if(_alpm_pkg_should_ignore(handle, pkg)) {
|
||||
int install = 0;
|
||||
if(prompt) {
|
||||
QUESTION(handle, ALPM_TRANS_CONV_INSTALL_IGNOREPKG, pkg,
|
||||
QUESTION(handle, ALPM_QUESTION_INSTALL_IGNOREPKG, pkg,
|
||||
NULL, NULL, &install);
|
||||
} else {
|
||||
_alpm_log(handle, ALPM_LOG_WARNING, _("ignoring package %s-%s\n"),
|
||||
|
@ -607,7 +607,7 @@ static alpm_pkg_t *resolvedep(alpm_handle_t *handle, alpm_depend_t *dep,
|
|||
if(_alpm_pkg_should_ignore(handle, pkg)) {
|
||||
int install = 0;
|
||||
if(prompt) {
|
||||
QUESTION(handle, ALPM_TRANS_CONV_INSTALL_IGNOREPKG,
|
||||
QUESTION(handle, ALPM_QUESTION_INSTALL_IGNOREPKG,
|
||||
pkg, NULL, NULL, &install);
|
||||
} else {
|
||||
_alpm_log(handle, ALPM_LOG_WARNING, _("ignoring package %s-%s\n"),
|
||||
|
@ -640,7 +640,7 @@ static alpm_pkg_t *resolvedep(alpm_handle_t *handle, alpm_depend_t *dep,
|
|||
int index = 0;
|
||||
if(count > 1) {
|
||||
/* if there is more than one provider, we ask the user */
|
||||
QUESTION(handle, ALPM_TRANS_CONV_SELECT_PROVIDER,
|
||||
QUESTION(handle, ALPM_QUESTION_SELECT_PROVIDER,
|
||||
providers, dep, NULL, &index);
|
||||
}
|
||||
if(index >= 0 && index < count) {
|
||||
|
|
|
@ -260,7 +260,7 @@ int _alpm_check_diskspace(alpm_handle_t *handle)
|
|||
for(targ = trans->remove; targ; targ = targ->next, current++) {
|
||||
alpm_pkg_t *local_pkg;
|
||||
int percent = (current * 100) / numtargs;
|
||||
PROGRESS(handle, ALPM_TRANS_PROGRESS_DISKSPACE_START, "", percent,
|
||||
PROGRESS(handle, ALPM_PROGRESS_DISKSPACE_START, "", percent,
|
||||
numtargs, current);
|
||||
|
||||
local_pkg = targ->data;
|
||||
|
@ -271,7 +271,7 @@ int _alpm_check_diskspace(alpm_handle_t *handle)
|
|||
for(targ = trans->add; targ; targ = targ->next, current++) {
|
||||
alpm_pkg_t *pkg, *local_pkg;
|
||||
int percent = (current * 100) / numtargs;
|
||||
PROGRESS(handle, ALPM_TRANS_PROGRESS_DISKSPACE_START, "", percent,
|
||||
PROGRESS(handle, ALPM_PROGRESS_DISKSPACE_START, "", percent,
|
||||
numtargs, current);
|
||||
|
||||
pkg = targ->data;
|
||||
|
@ -290,7 +290,7 @@ int _alpm_check_diskspace(alpm_handle_t *handle)
|
|||
}
|
||||
}
|
||||
|
||||
PROGRESS(handle, ALPM_TRANS_PROGRESS_DISKSPACE_START, "", 100,
|
||||
PROGRESS(handle, ALPM_PROGRESS_DISKSPACE_START, "", 100,
|
||||
numtargs, current);
|
||||
|
||||
for(i = mount_points; i; i = i->next) {
|
||||
|
|
|
@ -172,10 +172,10 @@ alpm_cb_event SYMEXPORT alpm_option_get_eventcb(alpm_handle_t *handle)
|
|||
return handle->eventcb;
|
||||
}
|
||||
|
||||
alpm_cb_conv SYMEXPORT alpm_option_get_convcb(alpm_handle_t *handle)
|
||||
alpm_cb_question SYMEXPORT alpm_option_get_questioncb(alpm_handle_t *handle)
|
||||
{
|
||||
CHECK_HANDLE(handle, return NULL);
|
||||
return handle->convcb;
|
||||
return handle->questioncb;
|
||||
}
|
||||
|
||||
alpm_cb_progress SYMEXPORT alpm_option_get_progresscb(alpm_handle_t *handle)
|
||||
|
@ -315,10 +315,10 @@ int SYMEXPORT alpm_option_set_eventcb(alpm_handle_t *handle, alpm_cb_event cb)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int SYMEXPORT alpm_option_set_convcb(alpm_handle_t *handle, alpm_cb_conv cb)
|
||||
int SYMEXPORT alpm_option_set_questioncb(alpm_handle_t *handle, alpm_cb_question cb)
|
||||
{
|
||||
CHECK_HANDLE(handle, return -1);
|
||||
handle->convcb = cb;
|
||||
handle->questioncb = cb;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,8 +38,8 @@ do { \
|
|||
} while(0)
|
||||
#define QUESTION(h, q, d1, d2, d3, r) \
|
||||
do { \
|
||||
if((h)->convcb) { \
|
||||
(h)->convcb(q, d1, d2, d3, r); \
|
||||
if((h)->questioncb) { \
|
||||
(h)->questioncb(q, d1, d2, d3, r); \
|
||||
} \
|
||||
} while(0)
|
||||
#define PROGRESS(h, e, p, per, n, r) \
|
||||
|
@ -69,7 +69,7 @@ struct __alpm_handle_t {
|
|||
alpm_cb_totaldl totaldlcb; /* Total download callback function */
|
||||
alpm_cb_fetch fetchcb; /* Download file callback function */
|
||||
alpm_cb_event eventcb;
|
||||
alpm_cb_conv convcb;
|
||||
alpm_cb_question questioncb;
|
||||
alpm_cb_progress progresscb;
|
||||
|
||||
/* filesystem paths */
|
||||
|
|
|
@ -161,7 +161,7 @@ int _alpm_remove_prepare(alpm_handle_t *handle, alpm_list_t **data)
|
|||
}
|
||||
|
||||
if(!(trans->flags & ALPM_TRANS_FLAG_NODEPS)) {
|
||||
EVENT(handle, ALPM_TRANS_EVT_CHECKDEPS_START, NULL, NULL);
|
||||
EVENT(handle, ALPM_EVENT_CHECKDEPS_START, NULL, NULL);
|
||||
|
||||
_alpm_log(handle, ALPM_LOG_DEBUG, "looking for unsatisfied dependencies\n");
|
||||
lp = alpm_checkdeps(handle, _alpm_db_get_pkgcache(db), trans->remove, NULL, 1);
|
||||
|
@ -205,7 +205,7 @@ int _alpm_remove_prepare(alpm_handle_t *handle, alpm_list_t **data)
|
|||
}
|
||||
|
||||
if(!(trans->flags & ALPM_TRANS_FLAG_NODEPS)) {
|
||||
EVENT(handle, ALPM_TRANS_EVT_CHECKDEPS_DONE, NULL, NULL);
|
||||
EVENT(handle, ALPM_EVENT_CHECKDEPS_DONE, NULL, NULL);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -362,7 +362,7 @@ int _alpm_remove_single_package(alpm_handle_t *handle,
|
|||
_alpm_log(handle, ALPM_LOG_DEBUG, "removing old package first (%s-%s)\n",
|
||||
pkgname, pkgver);
|
||||
} else {
|
||||
EVENT(handle, ALPM_TRANS_EVT_REMOVE_START, oldpkg, NULL);
|
||||
EVENT(handle, ALPM_EVENT_REMOVE_START, oldpkg, NULL);
|
||||
_alpm_log(handle, ALPM_LOG_DEBUG, "removing package %s-%s\n",
|
||||
pkgname, pkgver);
|
||||
|
||||
|
@ -419,7 +419,7 @@ int _alpm_remove_single_package(alpm_handle_t *handle,
|
|||
|
||||
if(!newpkg) {
|
||||
/* init progress bar, but only on true remove transactions */
|
||||
PROGRESS(handle, ALPM_TRANS_PROGRESS_REMOVE_START, pkgname, 0,
|
||||
PROGRESS(handle, ALPM_PROGRESS_REMOVE_START, pkgname, 0,
|
||||
pkg_count, targ_count);
|
||||
}
|
||||
|
||||
|
@ -434,7 +434,7 @@ int _alpm_remove_single_package(alpm_handle_t *handle,
|
|||
if(!newpkg) {
|
||||
/* update progress bar after each file */
|
||||
percent = (position * 100) / filenum;
|
||||
PROGRESS(handle, ALPM_TRANS_PROGRESS_REMOVE_START, pkgname,
|
||||
PROGRESS(handle, ALPM_PROGRESS_REMOVE_START, pkgname,
|
||||
percent, pkg_count, targ_count);
|
||||
}
|
||||
position++;
|
||||
|
@ -443,7 +443,7 @@ int _alpm_remove_single_package(alpm_handle_t *handle,
|
|||
|
||||
if(!newpkg) {
|
||||
/* set progress to 100% after we finish unlinking files */
|
||||
PROGRESS(handle, ALPM_TRANS_PROGRESS_REMOVE_START, pkgname, 100,
|
||||
PROGRESS(handle, ALPM_PROGRESS_REMOVE_START, pkgname, 100,
|
||||
pkg_count, targ_count);
|
||||
|
||||
/* run the post-remove script if it exists */
|
||||
|
@ -469,7 +469,7 @@ db:
|
|||
|
||||
if(!newpkg) {
|
||||
/* TODO: awesome! we're passing invalid pointers. */
|
||||
EVENT(handle, ALPM_TRANS_EVT_REMOVE_DONE, oldpkg, NULL);
|
||||
EVENT(handle, ALPM_EVENT_REMOVE_DONE, oldpkg, NULL);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -152,7 +152,7 @@ static alpm_list_t *check_replacers(alpm_handle_t *handle, alpm_pkg_t *lpkg,
|
|||
continue;
|
||||
}
|
||||
|
||||
QUESTION(handle, ALPM_TRANS_CONV_REPLACE_PKG, lpkg, spkg,
|
||||
QUESTION(handle, ALPM_QUESTION_REPLACE_PKG, lpkg, spkg,
|
||||
sdb->treename, &doreplace);
|
||||
if(!doreplace) {
|
||||
continue;
|
||||
|
@ -264,7 +264,7 @@ alpm_list_t SYMEXPORT *alpm_find_group_pkgs(alpm_list_t *dbs,
|
|||
if(_alpm_pkg_should_ignore(db->handle, pkg)) {
|
||||
ignorelist = alpm_list_add(ignorelist, pkg);
|
||||
int install = 0;
|
||||
QUESTION(db->handle, ALPM_TRANS_CONV_INSTALL_IGNOREPKG, pkg,
|
||||
QUESTION(db->handle, ALPM_QUESTION_INSTALL_IGNOREPKG, pkg,
|
||||
NULL, NULL, &install);
|
||||
if(!install)
|
||||
continue;
|
||||
|
@ -360,7 +360,7 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data)
|
|||
|
||||
/* Build up list by repeatedly resolving each transaction package */
|
||||
/* Resolve targets dependencies */
|
||||
EVENT(handle, ALPM_TRANS_EVT_RESOLVEDEPS_START, NULL, NULL);
|
||||
EVENT(handle, ALPM_EVENT_RESOLVEDEPS_START, NULL, NULL);
|
||||
_alpm_log(handle, ALPM_LOG_DEBUG, "resolving target's dependencies\n");
|
||||
|
||||
/* build remove list for resolvedeps */
|
||||
|
@ -393,7 +393,7 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data)
|
|||
see if they'd like to ignore them rather than failing the sync */
|
||||
if(unresolvable != NULL) {
|
||||
int remove_unresolvable = 0;
|
||||
QUESTION(handle, ALPM_TRANS_CONV_REMOVE_PKGS, unresolvable,
|
||||
QUESTION(handle, ALPM_QUESTION_REMOVE_PKGS, unresolvable,
|
||||
NULL, NULL, &remove_unresolvable);
|
||||
if(remove_unresolvable) {
|
||||
/* User wants to remove the unresolvable packages from the
|
||||
|
@ -431,12 +431,12 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data)
|
|||
trans->add = _alpm_sortbydeps(handle, resolved, 0);
|
||||
alpm_list_free(resolved);
|
||||
|
||||
EVENT(handle, ALPM_TRANS_EVT_RESOLVEDEPS_DONE, NULL, NULL);
|
||||
EVENT(handle, ALPM_EVENT_RESOLVEDEPS_DONE, NULL, NULL);
|
||||
}
|
||||
|
||||
if(!(trans->flags & ALPM_TRANS_FLAG_NOCONFLICTS)) {
|
||||
/* check for inter-conflicts and whatnot */
|
||||
EVENT(handle, ALPM_TRANS_EVT_INTERCONFLICTS_START, NULL, NULL);
|
||||
EVENT(handle, ALPM_EVENT_INTERCONFLICTS_START, NULL, NULL);
|
||||
|
||||
_alpm_log(handle, ALPM_LOG_DEBUG, "looking for conflicts\n");
|
||||
|
||||
|
@ -525,7 +525,7 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data)
|
|||
alpm_pkg_t *sync = _alpm_pkg_find(trans->add, conflict->package1);
|
||||
alpm_pkg_t *local = _alpm_db_get_pkgfromcache(handle->db_local, conflict->package2);
|
||||
int doremove = 0;
|
||||
QUESTION(handle, ALPM_TRANS_CONV_CONFLICT_PKG, conflict->package1,
|
||||
QUESTION(handle, ALPM_QUESTION_CONFLICT_PKG, conflict->package1,
|
||||
conflict->package2, conflict->reason->name, &doremove);
|
||||
if(doremove) {
|
||||
/* append to the removes list */
|
||||
|
@ -546,7 +546,7 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data)
|
|||
goto cleanup;
|
||||
}
|
||||
}
|
||||
EVENT(handle, ALPM_TRANS_EVT_INTERCONFLICTS_DONE, NULL, NULL);
|
||||
EVENT(handle, ALPM_EVENT_INTERCONFLICTS_DONE, NULL, NULL);
|
||||
alpm_list_free_inner(deps, (alpm_list_fn_free)_alpm_conflict_free);
|
||||
alpm_list_free(deps);
|
||||
}
|
||||
|
@ -646,7 +646,7 @@ static int apply_deltas(alpm_handle_t *handle)
|
|||
if(!deltas_found) {
|
||||
/* only show this if we actually have deltas to apply, and it is before
|
||||
* the very first one */
|
||||
EVENT(handle, ALPM_TRANS_EVT_DELTA_PATCHES_START, NULL, NULL);
|
||||
EVENT(handle, ALPM_EVENT_DELTA_PATCHES_START, NULL, NULL);
|
||||
deltas_found = 1;
|
||||
}
|
||||
|
||||
|
@ -680,11 +680,11 @@ static int apply_deltas(alpm_handle_t *handle)
|
|||
|
||||
_alpm_log(handle, ALPM_LOG_DEBUG, "command: %s\n", command);
|
||||
|
||||
EVENT(handle, ALPM_TRANS_EVT_DELTA_PATCH_START, d->to, d->delta);
|
||||
EVENT(handle, ALPM_EVENT_DELTA_PATCH_START, d->to, d->delta);
|
||||
|
||||
int retval = system(command);
|
||||
if(retval == 0) {
|
||||
EVENT(handle, ALPM_TRANS_EVT_DELTA_PATCH_DONE, NULL, NULL);
|
||||
EVENT(handle, ALPM_EVENT_DELTA_PATCH_DONE, NULL, NULL);
|
||||
|
||||
/* delete the delta file */
|
||||
unlink(delta);
|
||||
|
@ -702,7 +702,7 @@ static int apply_deltas(alpm_handle_t *handle)
|
|||
|
||||
if(retval != 0) {
|
||||
/* one delta failed for this package, cancel the remaining ones */
|
||||
EVENT(handle, ALPM_TRANS_EVT_DELTA_PATCH_FAILED, NULL, NULL);
|
||||
EVENT(handle, ALPM_EVENT_DELTA_PATCH_FAILED, NULL, NULL);
|
||||
handle->pm_errno = ALPM_ERR_DLT_PATCHFAILED;
|
||||
ret = 1;
|
||||
break;
|
||||
|
@ -710,7 +710,7 @@ static int apply_deltas(alpm_handle_t *handle)
|
|||
}
|
||||
}
|
||||
if(deltas_found) {
|
||||
EVENT(handle, ALPM_TRANS_EVT_DELTA_PATCHES_DONE, NULL, NULL);
|
||||
EVENT(handle, ALPM_EVENT_DELTA_PATCHES_DONE, NULL, NULL);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -728,7 +728,7 @@ static int prompt_to_delete(alpm_handle_t *handle, const char *filepath,
|
|||
enum _alpm_errno_t reason)
|
||||
{
|
||||
int doremove = 0;
|
||||
QUESTION(handle, ALPM_TRANS_CONV_CORRUPTED_PKG, (char *)filepath,
|
||||
QUESTION(handle, ALPM_QUESTION_CORRUPTED_PKG, (char *)filepath,
|
||||
&reason, NULL, &doremove);
|
||||
if(doremove) {
|
||||
unlink(filepath);
|
||||
|
@ -747,7 +747,7 @@ static int validate_deltas(alpm_handle_t *handle, alpm_list_t *deltas,
|
|||
}
|
||||
|
||||
/* Check integrity of deltas */
|
||||
EVENT(handle, ALPM_TRANS_EVT_DELTA_INTEGRITY_START, NULL, NULL);
|
||||
EVENT(handle, ALPM_EVENT_DELTA_INTEGRITY_START, NULL, NULL);
|
||||
|
||||
for(i = deltas; i; i = i->next) {
|
||||
alpm_delta_t *d = alpm_list_getdata(i);
|
||||
|
@ -840,7 +840,7 @@ static int download_files(alpm_handle_t *handle, alpm_list_t **deltas)
|
|||
}
|
||||
|
||||
if(files) {
|
||||
EVENT(handle, ALPM_TRANS_EVT_RETRIEVE_START, current->treename, NULL);
|
||||
EVENT(handle, ALPM_EVENT_RETRIEVE_START, current->treename, NULL);
|
||||
for(j = files; j; j = j->next) {
|
||||
struct dload_payload *payload = j->data;
|
||||
alpm_list_t *server;
|
||||
|
@ -927,7 +927,7 @@ int _alpm_sync_commit(alpm_handle_t *handle, alpm_list_t **data)
|
|||
|
||||
/* Check integrity of packages */
|
||||
numtargs = alpm_list_count(trans->add);
|
||||
EVENT(handle, ALPM_TRANS_EVT_INTEGRITY_START, NULL, NULL);
|
||||
EVENT(handle, ALPM_EVENT_INTEGRITY_START, NULL, NULL);
|
||||
|
||||
current = current_bytes = 0;
|
||||
errors = 0;
|
||||
|
@ -939,7 +939,7 @@ int _alpm_sync_commit(alpm_handle_t *handle, alpm_list_t **data)
|
|||
alpm_siglevel_t level;
|
||||
int percent = (int)(((double)current_bytes / total_bytes) * 100);
|
||||
|
||||
PROGRESS(handle, ALPM_TRANS_PROGRESS_INTEGRITY_START, "", percent,
|
||||
PROGRESS(handle, ALPM_PROGRESS_INTEGRITY_START, "", percent,
|
||||
numtargs, current);
|
||||
if(spkg->origin == PKG_FROM_FILE) {
|
||||
continue; /* pkg_load() has been already called, this package is valid */
|
||||
|
@ -970,9 +970,9 @@ int _alpm_sync_commit(alpm_handle_t *handle, alpm_list_t **data)
|
|||
_alpm_pkg_free_trans(spkg); /* spkg has been removed from the target list */
|
||||
}
|
||||
|
||||
PROGRESS(handle, ALPM_TRANS_PROGRESS_INTEGRITY_START, "", 100,
|
||||
PROGRESS(handle, ALPM_PROGRESS_INTEGRITY_START, "", 100,
|
||||
numtargs, current);
|
||||
EVENT(handle, ALPM_TRANS_EVT_INTEGRITY_DONE, NULL, NULL);
|
||||
EVENT(handle, ALPM_EVENT_INTEGRITY_DONE, NULL, NULL);
|
||||
|
||||
|
||||
if(errors) {
|
||||
|
@ -992,7 +992,7 @@ int _alpm_sync_commit(alpm_handle_t *handle, alpm_list_t **data)
|
|||
|
||||
/* fileconflict check */
|
||||
if(!(trans->flags & ALPM_TRANS_FLAG_FORCE)) {
|
||||
EVENT(handle, ALPM_TRANS_EVT_FILECONFLICTS_START, NULL, NULL);
|
||||
EVENT(handle, ALPM_EVENT_FILECONFLICTS_START, NULL, NULL);
|
||||
|
||||
_alpm_log(handle, ALPM_LOG_DEBUG, "looking for file conflicts\n");
|
||||
alpm_list_t *conflict = _alpm_db_find_fileconflicts(handle,
|
||||
|
@ -1007,12 +1007,12 @@ int _alpm_sync_commit(alpm_handle_t *handle, alpm_list_t **data)
|
|||
RET_ERR(handle, ALPM_ERR_FILE_CONFLICTS, -1);
|
||||
}
|
||||
|
||||
EVENT(handle, ALPM_TRANS_EVT_FILECONFLICTS_DONE, NULL, NULL);
|
||||
EVENT(handle, ALPM_EVENT_FILECONFLICTS_DONE, NULL, NULL);
|
||||
}
|
||||
|
||||
/* check available disk space */
|
||||
if(handle->checkspace) {
|
||||
EVENT(handle, ALPM_TRANS_EVT_DISKSPACE_START, NULL, NULL);
|
||||
EVENT(handle, ALPM_EVENT_DISKSPACE_START, NULL, NULL);
|
||||
|
||||
_alpm_log(handle, ALPM_LOG_DEBUG, "checking available disk space\n");
|
||||
if(_alpm_check_diskspace(handle) == -1) {
|
||||
|
@ -1020,7 +1020,7 @@ int _alpm_sync_commit(alpm_handle_t *handle, alpm_list_t **data)
|
|||
return -1;
|
||||
}
|
||||
|
||||
EVENT(handle, ALPM_TRANS_EVT_DISKSPACE_DONE, NULL, NULL);
|
||||
EVENT(handle, ALPM_EVENT_DISKSPACE_DONE, NULL, NULL);
|
||||
}
|
||||
|
||||
/* remove conflicting and to-be-replaced packages */
|
||||
|
|
|
@ -569,7 +569,7 @@ int _alpm_run_chroot(alpm_handle_t *handle, const char *path, char *const argv[]
|
|||
if(fgets(line, PATH_MAX, pipe_file) == NULL)
|
||||
break;
|
||||
alpm_logaction(handle, "%s", line);
|
||||
EVENT(handle, ALPM_TRANS_EVT_SCRIPTLET_INFO, line, NULL);
|
||||
EVENT(handle, ALPM_EVENT_SCRIPTLET_INFO, line, NULL);
|
||||
}
|
||||
fclose(pipe_file);
|
||||
}
|
||||
|
|
|
@ -151,99 +151,99 @@ static void fill_progress(const int bar_percent, const int disp_percent,
|
|||
|
||||
|
||||
/* callback to handle messages/notifications from libalpm transactions */
|
||||
void cb_trans_evt(alpm_transevt_t event, void *data1, void *data2)
|
||||
void cb_event(alpm_event_t event, void *data1, void *data2)
|
||||
{
|
||||
if(config->print) {
|
||||
return;
|
||||
}
|
||||
switch(event) {
|
||||
case ALPM_TRANS_EVT_CHECKDEPS_START:
|
||||
case ALPM_EVENT_CHECKDEPS_START:
|
||||
printf(_("checking dependencies...\n"));
|
||||
break;
|
||||
case ALPM_TRANS_EVT_FILECONFLICTS_START:
|
||||
case ALPM_EVENT_FILECONFLICTS_START:
|
||||
if(config->noprogressbar) {
|
||||
printf(_("checking for file conflicts...\n"));
|
||||
}
|
||||
break;
|
||||
case ALPM_TRANS_EVT_RESOLVEDEPS_START:
|
||||
case ALPM_EVENT_RESOLVEDEPS_START:
|
||||
printf(_("resolving dependencies...\n"));
|
||||
break;
|
||||
case ALPM_TRANS_EVT_INTERCONFLICTS_START:
|
||||
case ALPM_EVENT_INTERCONFLICTS_START:
|
||||
printf(_("looking for inter-conflicts...\n"));
|
||||
break;
|
||||
case ALPM_TRANS_EVT_ADD_START:
|
||||
case ALPM_EVENT_ADD_START:
|
||||
if(config->noprogressbar) {
|
||||
printf(_("installing %s...\n"), alpm_pkg_get_name(data1));
|
||||
}
|
||||
break;
|
||||
case ALPM_TRANS_EVT_ADD_DONE:
|
||||
case ALPM_EVENT_ADD_DONE:
|
||||
alpm_logaction(config->handle, "installed %s (%s)\n",
|
||||
alpm_pkg_get_name(data1),
|
||||
alpm_pkg_get_version(data1));
|
||||
display_optdepends(data1);
|
||||
break;
|
||||
case ALPM_TRANS_EVT_REMOVE_START:
|
||||
case ALPM_EVENT_REMOVE_START:
|
||||
if(config->noprogressbar) {
|
||||
printf(_("removing %s...\n"), alpm_pkg_get_name(data1));
|
||||
}
|
||||
break;
|
||||
case ALPM_TRANS_EVT_REMOVE_DONE:
|
||||
case ALPM_EVENT_REMOVE_DONE:
|
||||
alpm_logaction(config->handle, "removed %s (%s)\n",
|
||||
alpm_pkg_get_name(data1),
|
||||
alpm_pkg_get_version(data1));
|
||||
break;
|
||||
case ALPM_TRANS_EVT_UPGRADE_START:
|
||||
case ALPM_EVENT_UPGRADE_START:
|
||||
if(config->noprogressbar) {
|
||||
printf(_("upgrading %s...\n"), alpm_pkg_get_name(data1));
|
||||
}
|
||||
break;
|
||||
case ALPM_TRANS_EVT_UPGRADE_DONE:
|
||||
case ALPM_EVENT_UPGRADE_DONE:
|
||||
alpm_logaction(config->handle, "upgraded %s (%s -> %s)\n",
|
||||
(char *)alpm_pkg_get_name(data1),
|
||||
(char *)alpm_pkg_get_version(data2),
|
||||
(char *)alpm_pkg_get_version(data1));
|
||||
display_new_optdepends(data2,data1);
|
||||
break;
|
||||
case ALPM_TRANS_EVT_INTEGRITY_START:
|
||||
case ALPM_EVENT_INTEGRITY_START:
|
||||
if(config->noprogressbar) {
|
||||
printf(_("checking package integrity...\n"));
|
||||
}
|
||||
break;
|
||||
case ALPM_TRANS_EVT_DELTA_INTEGRITY_START:
|
||||
case ALPM_EVENT_DELTA_INTEGRITY_START:
|
||||
printf(_("checking delta integrity...\n"));
|
||||
break;
|
||||
case ALPM_TRANS_EVT_DELTA_PATCHES_START:
|
||||
case ALPM_EVENT_DELTA_PATCHES_START:
|
||||
printf(_("applying deltas...\n"));
|
||||
break;
|
||||
case ALPM_TRANS_EVT_DELTA_PATCH_START:
|
||||
case ALPM_EVENT_DELTA_PATCH_START:
|
||||
printf(_("generating %s with %s... "), (char *)data1, (char *)data2);
|
||||
break;
|
||||
case ALPM_TRANS_EVT_DELTA_PATCH_DONE:
|
||||
case ALPM_EVENT_DELTA_PATCH_DONE:
|
||||
printf(_("success!\n"));
|
||||
break;
|
||||
case ALPM_TRANS_EVT_DELTA_PATCH_FAILED:
|
||||
case ALPM_EVENT_DELTA_PATCH_FAILED:
|
||||
printf(_("failed.\n"));
|
||||
break;
|
||||
case ALPM_TRANS_EVT_SCRIPTLET_INFO:
|
||||
case ALPM_EVENT_SCRIPTLET_INFO:
|
||||
printf("%s", (char *)data1);
|
||||
break;
|
||||
case ALPM_TRANS_EVT_RETRIEVE_START:
|
||||
case ALPM_EVENT_RETRIEVE_START:
|
||||
printf(_(":: Retrieving packages from %s...\n"), (char *)data1);
|
||||
break;
|
||||
case ALPM_TRANS_EVT_DISKSPACE_START:
|
||||
case ALPM_EVENT_DISKSPACE_START:
|
||||
if(config->noprogressbar) {
|
||||
printf(_("checking available disk space...\n"));
|
||||
}
|
||||
break;
|
||||
/* all the simple done events, with fallthrough for each */
|
||||
case ALPM_TRANS_EVT_FILECONFLICTS_DONE:
|
||||
case ALPM_TRANS_EVT_CHECKDEPS_DONE:
|
||||
case ALPM_TRANS_EVT_RESOLVEDEPS_DONE:
|
||||
case ALPM_TRANS_EVT_INTERCONFLICTS_DONE:
|
||||
case ALPM_TRANS_EVT_INTEGRITY_DONE:
|
||||
case ALPM_TRANS_EVT_DELTA_INTEGRITY_DONE:
|
||||
case ALPM_TRANS_EVT_DELTA_PATCHES_DONE:
|
||||
case ALPM_TRANS_EVT_DISKSPACE_DONE:
|
||||
case ALPM_EVENT_FILECONFLICTS_DONE:
|
||||
case ALPM_EVENT_CHECKDEPS_DONE:
|
||||
case ALPM_EVENT_RESOLVEDEPS_DONE:
|
||||
case ALPM_EVENT_INTERCONFLICTS_DONE:
|
||||
case ALPM_EVENT_INTEGRITY_DONE:
|
||||
case ALPM_EVENT_DELTA_INTEGRITY_DONE:
|
||||
case ALPM_EVENT_DELTA_PATCHES_DONE:
|
||||
case ALPM_EVENT_DISKSPACE_DONE:
|
||||
/* nothing */
|
||||
break;
|
||||
}
|
||||
|
@ -252,14 +252,14 @@ void cb_trans_evt(alpm_transevt_t event, void *data1, void *data2)
|
|||
|
||||
/* callback to handle questions from libalpm transactions (yes/no) */
|
||||
/* TODO this is one of the worst ever functions written. void *data ? wtf */
|
||||
void cb_trans_conv(alpm_transconv_t event, void *data1, void *data2,
|
||||
void cb_question(alpm_question_t event, void *data1, void *data2,
|
||||
void *data3, int *response)
|
||||
{
|
||||
if(config->print) {
|
||||
return;
|
||||
}
|
||||
switch(event) {
|
||||
case ALPM_TRANS_CONV_INSTALL_IGNOREPKG:
|
||||
case ALPM_QUESTION_INSTALL_IGNOREPKG:
|
||||
if(!config->op_s_downloadonly) {
|
||||
*response = yesno(_(":: %s is in IgnorePkg/IgnoreGroup. Install anyway?"),
|
||||
alpm_pkg_get_name(data1));
|
||||
|
@ -267,13 +267,13 @@ void cb_trans_conv(alpm_transconv_t event, void *data1, void *data2,
|
|||
*response = 1;
|
||||
}
|
||||
break;
|
||||
case ALPM_TRANS_CONV_REPLACE_PKG:
|
||||
case ALPM_QUESTION_REPLACE_PKG:
|
||||
*response = yesno(_(":: Replace %s with %s/%s?"),
|
||||
alpm_pkg_get_name(data1),
|
||||
(char *)data3,
|
||||
alpm_pkg_get_name(data2));
|
||||
break;
|
||||
case ALPM_TRANS_CONV_CONFLICT_PKG:
|
||||
case ALPM_QUESTION_CONFLICT_PKG:
|
||||
/* data parameters: target package, local package, conflict (strings) */
|
||||
/* print conflict only if it contains new information */
|
||||
if(strcmp(data1, data3) == 0 || strcmp(data2, data3) == 0) {
|
||||
|
@ -289,7 +289,7 @@ void cb_trans_conv(alpm_transconv_t event, void *data1, void *data2,
|
|||
(char *)data2);
|
||||
}
|
||||
break;
|
||||
case ALPM_TRANS_CONV_REMOVE_PKGS:
|
||||
case ALPM_QUESTION_REMOVE_PKGS:
|
||||
{
|
||||
alpm_list_t *unresolved = (alpm_list_t *) data1;
|
||||
alpm_list_t *namelist = NULL, *i;
|
||||
|
@ -312,7 +312,7 @@ void cb_trans_conv(alpm_transconv_t event, void *data1, void *data2,
|
|||
alpm_list_free(namelist);
|
||||
}
|
||||
break;
|
||||
case ALPM_TRANS_CONV_SELECT_PROVIDER:
|
||||
case ALPM_QUESTION_SELECT_PROVIDER:
|
||||
{
|
||||
alpm_list_t *providers = (alpm_list_t *)data1;
|
||||
int count = alpm_list_count(providers);
|
||||
|
@ -324,7 +324,7 @@ void cb_trans_conv(alpm_transconv_t event, void *data1, void *data2,
|
|||
*response = select_question(count);
|
||||
}
|
||||
break;
|
||||
case ALPM_TRANS_CONV_LOCAL_NEWER:
|
||||
case ALPM_QUESTION_LOCAL_NEWER:
|
||||
if(!config->op_s_downloadonly) {
|
||||
*response = yesno(_(":: %s-%s: local version is newer. Upgrade anyway?"),
|
||||
alpm_pkg_get_name(data1),
|
||||
|
@ -333,7 +333,7 @@ void cb_trans_conv(alpm_transconv_t event, void *data1, void *data2,
|
|||
*response = 1;
|
||||
}
|
||||
break;
|
||||
case ALPM_TRANS_CONV_CORRUPTED_PKG:
|
||||
case ALPM_QUESTION_CORRUPTED_PKG:
|
||||
*response = yesno(_(":: File %s is corrupted (%s).\n"
|
||||
"Do you want to delete it?"),
|
||||
(char *)data1,
|
||||
|
@ -349,7 +349,7 @@ void cb_trans_conv(alpm_transconv_t event, void *data1, void *data2,
|
|||
}
|
||||
|
||||
/* callback to handle display of transaction progress */
|
||||
void cb_trans_progress(alpm_transprog_t event, const char *pkgname, int percent,
|
||||
void cb_progress(alpm_progress_t event, const char *pkgname, int percent,
|
||||
size_t howmany, size_t current)
|
||||
{
|
||||
static int prevpercent;
|
||||
|
@ -393,22 +393,22 @@ void cb_trans_progress(alpm_transprog_t event, const char *pkgname, int percent,
|
|||
|
||||
/* set text of message to display */
|
||||
switch (event) {
|
||||
case ALPM_TRANS_PROGRESS_ADD_START:
|
||||
case ALPM_PROGRESS_ADD_START:
|
||||
opr = _("installing");
|
||||
break;
|
||||
case ALPM_TRANS_PROGRESS_UPGRADE_START:
|
||||
case ALPM_PROGRESS_UPGRADE_START:
|
||||
opr = _("upgrading");
|
||||
break;
|
||||
case ALPM_TRANS_PROGRESS_REMOVE_START:
|
||||
case ALPM_PROGRESS_REMOVE_START:
|
||||
opr = _("removing");
|
||||
break;
|
||||
case ALPM_TRANS_PROGRESS_CONFLICTS_START:
|
||||
case ALPM_PROGRESS_CONFLICTS_START:
|
||||
opr = _("checking for file conflicts");
|
||||
break;
|
||||
case ALPM_TRANS_PROGRESS_DISKSPACE_START:
|
||||
case ALPM_PROGRESS_DISKSPACE_START:
|
||||
opr = _("checking available disk space");
|
||||
break;
|
||||
case ALPM_TRANS_PROGRESS_INTEGRITY_START:
|
||||
case ALPM_PROGRESS_INTEGRITY_START:
|
||||
opr = _("checking package integrity");
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -24,15 +24,15 @@
|
|||
|
||||
#include <alpm.h>
|
||||
|
||||
/* callback to handle messages/notifications from libalpm transactions */
|
||||
void cb_trans_evt(alpm_transevt_t event, void *data1, void *data2);
|
||||
/* callback to handle messages/notifications from libalpm */
|
||||
void cb_event(alpm_event_t event, void *data1, void *data2);
|
||||
|
||||
/* callback to handle questions from libalpm transactions (yes/no) */
|
||||
void cb_trans_conv(alpm_transconv_t event, void *data1, void *data2,
|
||||
/* callback to handle questions from libalpm (yes/no) */
|
||||
void cb_question(alpm_question_t event, void *data1, void *data2,
|
||||
void *data3, int *response);
|
||||
|
||||
/* callback to handle display of transaction progress */
|
||||
void cb_trans_progress(alpm_transprog_t event, const char *pkgname, int percent,
|
||||
/* callback to handle display of progress */
|
||||
void cb_progress(alpm_progress_t event, const char *pkgname, int percent,
|
||||
size_t howmany, size_t remain);
|
||||
|
||||
/* callback to handle receipt of total download value */
|
||||
|
|
|
@ -534,9 +534,9 @@ static int setup_libalpm(void)
|
|||
|
||||
alpm_option_set_logcb(handle, cb_log);
|
||||
alpm_option_set_dlcb(handle, cb_dl_progress);
|
||||
alpm_option_set_eventcb(handle, cb_trans_evt);
|
||||
alpm_option_set_convcb(handle, cb_trans_conv);
|
||||
alpm_option_set_progresscb(handle, cb_trans_progress);
|
||||
alpm_option_set_eventcb(handle, cb_event);
|
||||
alpm_option_set_questioncb(handle, cb_question);
|
||||
alpm_option_set_progresscb(handle, cb_progress);
|
||||
|
||||
config->logfile = config->logfile ? config->logfile : strdup(LOGFILE);
|
||||
ret = alpm_option_set_logfile(handle, config->logfile);
|
||||
|
|
Loading…
Reference in New Issue