Merge branch 'maint'
Conflicts: lib/libalpm/deps.c
This commit is contained in:
commit
3f269503d5
5 changed files with 113 additions and 108 deletions
|
@ -43,7 +43,7 @@ void _alpm_dep_free(pmdepend_t *dep)
|
||||||
FREE(dep);
|
FREE(dep);
|
||||||
}
|
}
|
||||||
|
|
||||||
pmdepmissing_t *_alpm_depmiss_new(const char *target, pmdepend_t *dep,
|
static pmdepmissing_t *depmiss_new(const char *target, pmdepend_t *dep,
|
||||||
const char *causingpkg)
|
const char *causingpkg)
|
||||||
{
|
{
|
||||||
pmdepmissing_t *miss;
|
pmdepmissing_t *miss;
|
||||||
|
@ -67,6 +67,18 @@ void _alpm_depmiss_free(pmdepmissing_t *miss)
|
||||||
FREE(miss);
|
FREE(miss);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Does pkg1 depend on pkg2, ie. does pkg2 satisfy a dependency of pkg1? */
|
||||||
|
static int _alpm_dep_edge(pmpkg_t *pkg1, pmpkg_t *pkg2)
|
||||||
|
{
|
||||||
|
alpm_list_t *i;
|
||||||
|
for(i = alpm_pkg_get_depends(pkg1); i; i = i->next) {
|
||||||
|
if(_alpm_depcmp(pkg2, i->data)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Convert a list of pmpkg_t * to a graph structure,
|
/* Convert a list of pmpkg_t * to a graph structure,
|
||||||
* with a edge for each dependency.
|
* with a edge for each dependency.
|
||||||
* Returns a list of vertices (one vertex = one package)
|
* Returns a list of vertices (one vertex = one package)
|
||||||
|
@ -192,13 +204,37 @@ alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, int reverse)
|
||||||
return newtargs;
|
return newtargs;
|
||||||
}
|
}
|
||||||
|
|
||||||
pmpkg_t *_alpm_find_dep_satisfier(alpm_list_t *pkgs, pmdepend_t *dep)
|
static int no_dep_version(void)
|
||||||
|
{
|
||||||
|
int flags = alpm_trans_get_flags();
|
||||||
|
return flags != -1 && (flags & PM_TRANS_FLAG_NODEPVERSION);
|
||||||
|
}
|
||||||
|
|
||||||
|
static pmdepend_t *filtered_depend(pmdepend_t *dep, int nodepversion)
|
||||||
|
{
|
||||||
|
if(nodepversion) {
|
||||||
|
pmdepend_t *newdep = _alpm_dep_dup(dep);
|
||||||
|
ASSERT(newdep, return dep);
|
||||||
|
newdep->mod = PM_DEP_MOD_ANY;
|
||||||
|
dep = newdep;
|
||||||
|
}
|
||||||
|
return dep;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void release_filtered_depend(pmdepend_t *dep, int nodepversion)
|
||||||
|
{
|
||||||
|
if(nodepversion) {
|
||||||
|
free(dep);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static pmpkg_t *find_dep_satisfier(alpm_list_t *pkgs, pmdepend_t *dep)
|
||||||
{
|
{
|
||||||
alpm_list_t *i;
|
alpm_list_t *i;
|
||||||
|
|
||||||
for(i = pkgs; i; i = alpm_list_next(i)) {
|
for(i = pkgs; i; i = alpm_list_next(i)) {
|
||||||
pmpkg_t *pkg = i->data;
|
pmpkg_t *pkg = i->data;
|
||||||
if(_alpm_depcmp_tolerant(pkg, dep)) {
|
if(_alpm_depcmp(pkg, dep)) {
|
||||||
return pkg;
|
return pkg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -214,7 +250,7 @@ pmpkg_t *_alpm_find_dep_satisfier(alpm_list_t *pkgs, pmdepend_t *dep)
|
||||||
pmpkg_t SYMEXPORT *alpm_find_satisfier(alpm_list_t *pkgs, const char *depstring)
|
pmpkg_t SYMEXPORT *alpm_find_satisfier(alpm_list_t *pkgs, const char *depstring)
|
||||||
{
|
{
|
||||||
pmdepend_t *dep = _alpm_splitdep(depstring);
|
pmdepend_t *dep = _alpm_splitdep(depstring);
|
||||||
pmpkg_t *pkg = _alpm_find_dep_satisfier(pkgs, dep);
|
pmpkg_t *pkg = find_dep_satisfier(pkgs, dep);
|
||||||
_alpm_dep_free(dep);
|
_alpm_dep_free(dep);
|
||||||
return pkg;
|
return pkg;
|
||||||
}
|
}
|
||||||
|
@ -233,6 +269,7 @@ alpm_list_t SYMEXPORT *alpm_checkdeps(alpm_list_t *pkglist, int reversedeps,
|
||||||
alpm_list_t *i, *j;
|
alpm_list_t *i, *j;
|
||||||
alpm_list_t *targets, *dblist = NULL, *modified = NULL;
|
alpm_list_t *targets, *dblist = NULL, *modified = NULL;
|
||||||
alpm_list_t *baddeps = NULL;
|
alpm_list_t *baddeps = NULL;
|
||||||
|
int nodepversion;
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
|
@ -247,6 +284,8 @@ alpm_list_t SYMEXPORT *alpm_checkdeps(alpm_list_t *pkglist, int reversedeps,
|
||||||
}
|
}
|
||||||
alpm_list_free(targets);
|
alpm_list_free(targets);
|
||||||
|
|
||||||
|
nodepversion = no_dep_version();
|
||||||
|
|
||||||
/* look for unsatisfied dependencies of the upgrade list */
|
/* look for unsatisfied dependencies of the upgrade list */
|
||||||
for(i = upgrade; i; i = i->next) {
|
for(i = upgrade; i; i = i->next) {
|
||||||
pmpkg_t *tp = i->data;
|
pmpkg_t *tp = i->data;
|
||||||
|
@ -255,19 +294,21 @@ alpm_list_t SYMEXPORT *alpm_checkdeps(alpm_list_t *pkglist, int reversedeps,
|
||||||
|
|
||||||
for(j = alpm_pkg_get_depends(tp); j; j = j->next) {
|
for(j = alpm_pkg_get_depends(tp); j; j = j->next) {
|
||||||
pmdepend_t *depend = j->data;
|
pmdepend_t *depend = j->data;
|
||||||
|
depend = filtered_depend(depend, nodepversion);
|
||||||
/* 1. we check the upgrade list */
|
/* 1. we check the upgrade list */
|
||||||
/* 2. we check database for untouched satisfying packages */
|
/* 2. we check database for untouched satisfying packages */
|
||||||
if(!_alpm_find_dep_satisfier(upgrade, depend) &&
|
if(!find_dep_satisfier(upgrade, depend) &&
|
||||||
!_alpm_find_dep_satisfier(dblist, depend)) {
|
!find_dep_satisfier(dblist, depend)) {
|
||||||
/* Unsatisfied dependency in the upgrade list */
|
/* Unsatisfied dependency in the upgrade list */
|
||||||
pmdepmissing_t *miss;
|
pmdepmissing_t *miss;
|
||||||
char *missdepstring = alpm_dep_compute_string(depend);
|
char *missdepstring = alpm_dep_compute_string(depend);
|
||||||
_alpm_log(PM_LOG_DEBUG, "checkdeps: missing dependency '%s' for package '%s'\n",
|
_alpm_log(PM_LOG_DEBUG, "checkdeps: missing dependency '%s' for package '%s'\n",
|
||||||
missdepstring, alpm_pkg_get_name(tp));
|
missdepstring, alpm_pkg_get_name(tp));
|
||||||
free(missdepstring);
|
free(missdepstring);
|
||||||
miss = _alpm_depmiss_new(alpm_pkg_get_name(tp), depend, NULL);
|
miss = depmiss_new(alpm_pkg_get_name(tp), depend, NULL);
|
||||||
baddeps = alpm_list_add(baddeps, miss);
|
baddeps = alpm_list_add(baddeps, miss);
|
||||||
}
|
}
|
||||||
|
release_filtered_depend(depend, nodepversion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,21 +319,23 @@ alpm_list_t SYMEXPORT *alpm_checkdeps(alpm_list_t *pkglist, int reversedeps,
|
||||||
pmpkg_t *lp = i->data;
|
pmpkg_t *lp = i->data;
|
||||||
for(j = alpm_pkg_get_depends(lp); j; j = j->next) {
|
for(j = alpm_pkg_get_depends(lp); j; j = j->next) {
|
||||||
pmdepend_t *depend = j->data;
|
pmdepend_t *depend = j->data;
|
||||||
pmpkg_t *causingpkg = _alpm_find_dep_satisfier(modified, depend);
|
depend = filtered_depend(depend, nodepversion);
|
||||||
|
pmpkg_t *causingpkg = find_dep_satisfier(modified, depend);
|
||||||
/* we won't break this depend, if it is already broken, we ignore it */
|
/* we won't break this depend, if it is already broken, we ignore it */
|
||||||
/* 1. check upgrade list for satisfiers */
|
/* 1. check upgrade list for satisfiers */
|
||||||
/* 2. check dblist for satisfiers */
|
/* 2. check dblist for satisfiers */
|
||||||
if(causingpkg &&
|
if(causingpkg &&
|
||||||
!_alpm_find_dep_satisfier(upgrade, depend) &&
|
!find_dep_satisfier(upgrade, depend) &&
|
||||||
!_alpm_find_dep_satisfier(dblist, depend)) {
|
!find_dep_satisfier(dblist, depend)) {
|
||||||
pmdepmissing_t *miss;
|
pmdepmissing_t *miss;
|
||||||
char *missdepstring = alpm_dep_compute_string(depend);
|
char *missdepstring = alpm_dep_compute_string(depend);
|
||||||
_alpm_log(PM_LOG_DEBUG, "checkdeps: transaction would break '%s' dependency of '%s'\n",
|
_alpm_log(PM_LOG_DEBUG, "checkdeps: transaction would break '%s' dependency of '%s'\n",
|
||||||
missdepstring, alpm_pkg_get_name(lp));
|
missdepstring, alpm_pkg_get_name(lp));
|
||||||
free(missdepstring);
|
free(missdepstring);
|
||||||
miss = _alpm_depmiss_new(lp->name, depend, alpm_pkg_get_name(causingpkg));
|
miss = depmiss_new(lp->name, depend, alpm_pkg_get_name(causingpkg));
|
||||||
baddeps = alpm_list_add(baddeps, miss);
|
baddeps = alpm_list_add(baddeps, miss);
|
||||||
}
|
}
|
||||||
|
release_filtered_depend(depend, nodepversion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -324,18 +367,10 @@ static int dep_vercmp(const char *version1, pmdepmod_t mod,
|
||||||
return equal;
|
return equal;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* nodepversion: skip version checking */
|
int _alpm_depcmp(pmpkg_t *pkg, pmdepend_t *dep)
|
||||||
static int _depcmp(pmpkg_t *pkg, pmdepend_t *dep, int nodepversion)
|
|
||||||
{
|
{
|
||||||
alpm_list_t *i;
|
alpm_list_t *i;
|
||||||
int satisfy = 0;
|
int satisfy = 0;
|
||||||
int depmod;
|
|
||||||
|
|
||||||
if(nodepversion) {
|
|
||||||
depmod = PM_DEP_MOD_ANY;
|
|
||||||
} else {
|
|
||||||
depmod = dep->mod;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* check (pkg->name, pkg->version) */
|
/* check (pkg->name, pkg->version) */
|
||||||
if(pkg->name_hash && dep->name_hash
|
if(pkg->name_hash && dep->name_hash
|
||||||
|
@ -343,7 +378,7 @@ static int _depcmp(pmpkg_t *pkg, pmdepend_t *dep, int nodepversion)
|
||||||
/* skip more expensive checks */
|
/* skip more expensive checks */
|
||||||
} else {
|
} else {
|
||||||
satisfy = (strcmp(pkg->name, dep->name) == 0
|
satisfy = (strcmp(pkg->name, dep->name) == 0
|
||||||
&& dep_vercmp(pkg->version, depmod, dep->version));
|
&& dep_vercmp(pkg->version, dep->mod, dep->version));
|
||||||
if(satisfy) {
|
if(satisfy) {
|
||||||
return satisfy;
|
return satisfy;
|
||||||
}
|
}
|
||||||
|
@ -355,7 +390,7 @@ static int _depcmp(pmpkg_t *pkg, pmdepend_t *dep, int nodepversion)
|
||||||
const char *provver = strchr(provision, '=');
|
const char *provver = strchr(provision, '=');
|
||||||
|
|
||||||
if(provver == NULL) { /* no provision version */
|
if(provver == NULL) { /* no provision version */
|
||||||
satisfy = (depmod == PM_DEP_MOD_ANY
|
satisfy = (dep->mod == PM_DEP_MOD_ANY
|
||||||
&& strcmp(provision, dep->name) == 0);
|
&& strcmp(provision, dep->name) == 0);
|
||||||
} else {
|
} else {
|
||||||
/* This is a bit tricker than the old code for performance reasons. To
|
/* This is a bit tricker than the old code for performance reasons. To
|
||||||
|
@ -367,32 +402,13 @@ static int _depcmp(pmpkg_t *pkg, pmdepend_t *dep, int nodepversion)
|
||||||
provver += 1;
|
provver += 1;
|
||||||
satisfy = (strlen(dep->name) == namelen
|
satisfy = (strlen(dep->name) == namelen
|
||||||
&& strncmp(provision, dep->name, namelen) == 0
|
&& strncmp(provision, dep->name, namelen) == 0
|
||||||
&& dep_vercmp(provver, depmod, dep->version));
|
&& dep_vercmp(provver, dep->mod, dep->version));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return satisfy;
|
return satisfy;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* tolerant : respects NODEPVERSION flag */
|
|
||||||
int _alpm_depcmp_tolerant(pmpkg_t *pkg, pmdepend_t *dep)
|
|
||||||
{
|
|
||||||
int nodepversion = 0;
|
|
||||||
int flags = alpm_trans_get_flags();
|
|
||||||
|
|
||||||
if (flags != -1) {
|
|
||||||
nodepversion = flags & PM_TRANS_FLAG_NODEPVERSION;
|
|
||||||
}
|
|
||||||
|
|
||||||
return _depcmp(pkg, dep, nodepversion);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* strict : ignores NODEPVERSION flag */
|
|
||||||
int _alpm_depcmp(pmpkg_t *pkg, pmdepend_t *dep)
|
|
||||||
{
|
|
||||||
return _depcmp(pkg, dep, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
pmdepend_t *_alpm_splitdep(const char *depstring)
|
pmdepend_t *_alpm_splitdep(const char *depstring)
|
||||||
{
|
{
|
||||||
pmdepend_t *depend;
|
pmdepend_t *depend;
|
||||||
|
@ -526,28 +542,6 @@ void _alpm_recursedeps(pmdb_t *db, alpm_list_t *targs, int include_explicit)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Find a package satisfying a specified dependency.
|
|
||||||
* First look for a literal, going through each db one by one. Then look for
|
|
||||||
* providers. The first satisfier found is returned.
|
|
||||||
* The dependency can include versions with depmod operators.
|
|
||||||
* @param dbs an alpm_list_t* of pmdb_t where the satisfier will be searched
|
|
||||||
* @param depstring package or provision name, versioned or not
|
|
||||||
* @return a pmpkg_t* satisfying depstring
|
|
||||||
*/
|
|
||||||
pmpkg_t SYMEXPORT *alpm_find_dbs_satisfier(alpm_list_t *dbs, const char *depstring)
|
|
||||||
{
|
|
||||||
pmdepend_t *dep;
|
|
||||||
pmpkg_t *pkg;
|
|
||||||
|
|
||||||
ASSERT(dbs, return NULL);
|
|
||||||
|
|
||||||
dep = _alpm_splitdep(depstring);
|
|
||||||
ASSERT(dep, return NULL);
|
|
||||||
pkg = _alpm_resolvedep(dep, dbs, NULL, 1);
|
|
||||||
_alpm_dep_free(dep);
|
|
||||||
return pkg;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* helper function for resolvedeps: search for dep satisfier in dbs
|
* helper function for resolvedeps: search for dep satisfier in dbs
|
||||||
*
|
*
|
||||||
|
@ -560,7 +554,7 @@ pmpkg_t SYMEXPORT *alpm_find_dbs_satisfier(alpm_list_t *dbs, const char *depstri
|
||||||
* an error code without prompting
|
* an error code without prompting
|
||||||
* @return the resolved package
|
* @return the resolved package
|
||||||
**/
|
**/
|
||||||
pmpkg_t *_alpm_resolvedep(pmdepend_t *dep, alpm_list_t *dbs,
|
static pmpkg_t *resolvedep(pmdepend_t *dep, alpm_list_t *dbs,
|
||||||
alpm_list_t *excluding, int prompt)
|
alpm_list_t *excluding, int prompt)
|
||||||
{
|
{
|
||||||
alpm_list_t *i, *j;
|
alpm_list_t *i, *j;
|
||||||
|
@ -572,7 +566,7 @@ pmpkg_t *_alpm_resolvedep(pmdepend_t *dep, alpm_list_t *dbs,
|
||||||
/* 1. literals */
|
/* 1. literals */
|
||||||
for(i = dbs; i; i = i->next) {
|
for(i = dbs; i; i = i->next) {
|
||||||
pmpkg_t *pkg = _alpm_db_get_pkgfromcache(i->data, dep->name);
|
pmpkg_t *pkg = _alpm_db_get_pkgfromcache(i->data, dep->name);
|
||||||
if(pkg && _alpm_depcmp_tolerant(pkg, dep) && !_alpm_pkg_find(excluding, pkg->name)) {
|
if(pkg && _alpm_depcmp(pkg, dep) && !_alpm_pkg_find(excluding, pkg->name)) {
|
||||||
if(_alpm_pkg_should_ignore(pkg)) {
|
if(_alpm_pkg_should_ignore(pkg)) {
|
||||||
int install = 0;
|
int install = 0;
|
||||||
if (prompt) {
|
if (prompt) {
|
||||||
|
@ -593,7 +587,7 @@ pmpkg_t *_alpm_resolvedep(pmdepend_t *dep, alpm_list_t *dbs,
|
||||||
for(i = dbs; i; i = i->next) {
|
for(i = dbs; i; i = i->next) {
|
||||||
for(j = _alpm_db_get_pkgcache(i->data); j; j = j->next) {
|
for(j = _alpm_db_get_pkgcache(i->data); j; j = j->next) {
|
||||||
pmpkg_t *pkg = j->data;
|
pmpkg_t *pkg = j->data;
|
||||||
if(_alpm_depcmp_tolerant(pkg, dep) && strcmp(pkg->name, dep->name) != 0 &&
|
if(_alpm_depcmp(pkg, dep) && strcmp(pkg->name, dep->name) != 0 &&
|
||||||
!_alpm_pkg_find(excluding, pkg->name)) {
|
!_alpm_pkg_find(excluding, pkg->name)) {
|
||||||
if(_alpm_pkg_should_ignore(pkg)) {
|
if(_alpm_pkg_should_ignore(pkg)) {
|
||||||
int install = 0;
|
int install = 0;
|
||||||
|
@ -650,7 +644,30 @@ pmpkg_t *_alpm_resolvedep(pmdepend_t *dep, alpm_list_t *dbs,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Computes resolvable dependencies for a given package and adds that package
|
/** Find a package satisfying a specified dependency.
|
||||||
|
* First look for a literal, going through each db one by one. Then look for
|
||||||
|
* providers. The first satisfier found is returned.
|
||||||
|
* The dependency can include versions with depmod operators.
|
||||||
|
* @param dbs an alpm_list_t* of pmdb_t where the satisfier will be searched
|
||||||
|
* @param depstring package or provision name, versioned or not
|
||||||
|
* @return a pmpkg_t* satisfying depstring
|
||||||
|
*/
|
||||||
|
pmpkg_t SYMEXPORT *alpm_find_dbs_satisfier(alpm_list_t *dbs, const char *depstring)
|
||||||
|
{
|
||||||
|
pmdepend_t *dep;
|
||||||
|
pmpkg_t *pkg;
|
||||||
|
|
||||||
|
ASSERT(dbs, return NULL);
|
||||||
|
|
||||||
|
dep = _alpm_splitdep(depstring);
|
||||||
|
ASSERT(dep, return NULL);
|
||||||
|
pkg = resolvedep(dep, dbs, NULL, 1);
|
||||||
|
_alpm_dep_free(dep);
|
||||||
|
return pkg;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Computes resolvable dependencies for a given package and adds that package
|
||||||
* and those resolvable dependencies to a list.
|
* and those resolvable dependencies to a list.
|
||||||
*
|
*
|
||||||
* @param localpkgs is the list of local packages
|
* @param localpkgs is the list of local packages
|
||||||
|
@ -704,16 +721,16 @@ int _alpm_resolvedeps(alpm_list_t *localpkgs, alpm_list_t *dbs_sync, pmpkg_t *pk
|
||||||
pmdepend_t *missdep = alpm_miss_get_dep(miss);
|
pmdepend_t *missdep = alpm_miss_get_dep(miss);
|
||||||
/* check if one of the packages in the [*packages] list already satisfies
|
/* check if one of the packages in the [*packages] list already satisfies
|
||||||
* this dependency */
|
* this dependency */
|
||||||
if(_alpm_find_dep_satisfier(*packages, missdep)) {
|
if(find_dep_satisfier(*packages, missdep)) {
|
||||||
_alpm_depmiss_free(miss);
|
_alpm_depmiss_free(miss);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/* check if one of the packages in the [preferred] list already satisfies
|
/* check if one of the packages in the [preferred] list already satisfies
|
||||||
* this dependency */
|
* this dependency */
|
||||||
pmpkg_t *spkg = _alpm_find_dep_satisfier(preferred, missdep);
|
pmpkg_t *spkg = find_dep_satisfier(preferred, missdep);
|
||||||
if(!spkg) {
|
if(!spkg) {
|
||||||
/* find a satisfier package in the given repositories */
|
/* find a satisfier package in the given repositories */
|
||||||
spkg = _alpm_resolvedep(missdep, dbs_sync, *packages, 0);
|
spkg = resolvedep(missdep, dbs_sync, *packages, 0);
|
||||||
}
|
}
|
||||||
if(!spkg) {
|
if(!spkg) {
|
||||||
pm_errno = PM_ERR_UNSATISFIED_DEPS;
|
pm_errno = PM_ERR_UNSATISFIED_DEPS;
|
||||||
|
@ -746,18 +763,6 @@ int _alpm_resolvedeps(alpm_list_t *localpkgs, alpm_list_t *dbs_sync, pmpkg_t *pk
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Does pkg1 depend on pkg2, ie. does pkg2 satisfy a dependency of pkg1? */
|
|
||||||
int _alpm_dep_edge(pmpkg_t *pkg1, pmpkg_t *pkg2)
|
|
||||||
{
|
|
||||||
alpm_list_t *i;
|
|
||||||
for(i = alpm_pkg_get_depends(pkg1); i; i = i->next) {
|
|
||||||
if(_alpm_depcmp_tolerant(pkg2, i->data)) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_miss_get_target(const pmdepmissing_t *miss)
|
const char SYMEXPORT *alpm_miss_get_target(const pmdepmissing_t *miss)
|
||||||
{
|
{
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
|
@ -825,7 +830,8 @@ const char SYMEXPORT *alpm_dep_get_version(const pmdepend_t *dep)
|
||||||
*/
|
*/
|
||||||
char SYMEXPORT *alpm_dep_compute_string(const pmdepend_t *dep)
|
char SYMEXPORT *alpm_dep_compute_string(const pmdepend_t *dep)
|
||||||
{
|
{
|
||||||
char *name, *opr, *ver, *str = NULL;
|
const char *name, *opr, *ver;
|
||||||
|
char *str;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
|
@ -863,7 +869,7 @@ char SYMEXPORT *alpm_dep_compute_string(const pmdepend_t *dep)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(dep->version) {
|
if(dep->mod != PM_DEP_MOD_ANY && dep->version) {
|
||||||
ver = dep->version;
|
ver = dep->version;
|
||||||
} else {
|
} else {
|
||||||
ver = "";
|
ver = "";
|
||||||
|
|
|
@ -44,20 +44,14 @@ struct __pmdepmissing_t {
|
||||||
|
|
||||||
void _alpm_dep_free(pmdepend_t *dep);
|
void _alpm_dep_free(pmdepend_t *dep);
|
||||||
pmdepend_t *_alpm_dep_dup(const pmdepend_t *dep);
|
pmdepend_t *_alpm_dep_dup(const pmdepend_t *dep);
|
||||||
pmdepmissing_t *_alpm_depmiss_new(const char *target, pmdepend_t *dep,
|
|
||||||
const char *causinpkg);
|
|
||||||
void _alpm_depmiss_free(pmdepmissing_t *miss);
|
void _alpm_depmiss_free(pmdepmissing_t *miss);
|
||||||
alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, int reverse);
|
alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, int reverse);
|
||||||
void _alpm_recursedeps(pmdb_t *db, alpm_list_t *targs, int include_explicit);
|
void _alpm_recursedeps(pmdb_t *db, alpm_list_t *targs, int include_explicit);
|
||||||
pmpkg_t *_alpm_resolvedep(pmdepend_t *dep, alpm_list_t *dbs, alpm_list_t *excluding, int prompt);
|
|
||||||
int _alpm_resolvedeps(alpm_list_t *localpkgs, alpm_list_t *dbs_sync, pmpkg_t *pkg,
|
int _alpm_resolvedeps(alpm_list_t *localpkgs, alpm_list_t *dbs_sync, pmpkg_t *pkg,
|
||||||
alpm_list_t *preferred, alpm_list_t **packages, alpm_list_t *remove,
|
alpm_list_t *preferred, alpm_list_t **packages, alpm_list_t *remove,
|
||||||
alpm_list_t **data);
|
alpm_list_t **data);
|
||||||
int _alpm_dep_edge(pmpkg_t *pkg1, pmpkg_t *pkg2);
|
|
||||||
pmdepend_t *_alpm_splitdep(const char *depstring);
|
pmdepend_t *_alpm_splitdep(const char *depstring);
|
||||||
pmpkg_t *_alpm_find_dep_satisfier(alpm_list_t *pkgs, pmdepend_t *dep);
|
|
||||||
int _alpm_depcmp(pmpkg_t *pkg, pmdepend_t *dep);
|
int _alpm_depcmp(pmpkg_t *pkg, pmdepend_t *dep);
|
||||||
int _alpm_depcmp_tolerant(pmpkg_t *pkg, pmdepend_t *dep);
|
|
||||||
|
|
||||||
#endif /* _ALPM_DEPS_H */
|
#endif /* _ALPM_DEPS_H */
|
||||||
|
|
||||||
|
|
|
@ -376,11 +376,10 @@ static void find_requiredby(pmpkg_t *pkg, pmdb_t *db, alpm_list_t **reqs)
|
||||||
{
|
{
|
||||||
const alpm_list_t *i;
|
const alpm_list_t *i;
|
||||||
for(i = _alpm_db_get_pkgcache(db); i; i = i->next) {
|
for(i = _alpm_db_get_pkgcache(db); i; i = i->next) {
|
||||||
if(!i->data) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
pmpkg_t *cachepkg = i->data;
|
pmpkg_t *cachepkg = i->data;
|
||||||
if(_alpm_dep_edge(cachepkg, pkg)) {
|
alpm_list_t *i;
|
||||||
|
for(i = alpm_pkg_get_depends(cachepkg); i; i = i->next) {
|
||||||
|
if(_alpm_depcmp(pkg, i->data)) {
|
||||||
const char *cachepkgname = cachepkg->name;
|
const char *cachepkgname = cachepkg->name;
|
||||||
if(alpm_list_find_str(*reqs, cachepkgname) == NULL) {
|
if(alpm_list_find_str(*reqs, cachepkgname) == NULL) {
|
||||||
*reqs = alpm_list_add(*reqs, strdup(cachepkgname));
|
*reqs = alpm_list_add(*reqs, strdup(cachepkgname));
|
||||||
|
@ -388,6 +387,7 @@ static void find_requiredby(pmpkg_t *pkg, pmdb_t *db, alpm_list_t **reqs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Compute the packages requiring a given package.
|
* @brief Compute the packages requiring a given package.
|
||||||
|
@ -414,8 +414,8 @@ alpm_list_t SYMEXPORT *alpm_pkg_compute_requiredby(pmpkg_t *pkg)
|
||||||
for(i = handle->dbs_sync; i; i = i->next) {
|
for(i = handle->dbs_sync; i; i = i->next) {
|
||||||
db = i->data;
|
db = i->data;
|
||||||
find_requiredby(pkg, db, &reqs);
|
find_requiredby(pkg, db, &reqs);
|
||||||
reqs = alpm_list_msort(reqs, alpm_list_count(reqs), _alpm_str_cmp);
|
|
||||||
}
|
}
|
||||||
|
reqs = alpm_list_msort(reqs, alpm_list_count(reqs), _alpm_str_cmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return reqs;
|
return reqs;
|
||||||
|
|
|
@ -83,10 +83,14 @@ if [[ -n $1 ]]; then
|
||||||
dbroot="$1"
|
dbroot="$1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -d $dbroot || ! -d $dbroot/local ]]; then
|
if [[ ! -d $dbroot ]]; then
|
||||||
die "$(gettext "%s does not exist or is not a directory.")" "$dbroot"
|
die "$(gettext "%s does not exist or is not a directory.")" "$dbroot"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ ! -d $dbroot/local ]]; then
|
||||||
|
die "$(gettext "%s is not a pacman database directory.")" "$dbroot"
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ ! -w $dbroot ]]; then
|
if [[ ! -w $dbroot ]]; then
|
||||||
die "$(gettext "You must have correct permissions to upgrade the database.")"
|
die "$(gettext "You must have correct permissions to upgrade the database.")"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -114,6 +114,7 @@ static void usage(int op, const char * const myname)
|
||||||
char const * const str_usg = _("usage");
|
char const * const str_usg = _("usage");
|
||||||
char const * const str_opr = _("operation");
|
char const * const str_opr = _("operation");
|
||||||
|
|
||||||
|
/* please limit your strings to 80 characters in width */
|
||||||
if(op == PM_OP_MAIN) {
|
if(op == PM_OP_MAIN) {
|
||||||
printf("%s: %s <%s> [...]\n", str_usg, myname, str_opr);
|
printf("%s: %s <%s> [...]\n", str_usg, myname, str_opr);
|
||||||
printf(_("operations:\n"));
|
printf(_("operations:\n"));
|
||||||
|
@ -132,10 +133,10 @@ static void usage(int op, const char * const myname)
|
||||||
printf("%s: %s {-R --remove} [%s] <%s>\n", str_usg, myname, str_opt, str_pkg);
|
printf("%s: %s {-R --remove} [%s] <%s>\n", str_usg, myname, str_opt, str_pkg);
|
||||||
printf("%s:\n", str_opt);
|
printf("%s:\n", str_opt);
|
||||||
addlist(_(" -c, --cascade remove packages and all packages that depend on them\n"));
|
addlist(_(" -c, --cascade remove packages and all packages that depend on them\n"));
|
||||||
addlist(_(" -n, --nosave remove configuration files as well\n"));
|
addlist(_(" -n, --nosave remove configuration files\n"));
|
||||||
addlist(_(" -s, --recursive remove dependencies also (that won't break packages)\n"
|
addlist(_(" -s, --recursive remove unnecessary dependencies\n"
|
||||||
" (-ss includes explicitly installed dependencies too)\n"));
|
" (-ss includes explicitly installed dependencies)\n"));
|
||||||
addlist(_(" -u, --unneeded remove unneeded packages (that won't break packages)\n"));
|
addlist(_(" -u, --unneeded remove unneeded packages\n"));
|
||||||
} else if(op == PM_OP_UPGRADE) {
|
} else if(op == PM_OP_UPGRADE) {
|
||||||
printf("%s: %s {-U --upgrade} [%s] <%s>\n", str_usg, myname, str_opt, str_file);
|
printf("%s: %s {-U --upgrade} [%s] <%s>\n", str_usg, myname, str_opt, str_file);
|
||||||
printf("%s:\n", str_opt);
|
printf("%s:\n", str_opt);
|
||||||
|
@ -189,11 +190,11 @@ static void usage(int op, const char * const myname)
|
||||||
" ignore a group upgrade (can be used more than once)\n"));
|
" ignore a group upgrade (can be used more than once)\n"));
|
||||||
/* pass through */
|
/* pass through */
|
||||||
case PM_OP_REMOVE:
|
case PM_OP_REMOVE:
|
||||||
addlist(_(" -d, --nodeps skip dependency checks\n"));
|
addlist(_(" -d, --nodeps skip dependency version checks (-dd to skip all checks)\n"));
|
||||||
addlist(_(" -k, --dbonly only modify database entries, not package files\n"));
|
addlist(_(" -k, --dbonly only modify database entries, not package files\n"));
|
||||||
addlist(_(" --noprogressbar do not show a progress bar when downloading files\n"));
|
addlist(_(" --noprogressbar do not show a progress bar when downloading files\n"));
|
||||||
addlist(_(" --noscriptlet do not execute the install scriptlet if one exists\n"));
|
addlist(_(" --noscriptlet do not execute the install scriptlet if one exists\n"));
|
||||||
addlist(_(" --print only print the targets instead of performing the operation\n"));
|
addlist(_(" --print print the targets instead of performing the operation\n"));
|
||||||
addlist(_(" --print-format <string>\n"
|
addlist(_(" --print-format <string>\n"
|
||||||
" specify how the targets should be printed\n"));
|
" specify how the targets should be printed\n"));
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Reference in a new issue