summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/deps.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-06-07 23:13:58 +0200
committerDan McGee <dan@archlinux.org>2011-06-14 02:41:16 +0200
commit52bffd2457b7ba3b6fb08d3aa959ea0b53a45dc8 (patch)
treef426280f674b10c2175bd99feba8ec0e42d7b0de /lib/libalpm/deps.c
parente2aa952689da8763d534d1c19310eb97009f4f76 (diff)
downloadpacman-52bffd2457b7ba3b6fb08d3aa959ea0b53a45dc8.tar.gz
pacman-52bffd2457b7ba3b6fb08d3aa959ea0b53a45dc8.tar.xz
Switch all logging to use handle directly
This is the last user of our global handle object. Once again the diff is large but the functional changes are not. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/deps.c')
-rw-r--r--lib/libalpm/deps.c48
1 files changed, 18 insertions, 30 deletions
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index 7b13a101..db4130c3 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -126,7 +126,8 @@ static alpm_list_t *dep_graph_init(alpm_list_t *targets)
* This function returns the new alpm_list_t* target list.
*
*/
-alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, int reverse)
+alpm_list_t *_alpm_sortbydeps(pmhandle_t *handle,
+ alpm_list_t *targets, int reverse)
{
alpm_list_t *newtargs = NULL;
alpm_list_t *vertices = NULL;
@@ -137,7 +138,7 @@ alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, int reverse)
return NULL;
}
- _alpm_log(PM_LOG_DEBUG, "started sorting dependencies\n");
+ _alpm_log(handle, PM_LOG_DEBUG, "started sorting dependencies\n");
vertices = dep_graph_init(targets);
@@ -160,13 +161,13 @@ alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, int reverse)
pmpkg_t *childpkg = nextchild->data;
const char *message;
- _alpm_log(PM_LOG_WARNING, _("dependency cycle detected:\n"));
+ _alpm_log(handle, PM_LOG_WARNING, _("dependency cycle detected:\n"));
if(reverse) {
message =_("%s will be removed after its %s dependency\n");
} else {
message =_("%s will be installed before its %s dependency\n");
}
- _alpm_log(PM_LOG_WARNING, message, vertexpkg->name, childpkg->name);
+ _alpm_log(handle, PM_LOG_WARNING, message, vertexpkg->name, childpkg->name);
}
}
if(!found) {
@@ -185,7 +186,7 @@ alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, int reverse)
}
}
- _alpm_log(PM_LOG_DEBUG, "sorting dependencies finished\n");
+ _alpm_log(handle, PM_LOG_DEBUG, "sorting dependencies finished\n");
if(reverse) {
/* reverse the order */
@@ -288,7 +289,7 @@ alpm_list_t SYMEXPORT *alpm_checkdeps(pmhandle_t *handle, alpm_list_t *pkglist,
/* look for unsatisfied dependencies of the upgrade list */
for(i = upgrade; i; i = i->next) {
pmpkg_t *tp = i->data;
- _alpm_log(PM_LOG_DEBUG, "checkdeps: package %s-%s\n",
+ _alpm_log(handle, PM_LOG_DEBUG, "checkdeps: package %s-%s\n",
alpm_pkg_get_name(tp), alpm_pkg_get_version(tp));
for(j = alpm_pkg_get_depends(tp); j; j = j->next) {
@@ -301,7 +302,7 @@ alpm_list_t SYMEXPORT *alpm_checkdeps(pmhandle_t *handle, alpm_list_t *pkglist,
/* Unsatisfied dependency in the upgrade list */
pmdepmissing_t *miss;
char *missdepstring = alpm_dep_compute_string(depend);
- _alpm_log(PM_LOG_DEBUG, "checkdeps: missing dependency '%s' for package '%s'\n",
+ _alpm_log(handle, PM_LOG_DEBUG, "checkdeps: missing dependency '%s' for package '%s'\n",
missdepstring, alpm_pkg_get_name(tp));
free(missdepstring);
miss = depmiss_new(alpm_pkg_get_name(tp), depend, NULL);
@@ -328,7 +329,7 @@ alpm_list_t SYMEXPORT *alpm_checkdeps(pmhandle_t *handle, alpm_list_t *pkglist,
!find_dep_satisfier(dblist, depend)) {
pmdepmissing_t *miss;
char *missdepstring = alpm_dep_compute_string(depend);
- _alpm_log(PM_LOG_DEBUG, "checkdeps: transaction would break '%s' dependency of '%s'\n",
+ _alpm_log(handle, PM_LOG_DEBUG, "checkdeps: transaction would break '%s' dependency of '%s'\n",
missdepstring, alpm_pkg_get_name(lp));
free(missdepstring);
miss = depmiss_new(lp->name, depend, alpm_pkg_get_name(causingpkg));
@@ -481,7 +482,7 @@ static int can_remove_package(pmdb_t *db, pmpkg_t *pkg, alpm_list_t *targets,
if(!include_explicit) {
/* see if it was explicitly installed */
if(alpm_pkg_get_reason(pkg) == PM_PKG_REASON_EXPLICIT) {
- _alpm_log(PM_LOG_DEBUG, "excluding %s -- explicitly installed\n",
+ _alpm_log(db->handle, PM_LOG_DEBUG, "excluding %s -- explicitly installed\n",
alpm_pkg_get_name(pkg));
return 0;
}
@@ -529,7 +530,7 @@ void _alpm_recursedeps(pmdb_t *db, alpm_list_t *targs, int include_explicit)
pmpkg_t *deppkg = j->data;
if(_alpm_dep_edge(pkg, deppkg)
&& can_remove_package(db, deppkg, targs, include_explicit)) {
- _alpm_log(PM_LOG_DEBUG, "adding '%s' to the targets\n",
+ _alpm_log(db->handle, PM_LOG_DEBUG, "adding '%s' to the targets\n",
alpm_pkg_get_name(deppkg));
/* add it to the target list */
targs = alpm_list_add(targs, _alpm_pkg_dup(deppkg));
@@ -570,7 +571,7 @@ static pmpkg_t *resolvedep(pmhandle_t *handle, pmdepend_t *dep,
QUESTION(handle->trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, pkg,
NULL, NULL, &install);
} else {
- _alpm_log(PM_LOG_WARNING, _("ignoring package %s-%s\n"), pkg->name, pkg->version);
+ _alpm_log(handle, PM_LOG_WARNING, _("ignoring package %s-%s\n"), pkg->name, pkg->version);
}
if(!install) {
ignored = 1;
@@ -592,14 +593,14 @@ static pmpkg_t *resolvedep(pmhandle_t *handle, pmdepend_t *dep,
QUESTION(handle->trans, PM_TRANS_CONV_INSTALL_IGNOREPKG,
pkg, NULL, NULL, &install);
} else {
- _alpm_log(PM_LOG_WARNING, _("ignoring package %s-%s\n"), pkg->name, pkg->version);
+ _alpm_log(handle, PM_LOG_WARNING, _("ignoring package %s-%s\n"), pkg->name, pkg->version);
}
if(!install) {
ignored = 1;
continue;
}
}
- _alpm_log(PM_LOG_DEBUG, "provider found (%s provides %s)\n",
+ _alpm_log(handle, PM_LOG_DEBUG, "provider found (%s provides %s)\n",
pkg->name, dep->name);
providers = alpm_list_add(providers, pkg);
/* keep looking for other providers in the all dbs */
@@ -706,7 +707,7 @@ int _alpm_resolvedeps(pmhandle_t *handle, alpm_list_t *localpkgs, pmpkg_t *pkg,
on that list */
*packages = alpm_list_add(*packages, pkg);
- _alpm_log(PM_LOG_DEBUG, "started resolving dependencies\n");
+ _alpm_log(handle, PM_LOG_DEBUG, "started resolving dependencies\n");
for(i = alpm_list_last(*packages); i; i = i->next) {
pmpkg_t *tpkg = i->data;
targ = alpm_list_add(NULL, tpkg);
@@ -732,7 +733,7 @@ int _alpm_resolvedeps(pmhandle_t *handle, alpm_list_t *localpkgs, pmpkg_t *pkg,
if(!spkg) {
handle->pm_errno = PM_ERR_UNSATISFIED_DEPS;
char *missdepstring = alpm_dep_compute_string(missdep);
- _alpm_log(PM_LOG_WARNING,
+ _alpm_log(handle, PM_LOG_WARNING,
_("cannot resolve \"%s\", a dependency of \"%s\"\n"),
missdepstring, tpkg->name);
free(missdepstring);
@@ -741,7 +742,7 @@ int _alpm_resolvedeps(pmhandle_t *handle, alpm_list_t *localpkgs, pmpkg_t *pkg,
}
ret = -1;
} else {
- _alpm_log(PM_LOG_DEBUG, "pulling dependency %s (needed by %s)\n",
+ _alpm_log(handle, PM_LOG_DEBUG, "pulling dependency %s (needed by %s)\n",
alpm_pkg_get_name(spkg), alpm_pkg_get_name(tpkg));
*packages = alpm_list_add(*packages, spkg);
_alpm_depmiss_free(miss);
@@ -756,55 +757,43 @@ int _alpm_resolvedeps(pmhandle_t *handle, alpm_list_t *localpkgs, pmpkg_t *pkg,
} else {
alpm_list_free(packages_copy);
}
- _alpm_log(PM_LOG_DEBUG, "finished resolving dependencies\n");
+ _alpm_log(handle, PM_LOG_DEBUG, "finished resolving dependencies\n");
return ret;
}
const char SYMEXPORT *alpm_miss_get_target(const pmdepmissing_t *miss)
{
- /* Sanity checks */
ASSERT(miss != NULL, return NULL);
-
return miss->target;
}
const char SYMEXPORT *alpm_miss_get_causingpkg(const pmdepmissing_t *miss)
{
- /* Sanity checks */
ASSERT(miss != NULL, return NULL);
-
return miss->causingpkg;
}
pmdepend_t SYMEXPORT *alpm_miss_get_dep(pmdepmissing_t *miss)
{
- /* Sanity checks */
ASSERT(miss != NULL, return NULL);
-
return miss->depend;
}
pmdepmod_t SYMEXPORT alpm_dep_get_mod(const pmdepend_t *dep)
{
- /* Sanity checks */
ASSERT(dep != NULL, return -1);
-
return dep->mod;
}
const char SYMEXPORT *alpm_dep_get_name(const pmdepend_t *dep)
{
- /* Sanity checks */
ASSERT(dep != NULL, return NULL);
-
return dep->name;
}
const char SYMEXPORT *alpm_dep_get_version(const pmdepend_t *dep)
{
- /* Sanity checks */
ASSERT(dep != NULL, return NULL);
-
return dep->version;
}
@@ -819,7 +808,6 @@ char SYMEXPORT *alpm_dep_compute_string(const pmdepend_t *dep)
char *str;
size_t len;
- /* Sanity checks */
ASSERT(dep != NULL, return NULL);
if(dep->name) {