mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-22 15:58:50 -05:00
Add an _alpm_depcmp_literal() function
This omits the finding of matching provisions and only checks the package itself against the provided dep. Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
78b63ce7c3
commit
d008a816f1
@ -368,20 +368,23 @@ static int dep_vercmp(const char *version1, alpm_depmod_t mod,
|
|||||||
return equal;
|
return equal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int _alpm_depcmp_literal(alpm_pkg_t *pkg, alpm_depend_t *dep)
|
||||||
|
{
|
||||||
|
if(pkg->name_hash != dep->name_hash
|
||||||
|
|| strcmp(pkg->name, dep->name) != 0) {
|
||||||
|
/* skip more expensive checks */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return dep_vercmp(pkg->version, dep->mod, dep->version);
|
||||||
|
}
|
||||||
|
|
||||||
int _alpm_depcmp(alpm_pkg_t *pkg, alpm_depend_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 = _alpm_depcmp_literal(pkg, dep);
|
||||||
|
|
||||||
/* check (pkg->name, pkg->version) */
|
if(satisfy) {
|
||||||
if(pkg->name_hash != dep->name_hash) {
|
return satisfy;
|
||||||
/* skip more expensive checks */
|
|
||||||
} else {
|
|
||||||
satisfy = (strcmp(pkg->name, dep->name) == 0
|
|
||||||
&& dep_vercmp(pkg->version, dep->mod, dep->version));
|
|
||||||
if(satisfy) {
|
|
||||||
return satisfy;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check provisions, name and version if available */
|
/* check provisions, name and version if available */
|
||||||
|
@ -36,6 +36,7 @@ int _alpm_resolvedeps(alpm_handle_t *handle, alpm_list_t *localpkgs, alpm_pkg_t
|
|||||||
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);
|
||||||
alpm_depend_t *_alpm_splitdep(const char *depstring);
|
alpm_depend_t *_alpm_splitdep(const char *depstring);
|
||||||
|
int _alpm_depcmp_literal(alpm_pkg_t *pkg, alpm_depend_t *dep);
|
||||||
int _alpm_depcmp(alpm_pkg_t *pkg, alpm_depend_t *dep);
|
int _alpm_depcmp(alpm_pkg_t *pkg, alpm_depend_t *dep);
|
||||||
|
|
||||||
#endif /* _ALPM_DEPS_H */
|
#endif /* _ALPM_DEPS_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user