new pmdepend_t / pmdepmissing_t accessors.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
ab2354e762
commit
99572ed8f6
|
@ -353,12 +353,13 @@ typedef enum _pmdeptype_t {
|
||||||
pmdepend_t *alpm_splitdep(const char *depstring);
|
pmdepend_t *alpm_splitdep(const char *depstring);
|
||||||
int alpm_depcmp(pmpkg_t *pkg, pmdepend_t *dep);
|
int alpm_depcmp(pmpkg_t *pkg, pmdepend_t *dep);
|
||||||
|
|
||||||
const char *alpm_dep_get_target(pmdepmissing_t *miss);
|
const char *alpm_miss_get_target(pmdepmissing_t *miss);
|
||||||
pmdeptype_t alpm_dep_get_type(pmdepmissing_t *miss);
|
pmdeptype_t alpm_miss_get_type(pmdepmissing_t *miss);
|
||||||
pmdepmod_t alpm_dep_get_mod(pmdepmissing_t *miss);
|
pmdepend_t *alpm_miss_get_dep(pmdepmissing_t *miss);
|
||||||
const char *alpm_dep_get_name(pmdepmissing_t *miss);
|
|
||||||
const char *alpm_dep_get_version(pmdepmissing_t *miss);
|
pmdepmod_t alpm_dep_get_mod(pmdepend_t *dep);
|
||||||
const char *alpm_depend_get_name(pmdepend_t *dep);
|
const char *alpm_dep_get_name(pmdepend_t *dep);
|
||||||
|
const char *alpm_dep_get_version(pmdepend_t *dep);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* File conflicts
|
* File conflicts
|
||||||
|
|
|
@ -734,7 +734,7 @@ error:
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_dep_get_target(pmdepmissing_t *miss)
|
const char SYMEXPORT *alpm_miss_get_target(pmdepmissing_t *miss)
|
||||||
{
|
{
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
|
@ -745,7 +745,7 @@ const char SYMEXPORT *alpm_dep_get_target(pmdepmissing_t *miss)
|
||||||
return miss->target;
|
return miss->target;
|
||||||
}
|
}
|
||||||
|
|
||||||
pmdeptype_t SYMEXPORT alpm_dep_get_type(pmdepmissing_t *miss)
|
pmdeptype_t SYMEXPORT alpm_miss_get_type(pmdepmissing_t *miss)
|
||||||
{
|
{
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
|
@ -756,40 +756,29 @@ pmdeptype_t SYMEXPORT alpm_dep_get_type(pmdepmissing_t *miss)
|
||||||
return miss->type;
|
return miss->type;
|
||||||
}
|
}
|
||||||
|
|
||||||
pmdepmod_t SYMEXPORT alpm_dep_get_mod(pmdepmissing_t *miss)
|
pmdepend_t SYMEXPORT *alpm_miss_get_dep(pmdepmissing_t *miss)
|
||||||
|
{
|
||||||
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
|
/* Sanity checks */
|
||||||
|
ASSERT(handle != NULL, return(NULL));
|
||||||
|
ASSERT(miss != NULL, return(NULL));
|
||||||
|
|
||||||
|
return &miss->depend;
|
||||||
|
}
|
||||||
|
|
||||||
|
pmdepmod_t SYMEXPORT alpm_dep_get_mod(pmdepend_t *dep)
|
||||||
{
|
{
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
ASSERT(handle != NULL, return(-1));
|
ASSERT(handle != NULL, return(-1));
|
||||||
ASSERT(miss != NULL, return(-1));
|
ASSERT(dep != NULL, return(-1));
|
||||||
|
|
||||||
return miss->depend.mod;
|
return dep->mod;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_dep_get_name(pmdepmissing_t *miss)
|
const char SYMEXPORT *alpm_dep_get_name(pmdepend_t *dep)
|
||||||
{
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
/* Sanity checks */
|
|
||||||
ASSERT(handle != NULL, return(NULL));
|
|
||||||
ASSERT(miss != NULL, return(NULL));
|
|
||||||
|
|
||||||
return miss->depend.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_dep_get_version(pmdepmissing_t *miss)
|
|
||||||
{
|
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
/* Sanity checks */
|
|
||||||
ASSERT(handle != NULL, return(NULL));
|
|
||||||
ASSERT(miss != NULL, return(NULL));
|
|
||||||
|
|
||||||
return miss->depend.version;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_depend_get_name(pmdepend_t *dep)
|
|
||||||
{
|
{
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
|
@ -800,4 +789,15 @@ const char SYMEXPORT *alpm_depend_get_name(pmdepend_t *dep)
|
||||||
return dep->name;
|
return dep->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char SYMEXPORT *alpm_dep_get_version(pmdepend_t *dep)
|
||||||
|
{
|
||||||
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
|
/* Sanity checks */
|
||||||
|
ASSERT(handle != NULL, return(NULL));
|
||||||
|
ASSERT(dep != NULL, return(NULL));
|
||||||
|
|
||||||
|
return dep->version;
|
||||||
|
}
|
||||||
|
|
||||||
/* vim: set ts=2 sw=2 noet: */
|
/* vim: set ts=2 sw=2 noet: */
|
||||||
|
|
|
@ -136,23 +136,24 @@ int pacman_add(alpm_list_t *targets)
|
||||||
case PM_ERR_UNSATISFIED_DEPS:
|
case PM_ERR_UNSATISFIED_DEPS:
|
||||||
for(i = data; i; i = alpm_list_next(i)) {
|
for(i = data; i; i = alpm_list_next(i)) {
|
||||||
pmdepmissing_t *miss = alpm_list_getdata(i);
|
pmdepmissing_t *miss = alpm_list_getdata(i);
|
||||||
|
pmdepend_t *dep = alpm_miss_get_dep(miss);
|
||||||
|
|
||||||
/* TODO indicate if the error was a virtual package or not:
|
/* TODO indicate if the error was a virtual package or not:
|
||||||
* :: %s: requires %s, provided by %s
|
* :: %s: requires %s, provided by %s
|
||||||
*/
|
*/
|
||||||
printf(_(":: %s: requires %s"), alpm_dep_get_target(miss),
|
printf(_(":: %s: requires %s\n"), alpm_miss_get_target(miss),
|
||||||
alpm_dep_get_name(miss));
|
alpm_dep_get_name(dep));
|
||||||
switch(alpm_dep_get_mod(miss)) {
|
switch(alpm_dep_get_mod(dep)) {
|
||||||
case PM_DEP_MOD_ANY:
|
case PM_DEP_MOD_ANY:
|
||||||
break;
|
break;
|
||||||
case PM_DEP_MOD_EQ:
|
case PM_DEP_MOD_EQ:
|
||||||
printf("=%s", alpm_dep_get_version(miss));
|
printf("=%s", alpm_dep_get_version(dep));
|
||||||
break;
|
break;
|
||||||
case PM_DEP_MOD_GE:
|
case PM_DEP_MOD_GE:
|
||||||
printf(">=%s", alpm_dep_get_version(miss));
|
printf(">=%s", alpm_dep_get_version(dep));
|
||||||
break;
|
break;
|
||||||
case PM_DEP_MOD_LE:
|
case PM_DEP_MOD_LE:
|
||||||
printf("<=%s", alpm_dep_get_version(miss));
|
printf("<=%s", alpm_dep_get_version(dep));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
@ -161,8 +162,9 @@ int pacman_add(alpm_list_t *targets)
|
||||||
case PM_ERR_CONFLICTING_DEPS:
|
case PM_ERR_CONFLICTING_DEPS:
|
||||||
for(i = data; i; i = alpm_list_next(i)) {
|
for(i = data; i; i = alpm_list_next(i)) {
|
||||||
pmdepmissing_t *miss = alpm_list_getdata(i);
|
pmdepmissing_t *miss = alpm_list_getdata(i);
|
||||||
|
pmdepend_t *dep = alpm_miss_get_dep(miss);
|
||||||
printf(_(":: %s: conflicts with %s"),
|
printf(_(":: %s: conflicts with %s"),
|
||||||
alpm_dep_get_target(miss), alpm_dep_get_name(miss));
|
alpm_miss_get_target(miss), alpm_dep_get_name(dep));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PM_ERR_FILE_CONFLICTS:
|
case PM_ERR_FILE_CONFLICTS:
|
||||||
|
|
|
@ -56,13 +56,13 @@ int pacman_deptest(alpm_list_t *targets)
|
||||||
dep = alpm_splitdep(target);
|
dep = alpm_splitdep(target);
|
||||||
|
|
||||||
pkg = alpm_db_get_pkg(alpm_option_get_localdb(),
|
pkg = alpm_db_get_pkg(alpm_option_get_localdb(),
|
||||||
alpm_depend_get_name(dep));
|
alpm_dep_get_name(dep));
|
||||||
if(pkg && alpm_depcmp(pkg, dep)) {
|
if(pkg && alpm_depcmp(pkg, dep)) {
|
||||||
found = 1;
|
found = 1;
|
||||||
} else {
|
} else {
|
||||||
/* not found, can we find anything that provides this in the local DB? */
|
/* not found, can we find anything that provides this in the local DB? */
|
||||||
provides = alpm_db_whatprovides(alpm_option_get_localdb(),
|
provides = alpm_db_whatprovides(alpm_option_get_localdb(),
|
||||||
alpm_depend_get_name(dep));
|
alpm_dep_get_name(dep));
|
||||||
for(j = provides; j; j = alpm_list_next(j)) {
|
for(j = provides; j; j = alpm_list_next(j)) {
|
||||||
pmpkg_t *pkg;
|
pmpkg_t *pkg;
|
||||||
pkg = alpm_list_getdata(j);
|
pkg = alpm_list_getdata(j);
|
||||||
|
|
|
@ -128,8 +128,9 @@ int pacman_remove(alpm_list_t *targets)
|
||||||
case PM_ERR_UNSATISFIED_DEPS:
|
case PM_ERR_UNSATISFIED_DEPS:
|
||||||
for(i = data; i; i = alpm_list_next(i)) {
|
for(i = data; i; i = alpm_list_next(i)) {
|
||||||
pmdepmissing_t *miss = alpm_list_getdata(i);
|
pmdepmissing_t *miss = alpm_list_getdata(i);
|
||||||
printf(_(":: %s depends on %s\n"), alpm_dep_get_target(miss),
|
pmdepend_t *dep = alpm_miss_get_dep(miss);
|
||||||
alpm_dep_get_name(miss));
|
printf(_(":: %s: requires %s\n"), alpm_miss_get_target(miss),
|
||||||
|
alpm_dep_get_name(dep));
|
||||||
}
|
}
|
||||||
alpm_list_free(data);
|
alpm_list_free(data);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -650,19 +650,20 @@ int pacman_sync(alpm_list_t *targets)
|
||||||
case PM_ERR_UNSATISFIED_DEPS:
|
case PM_ERR_UNSATISFIED_DEPS:
|
||||||
for(i = data; i; i = alpm_list_next(i)) {
|
for(i = data; i; i = alpm_list_next(i)) {
|
||||||
pmdepmissing_t *miss = alpm_list_getdata(i);
|
pmdepmissing_t *miss = alpm_list_getdata(i);
|
||||||
printf(_(":: %s depends on %s\n"), alpm_dep_get_target(miss),
|
pmdepend_t *dep = alpm_miss_get_dep(miss);
|
||||||
alpm_dep_get_name(miss));
|
printf(_(":: %s: requires %s\n"), alpm_miss_get_target(miss),
|
||||||
switch(alpm_dep_get_mod(miss)) {
|
alpm_dep_get_name(dep));
|
||||||
|
switch(alpm_dep_get_mod(dep)) {
|
||||||
case PM_DEP_MOD_ANY:
|
case PM_DEP_MOD_ANY:
|
||||||
break;
|
break;
|
||||||
case PM_DEP_MOD_EQ:
|
case PM_DEP_MOD_EQ:
|
||||||
printf("=%s", alpm_dep_get_version(miss));
|
printf("=%s", alpm_dep_get_version(dep));
|
||||||
break;
|
break;
|
||||||
case PM_DEP_MOD_GE:
|
case PM_DEP_MOD_GE:
|
||||||
printf(">=%s", alpm_dep_get_version(miss));
|
printf(">=%s", alpm_dep_get_version(dep));
|
||||||
break;
|
break;
|
||||||
case PM_DEP_MOD_LE:
|
case PM_DEP_MOD_LE:
|
||||||
printf("<=%s", alpm_dep_get_version(miss));
|
printf("<=%s", alpm_dep_get_version(dep));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
@ -671,9 +672,9 @@ int pacman_sync(alpm_list_t *targets)
|
||||||
case PM_ERR_CONFLICTING_DEPS:
|
case PM_ERR_CONFLICTING_DEPS:
|
||||||
for(i = data; i; i = alpm_list_next(i)) {
|
for(i = data; i; i = alpm_list_next(i)) {
|
||||||
pmdepmissing_t *miss = alpm_list_getdata(i);
|
pmdepmissing_t *miss = alpm_list_getdata(i);
|
||||||
|
pmdepend_t *dep = alpm_miss_get_dep(miss);
|
||||||
printf(_(":: %s: conflicts with %s"),
|
printf(_(":: %s: conflicts with %s"),
|
||||||
alpm_dep_get_target(miss), alpm_dep_get_name(miss));
|
alpm_miss_get_target(miss), alpm_dep_get_name(dep));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue