mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-23 00:08:50 -05:00
Rename pmdepend_t to alpm_depend_t
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
6b62508c86
commit
9540dfc4d9
@ -106,17 +106,17 @@ typedef struct __alpm_pkg_t alpm_pkg_t;
|
|||||||
typedef struct __alpm_trans_t alpm_trans_t;
|
typedef struct __alpm_trans_t alpm_trans_t;
|
||||||
|
|
||||||
/** Dependency */
|
/** Dependency */
|
||||||
typedef struct _pmdepend_t {
|
typedef struct _alpm_depend_t {
|
||||||
char *name;
|
char *name;
|
||||||
char *version;
|
char *version;
|
||||||
unsigned long name_hash;
|
unsigned long name_hash;
|
||||||
alpm_depmod_t mod;
|
alpm_depmod_t mod;
|
||||||
} pmdepend_t;
|
} alpm_depend_t;
|
||||||
|
|
||||||
/** Missing dependency */
|
/** Missing dependency */
|
||||||
typedef struct _pmdepmissing_t {
|
typedef struct _pmdepmissing_t {
|
||||||
char *target;
|
char *target;
|
||||||
pmdepend_t *depend;
|
alpm_depend_t *depend;
|
||||||
/* this is used in case of remove dependency error only */
|
/* this is used in case of remove dependency error only */
|
||||||
char *causingpkg;
|
char *causingpkg;
|
||||||
} pmdepmissing_t;
|
} pmdepmissing_t;
|
||||||
@ -581,9 +581,9 @@ alpm_list_t *alpm_pkg_get_licenses(alpm_pkg_t *pkg);
|
|||||||
*/
|
*/
|
||||||
alpm_list_t *alpm_pkg_get_groups(alpm_pkg_t *pkg);
|
alpm_list_t *alpm_pkg_get_groups(alpm_pkg_t *pkg);
|
||||||
|
|
||||||
/** Returns the list of package dependencies as pmdepend_t.
|
/** Returns the list of package dependencies as alpm_depend_t.
|
||||||
* @param pkg a pointer to package
|
* @param pkg a pointer to package
|
||||||
* @return a reference to an internal list of pmdepend_t structures.
|
* @return a reference to an internal list of alpm_depend_t structures.
|
||||||
*/
|
*/
|
||||||
alpm_list_t *alpm_pkg_get_depends(alpm_pkg_t *pkg);
|
alpm_list_t *alpm_pkg_get_depends(alpm_pkg_t *pkg);
|
||||||
|
|
||||||
@ -967,7 +967,7 @@ alpm_list_t *alpm_checkconflicts(alpm_handle_t *handle, alpm_list_t *pkglist);
|
|||||||
* @param dep a dependency info structure
|
* @param dep a dependency info structure
|
||||||
* @return a formatted string, e.g. "glibc>=2.12"
|
* @return a formatted string, e.g. "glibc>=2.12"
|
||||||
*/
|
*/
|
||||||
char *alpm_dep_compute_string(const pmdepend_t *dep);
|
char *alpm_dep_compute_string(const alpm_depend_t *dep);
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
@ -639,7 +639,7 @@ int _alpm_local_db_read(alpm_db_t *db, alpm_pkg_t *info, pmdbinfrq_t inforeq)
|
|||||||
}
|
}
|
||||||
} else if(strcmp(line, "%DEPENDS%") == 0) {
|
} else if(strcmp(line, "%DEPENDS%") == 0) {
|
||||||
while(fgets(line, sizeof(line), fp) && strlen(_alpm_strtrim(line))) {
|
while(fgets(line, sizeof(line), fp) && strlen(_alpm_strtrim(line))) {
|
||||||
pmdepend_t *dep = _alpm_splitdep(line);
|
alpm_depend_t *dep = _alpm_splitdep(line);
|
||||||
info->depends = alpm_list_add(info->depends, dep);
|
info->depends = alpm_list_add(info->depends, dep);
|
||||||
}
|
}
|
||||||
} else if(strcmp(line, "%OPTDEPENDS%") == 0) {
|
} else if(strcmp(line, "%OPTDEPENDS%") == 0) {
|
||||||
|
@ -189,7 +189,7 @@ static int parse_descfile(alpm_handle_t *handle, struct archive *a, alpm_pkg_t *
|
|||||||
/* size in the raw package is uncompressed (installed) size */
|
/* size in the raw package is uncompressed (installed) size */
|
||||||
newpkg->isize = atol(ptr);
|
newpkg->isize = atol(ptr);
|
||||||
} else if(strcmp(key, "depend") == 0) {
|
} else if(strcmp(key, "depend") == 0) {
|
||||||
pmdepend_t *dep = _alpm_splitdep(ptr);
|
alpm_depend_t *dep = _alpm_splitdep(ptr);
|
||||||
newpkg->depends = alpm_list_add(newpkg->depends, dep);
|
newpkg->depends = alpm_list_add(newpkg->depends, dep);
|
||||||
} else if(strcmp(key, "optdepend") == 0) {
|
} else if(strcmp(key, "optdepend") == 0) {
|
||||||
newpkg->optdepends = alpm_list_add(newpkg->optdepends, strdup(ptr));
|
newpkg->optdepends = alpm_list_add(newpkg->optdepends, strdup(ptr));
|
||||||
|
@ -145,7 +145,7 @@ static void check_conflict(alpm_handle_t *handle,
|
|||||||
for(j = alpm_pkg_get_conflicts(pkg1); j; j = j->next) {
|
for(j = alpm_pkg_get_conflicts(pkg1); j; j = j->next) {
|
||||||
const char *conflict = j->data;
|
const char *conflict = j->data;
|
||||||
alpm_list_t *k;
|
alpm_list_t *k;
|
||||||
pmdepend_t *parsed_conflict = _alpm_splitdep(conflict);
|
alpm_depend_t *parsed_conflict = _alpm_splitdep(conflict);
|
||||||
|
|
||||||
for(k = list2; k; k = k->next) {
|
for(k = list2; k; k = k->next) {
|
||||||
alpm_pkg_t *pkg2 = k->data;
|
alpm_pkg_t *pkg2 = k->data;
|
||||||
|
@ -37,14 +37,14 @@
|
|||||||
#include "handle.h"
|
#include "handle.h"
|
||||||
#include "trans.h"
|
#include "trans.h"
|
||||||
|
|
||||||
void _alpm_dep_free(pmdepend_t *dep)
|
void _alpm_dep_free(alpm_depend_t *dep)
|
||||||
{
|
{
|
||||||
FREE(dep->name);
|
FREE(dep->name);
|
||||||
FREE(dep->version);
|
FREE(dep->version);
|
||||||
FREE(dep);
|
FREE(dep);
|
||||||
}
|
}
|
||||||
|
|
||||||
static pmdepmissing_t *depmiss_new(const char *target, pmdepend_t *dep,
|
static pmdepmissing_t *depmiss_new(const char *target, alpm_depend_t *dep,
|
||||||
const char *causingpkg)
|
const char *causingpkg)
|
||||||
{
|
{
|
||||||
pmdepmissing_t *miss;
|
pmdepmissing_t *miss;
|
||||||
@ -208,10 +208,10 @@ static int no_dep_version(alpm_handle_t *handle)
|
|||||||
return flags != -1 && (flags & PM_TRANS_FLAG_NODEPVERSION);
|
return flags != -1 && (flags & PM_TRANS_FLAG_NODEPVERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
static pmdepend_t *filtered_depend(pmdepend_t *dep, int nodepversion)
|
static alpm_depend_t *filtered_depend(alpm_depend_t *dep, int nodepversion)
|
||||||
{
|
{
|
||||||
if(nodepversion) {
|
if(nodepversion) {
|
||||||
pmdepend_t *newdep = _alpm_dep_dup(dep);
|
alpm_depend_t *newdep = _alpm_dep_dup(dep);
|
||||||
ASSERT(newdep, return dep);
|
ASSERT(newdep, return dep);
|
||||||
newdep->mod = PM_DEP_MOD_ANY;
|
newdep->mod = PM_DEP_MOD_ANY;
|
||||||
dep = newdep;
|
dep = newdep;
|
||||||
@ -219,14 +219,14 @@ static pmdepend_t *filtered_depend(pmdepend_t *dep, int nodepversion)
|
|||||||
return dep;
|
return dep;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void release_filtered_depend(pmdepend_t *dep, int nodepversion)
|
static void release_filtered_depend(alpm_depend_t *dep, int nodepversion)
|
||||||
{
|
{
|
||||||
if(nodepversion) {
|
if(nodepversion) {
|
||||||
free(dep);
|
free(dep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static alpm_pkg_t *find_dep_satisfier(alpm_list_t *pkgs, pmdepend_t *dep)
|
static alpm_pkg_t *find_dep_satisfier(alpm_list_t *pkgs, alpm_depend_t *dep)
|
||||||
{
|
{
|
||||||
alpm_list_t *i;
|
alpm_list_t *i;
|
||||||
|
|
||||||
@ -247,7 +247,7 @@ static alpm_pkg_t *find_dep_satisfier(alpm_list_t *pkgs, pmdepend_t *dep)
|
|||||||
*/
|
*/
|
||||||
alpm_pkg_t SYMEXPORT *alpm_find_satisfier(alpm_list_t *pkgs, const char *depstring)
|
alpm_pkg_t SYMEXPORT *alpm_find_satisfier(alpm_list_t *pkgs, const char *depstring)
|
||||||
{
|
{
|
||||||
pmdepend_t *dep = _alpm_splitdep(depstring);
|
alpm_depend_t *dep = _alpm_splitdep(depstring);
|
||||||
if(!dep) {
|
if(!dep) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -295,7 +295,7 @@ alpm_list_t SYMEXPORT *alpm_checkdeps(alpm_handle_t *handle, alpm_list_t *pkglis
|
|||||||
alpm_pkg_get_name(tp), alpm_pkg_get_version(tp));
|
alpm_pkg_get_name(tp), alpm_pkg_get_version(tp));
|
||||||
|
|
||||||
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;
|
alpm_depend_t *depend = j->data;
|
||||||
depend = filtered_depend(depend, nodepversion);
|
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 */
|
||||||
@ -320,7 +320,7 @@ alpm_list_t SYMEXPORT *alpm_checkdeps(alpm_handle_t *handle, alpm_list_t *pkglis
|
|||||||
for(i = dblist; i; i = i->next) {
|
for(i = dblist; i; i = i->next) {
|
||||||
alpm_pkg_t *lp = i->data;
|
alpm_pkg_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;
|
alpm_depend_t *depend = j->data;
|
||||||
depend = filtered_depend(depend, nodepversion);
|
depend = filtered_depend(depend, nodepversion);
|
||||||
alpm_pkg_t *causingpkg = find_dep_satisfier(modified, depend);
|
alpm_pkg_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 */
|
||||||
@ -369,7 +369,7 @@ static int dep_vercmp(const char *version1, alpm_depmod_t mod,
|
|||||||
return equal;
|
return equal;
|
||||||
}
|
}
|
||||||
|
|
||||||
int _alpm_depcmp(alpm_pkg_t *pkg, pmdepend_t *dep)
|
int _alpm_depcmp(alpm_pkg_t *pkg, alpm_depend_t *dep)
|
||||||
{
|
{
|
||||||
alpm_list_t *i;
|
alpm_list_t *i;
|
||||||
int satisfy = 0;
|
int satisfy = 0;
|
||||||
@ -411,16 +411,16 @@ int _alpm_depcmp(alpm_pkg_t *pkg, pmdepend_t *dep)
|
|||||||
return satisfy;
|
return satisfy;
|
||||||
}
|
}
|
||||||
|
|
||||||
pmdepend_t *_alpm_splitdep(const char *depstring)
|
alpm_depend_t *_alpm_splitdep(const char *depstring)
|
||||||
{
|
{
|
||||||
pmdepend_t *depend;
|
alpm_depend_t *depend;
|
||||||
const char *ptr, *version = NULL;
|
const char *ptr, *version = NULL;
|
||||||
|
|
||||||
if(depstring == NULL) {
|
if(depstring == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
CALLOC(depend, 1, sizeof(pmdepend_t), return NULL);
|
CALLOC(depend, 1, sizeof(alpm_depend_t), return NULL);
|
||||||
|
|
||||||
/* Find a version comparator if one exists. If it does, set the type and
|
/* Find a version comparator if one exists. If it does, set the type and
|
||||||
* increment the ptr accordingly so we can copy the right strings. */
|
* increment the ptr accordingly so we can copy the right strings. */
|
||||||
@ -455,10 +455,10 @@ pmdepend_t *_alpm_splitdep(const char *depstring)
|
|||||||
return depend;
|
return depend;
|
||||||
}
|
}
|
||||||
|
|
||||||
pmdepend_t *_alpm_dep_dup(const pmdepend_t *dep)
|
alpm_depend_t *_alpm_dep_dup(const alpm_depend_t *dep)
|
||||||
{
|
{
|
||||||
pmdepend_t *newdep;
|
alpm_depend_t *newdep;
|
||||||
CALLOC(newdep, 1, sizeof(pmdepend_t), return NULL);
|
CALLOC(newdep, 1, sizeof(alpm_depend_t), return NULL);
|
||||||
|
|
||||||
STRDUP(newdep->name, dep->name, return NULL);
|
STRDUP(newdep->name, dep->name, return NULL);
|
||||||
newdep->name_hash = dep->name_hash;
|
newdep->name_hash = dep->name_hash;
|
||||||
@ -554,7 +554,7 @@ void _alpm_recursedeps(alpm_db_t *db, alpm_list_t *targs, int include_explicit)
|
|||||||
* an error code without prompting
|
* an error code without prompting
|
||||||
* @return the resolved package
|
* @return the resolved package
|
||||||
**/
|
**/
|
||||||
static alpm_pkg_t *resolvedep(alpm_handle_t *handle, pmdepend_t *dep,
|
static alpm_pkg_t *resolvedep(alpm_handle_t *handle, alpm_depend_t *dep,
|
||||||
alpm_list_t *dbs, alpm_list_t *excluding, int prompt)
|
alpm_list_t *dbs, alpm_list_t *excluding, int prompt)
|
||||||
{
|
{
|
||||||
alpm_list_t *i, *j;
|
alpm_list_t *i, *j;
|
||||||
@ -656,7 +656,7 @@ static alpm_pkg_t *resolvedep(alpm_handle_t *handle, pmdepend_t *dep,
|
|||||||
alpm_pkg_t SYMEXPORT *alpm_find_dbs_satisfier(alpm_handle_t *handle,
|
alpm_pkg_t SYMEXPORT *alpm_find_dbs_satisfier(alpm_handle_t *handle,
|
||||||
alpm_list_t *dbs, const char *depstring)
|
alpm_list_t *dbs, const char *depstring)
|
||||||
{
|
{
|
||||||
pmdepend_t *dep;
|
alpm_depend_t *dep;
|
||||||
alpm_pkg_t *pkg;
|
alpm_pkg_t *pkg;
|
||||||
|
|
||||||
CHECK_HANDLE(handle, return NULL);
|
CHECK_HANDLE(handle, return NULL);
|
||||||
@ -719,7 +719,7 @@ int _alpm_resolvedeps(alpm_handle_t *handle, alpm_list_t *localpkgs, alpm_pkg_t
|
|||||||
|
|
||||||
for(j = deps; j; j = j->next) {
|
for(j = deps; j; j = j->next) {
|
||||||
pmdepmissing_t *miss = j->data;
|
pmdepmissing_t *miss = j->data;
|
||||||
pmdepend_t *missdep = miss->depend;
|
alpm_depend_t *missdep = miss->depend;
|
||||||
/* 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(find_dep_satisfier(*packages, missdep)) {
|
if(find_dep_satisfier(*packages, missdep)) {
|
||||||
@ -764,12 +764,12 @@ int _alpm_resolvedeps(alpm_handle_t *handle, alpm_list_t *localpkgs, alpm_pkg_t
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Reverse of splitdep; make a dep string from a pmdepend_t struct.
|
/** Reverse of splitdep; make a dep string from a alpm_depend_t struct.
|
||||||
* The string must be freed!
|
* The string must be freed!
|
||||||
* @param dep the depend to turn into a string
|
* @param dep the depend to turn into a string
|
||||||
* @return a string-formatted dependency with operator if necessary
|
* @return a string-formatted dependency with operator if necessary
|
||||||
*/
|
*/
|
||||||
char SYMEXPORT *alpm_dep_compute_string(const pmdepend_t *dep)
|
char SYMEXPORT *alpm_dep_compute_string(const alpm_depend_t *dep)
|
||||||
{
|
{
|
||||||
const char *name, *opr, *ver;
|
const char *name, *opr, *ver;
|
||||||
char *str;
|
char *str;
|
||||||
|
@ -27,16 +27,16 @@
|
|||||||
#include "package.h"
|
#include "package.h"
|
||||||
#include "alpm.h"
|
#include "alpm.h"
|
||||||
|
|
||||||
void _alpm_dep_free(pmdepend_t *dep);
|
void _alpm_dep_free(alpm_depend_t *dep);
|
||||||
pmdepend_t *_alpm_dep_dup(const pmdepend_t *dep);
|
alpm_depend_t *_alpm_dep_dup(const alpm_depend_t *dep);
|
||||||
void _alpm_depmiss_free(pmdepmissing_t *miss);
|
void _alpm_depmiss_free(pmdepmissing_t *miss);
|
||||||
alpm_list_t *_alpm_sortbydeps(alpm_handle_t *handle, alpm_list_t *targets, int reverse);
|
alpm_list_t *_alpm_sortbydeps(alpm_handle_t *handle, alpm_list_t *targets, int reverse);
|
||||||
void _alpm_recursedeps(alpm_db_t *db, alpm_list_t *targs, int include_explicit);
|
void _alpm_recursedeps(alpm_db_t *db, alpm_list_t *targs, int include_explicit);
|
||||||
int _alpm_resolvedeps(alpm_handle_t *handle, alpm_list_t *localpkgs, alpm_pkg_t *pkg,
|
int _alpm_resolvedeps(alpm_handle_t *handle, alpm_list_t *localpkgs, alpm_pkg_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);
|
||||||
pmdepend_t *_alpm_splitdep(const char *depstring);
|
alpm_depend_t *_alpm_splitdep(const char *depstring);
|
||||||
int _alpm_depcmp(alpm_pkg_t *pkg, pmdepend_t *dep);
|
int _alpm_depcmp(alpm_pkg_t *pkg, alpm_depend_t *dep);
|
||||||
|
|
||||||
#endif /* _ALPM_DEPS_H */
|
#endif /* _ALPM_DEPS_H */
|
||||||
|
|
||||||
|
@ -419,8 +419,8 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data)
|
|||||||
conflict->package1, conflict->package2);
|
conflict->package1, conflict->package2);
|
||||||
|
|
||||||
/* if sync1 provides sync2, we remove sync2 from the targets, and vice versa */
|
/* if sync1 provides sync2, we remove sync2 from the targets, and vice versa */
|
||||||
pmdepend_t *dep1 = _alpm_splitdep(conflict->package1);
|
alpm_depend_t *dep1 = _alpm_splitdep(conflict->package1);
|
||||||
pmdepend_t *dep2 = _alpm_splitdep(conflict->package2);
|
alpm_depend_t *dep2 = _alpm_splitdep(conflict->package2);
|
||||||
if(_alpm_depcmp(sync1, dep2)) {
|
if(_alpm_depcmp(sync1, dep2)) {
|
||||||
rsync = sync2;
|
rsync = sync2;
|
||||||
sync = sync1;
|
sync = sync1;
|
||||||
|
@ -312,7 +312,7 @@ void cb_trans_conv(pmtransconv_t event, void *data1, void *data2,
|
|||||||
{
|
{
|
||||||
alpm_list_t *providers = (alpm_list_t *)data1;
|
alpm_list_t *providers = (alpm_list_t *)data1;
|
||||||
int count = alpm_list_count(providers);
|
int count = alpm_list_count(providers);
|
||||||
char *depstring = alpm_dep_compute_string((pmdepend_t *)data2);
|
char *depstring = alpm_dep_compute_string((alpm_depend_t *)data2);
|
||||||
printf(_(":: There are %d providers available for %s:\n"), count,
|
printf(_(":: There are %d providers available for %s:\n"), count,
|
||||||
depstring);
|
depstring);
|
||||||
free(depstring);
|
free(depstring);
|
||||||
|
@ -83,7 +83,7 @@ void dump_pkg_full(alpm_pkg_t *pkg, enum pkg_from from, int extra)
|
|||||||
|
|
||||||
/* turn depends list into a text list */
|
/* turn depends list into a text list */
|
||||||
for(i = alpm_pkg_get_depends(pkg); i; i = alpm_list_next(i)) {
|
for(i = alpm_pkg_get_depends(pkg); i; i = alpm_list_next(i)) {
|
||||||
pmdepend_t *dep = (pmdepend_t *)alpm_list_getdata(i);
|
alpm_depend_t *dep = (alpm_depend_t *)alpm_list_getdata(i);
|
||||||
depstrings = alpm_list_add(depstrings, alpm_dep_compute_string(dep));
|
depstrings = alpm_list_add(depstrings, alpm_dep_compute_string(dep));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -375,7 +375,7 @@ static void walk_deps(alpm_list_t *dblist, alpm_pkg_t *pkg, int depth)
|
|||||||
walked = alpm_list_add(walked, (void *)alpm_pkg_get_name(pkg));
|
walked = alpm_list_add(walked, (void *)alpm_pkg_get_name(pkg));
|
||||||
|
|
||||||
for(i = alpm_pkg_get_depends(pkg); i; i = alpm_list_next(i)) {
|
for(i = alpm_pkg_get_depends(pkg); i; i = alpm_list_next(i)) {
|
||||||
pmdepend_t *depend = alpm_list_getdata(i);
|
alpm_depend_t *depend = alpm_list_getdata(i);
|
||||||
alpm_pkg_t *provider = alpm_find_dbs_satisfier(handle, dblist, depend->name);
|
alpm_pkg_t *provider = alpm_find_dbs_satisfier(handle, dblist, depend->name);
|
||||||
|
|
||||||
if(provider) {
|
if(provider) {
|
||||||
|
Loading…
Reference in New Issue
Block a user