index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
-rw-r--r-- | lib/libalpm/add.c | 20 | ||||
-rw-r--r-- | lib/libalpm/alpm.h | 250 | ||||
-rw-r--r-- | lib/libalpm/conflict.c | 4 | ||||
-rw-r--r-- | lib/libalpm/deps.c | 6 | ||||
-rw-r--r-- | lib/libalpm/diskspace.c | 6 | ||||
-rw-r--r-- | lib/libalpm/handle.c | 8 | ||||
-rw-r--r-- | lib/libalpm/handle.h | 6 | ||||
-rw-r--r-- | lib/libalpm/remove.c | 14 | ||||
-rw-r--r-- | lib/libalpm/sync.c | 48 | ||||
-rw-r--r-- | lib/libalpm/util.c | 2 |
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c index 96272a25..b526145a 100644 --- a/lib/libalpm/add.c +++ b/lib/libalpm/add.c @@ -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: diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index d2512ff2..cd124e5f 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -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 diff --git a/lib/libalpm/conflict.c b/lib/libalpm/conflict.c index 4f96ad9a..1c02f184 100644 --- a/lib/libalpm/conflict.c +++ b/lib/libalpm/conflict.c @@ -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; diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c index 104c97ba..0da20c16 100644 --- a/lib/libalpm/deps.c +++ b/lib/libalpm/deps.c @@ -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) { diff --git a/lib/libalpm/diskspace.c b/lib/libalpm/diskspace.c index f791c07b..480c85f6 100644 --- a/lib/libalpm/diskspace.c +++ b/lib/libalpm/diskspace.c @@ -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) { diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c index bc968c72..5fb4f2bb 100644 --- a/lib/libalpm/handle.c +++ b/lib/libalpm/handle.c @@ -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; } diff --git a/lib/libalpm/handle.h b/lib/libalpm/handle.h index 8ceecd32..b1d70d2d 100644 --- a/lib/libalpm/handle.h +++ b/lib/libalpm/handle.h @@ -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 */ diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c index 8867f651..8021702e 100644 --- a/lib/libalpm/remove.c +++ b/lib/libalpm/remove.c @@ -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; diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index 95b5f9dc..d50ae842 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -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 */ diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c index 161a35a9..44dead83 100644 --- a/lib/libalpm/util.c +++ b/lib/libalpm/util.c @@ -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); } |