1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-22 15:58:50 -05:00

Rename pmdepend_t to alpm_depend_t

Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Allan McRae 2011-06-28 14:29:55 +10:00
parent 6b62508c86
commit 9540dfc4d9
10 changed files with 39 additions and 39 deletions

View File

@ -106,17 +106,17 @@ typedef struct __alpm_pkg_t alpm_pkg_t;
typedef struct __alpm_trans_t alpm_trans_t;
/** Dependency */
typedef struct _pmdepend_t {
typedef struct _alpm_depend_t {
char *name;
char *version;
unsigned long name_hash;
alpm_depmod_t mod;
} pmdepend_t;
} alpm_depend_t;
/** Missing dependency */
typedef struct _pmdepmissing_t {
char *target;
pmdepend_t *depend;
alpm_depend_t *depend;
/* this is used in case of remove dependency error only */
char *causingpkg;
} 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);
/** 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
* @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);
@ -967,7 +967,7 @@ alpm_list_t *alpm_checkconflicts(alpm_handle_t *handle, alpm_list_t *pkglist);
* @param dep a dependency info structure
* @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);
/** @} */

View File

@ -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) {
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);
}
} else if(strcmp(line, "%OPTDEPENDS%") == 0) {

View File

@ -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 */
newpkg->isize = atol(ptr);
} 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);
} else if(strcmp(key, "optdepend") == 0) {
newpkg->optdepends = alpm_list_add(newpkg->optdepends, strdup(ptr));

View File

@ -145,7 +145,7 @@ static void check_conflict(alpm_handle_t *handle,
for(j = alpm_pkg_get_conflicts(pkg1); j; j = j->next) {
const char *conflict = j->data;
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) {
alpm_pkg_t *pkg2 = k->data;

View File

@ -37,14 +37,14 @@
#include "handle.h"
#include "trans.h"
void _alpm_dep_free(pmdepend_t *dep)
void _alpm_dep_free(alpm_depend_t *dep)
{
FREE(dep->name);
FREE(dep->version);
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)
{
pmdepmissing_t *miss;
@ -208,10 +208,10 @@ static int no_dep_version(alpm_handle_t *handle)
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) {
pmdepend_t *newdep = _alpm_dep_dup(dep);
alpm_depend_t *newdep = _alpm_dep_dup(dep);
ASSERT(newdep, return dep);
newdep->mod = PM_DEP_MOD_ANY;
dep = newdep;
@ -219,14 +219,14 @@ static pmdepend_t *filtered_depend(pmdepend_t *dep, int nodepversion)
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) {
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;
@ -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)
{
pmdepend_t *dep = _alpm_splitdep(depstring);
alpm_depend_t *dep = _alpm_splitdep(depstring);
if(!dep) {
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));
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);
/* 1. we check the upgrade list */
/* 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) {
alpm_pkg_t *lp = i->data;
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);
alpm_pkg_t *causingpkg = find_dep_satisfier(modified, depend);
/* 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;
}
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;
int satisfy = 0;
@ -411,16 +411,16 @@ int _alpm_depcmp(alpm_pkg_t *pkg, pmdepend_t *dep)
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;
if(depstring == 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
* increment the ptr accordingly so we can copy the right strings. */
@ -455,10 +455,10 @@ pmdepend_t *_alpm_splitdep(const char *depstring)
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;
CALLOC(newdep, 1, sizeof(pmdepend_t), return NULL);
alpm_depend_t *newdep;
CALLOC(newdep, 1, sizeof(alpm_depend_t), return NULL);
STRDUP(newdep->name, dep->name, return NULL);
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
* @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 *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_list_t *dbs, const char *depstring)
{
pmdepend_t *dep;
alpm_depend_t *dep;
alpm_pkg_t *pkg;
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) {
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
* this dependency */
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;
}
/** 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!
* @param dep the depend to turn into a string
* @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;
char *str;

View File

@ -27,16 +27,16 @@
#include "package.h"
#include "alpm.h"
void _alpm_dep_free(pmdepend_t *dep);
pmdepend_t *_alpm_dep_dup(const pmdepend_t *dep);
void _alpm_dep_free(alpm_depend_t *dep);
alpm_depend_t *_alpm_dep_dup(const alpm_depend_t *dep);
void _alpm_depmiss_free(pmdepmissing_t *miss);
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);
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 **data);
pmdepend_t *_alpm_splitdep(const char *depstring);
int _alpm_depcmp(alpm_pkg_t *pkg, pmdepend_t *dep);
alpm_depend_t *_alpm_splitdep(const char *depstring);
int _alpm_depcmp(alpm_pkg_t *pkg, alpm_depend_t *dep);
#endif /* _ALPM_DEPS_H */

View File

@ -419,8 +419,8 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data)
conflict->package1, conflict->package2);
/* if sync1 provides sync2, we remove sync2 from the targets, and vice versa */
pmdepend_t *dep1 = _alpm_splitdep(conflict->package1);
pmdepend_t *dep2 = _alpm_splitdep(conflict->package2);
alpm_depend_t *dep1 = _alpm_splitdep(conflict->package1);
alpm_depend_t *dep2 = _alpm_splitdep(conflict->package2);
if(_alpm_depcmp(sync1, dep2)) {
rsync = sync2;
sync = sync1;

View File

@ -312,7 +312,7 @@ void cb_trans_conv(pmtransconv_t event, void *data1, void *data2,
{
alpm_list_t *providers = (alpm_list_t *)data1;
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,
depstring);
free(depstring);

View File

@ -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 */
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));
}

View File

@ -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));
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);
if(provider) {