mirror of
https://github.com/moparisthebest/pacman
synced 2024-11-12 04:15:06 -05:00
Convert resolvedep() to use _alpm_depcmp_literal()
The whole first loop is trying to check literals only, so teach it to do so. Also, reorder operations to make more sense by putting the strcmp() first in the literal loop, and using a very cheap name_hash check first in the second loop. Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
3752edbff4
commit
6cfc4757b9
@ -561,14 +561,16 @@ static alpm_pkg_t *resolvedep(alpm_handle_t *handle, alpm_depend_t *dep,
|
|||||||
/* 1. literals */
|
/* 1. literals */
|
||||||
for(i = dbs; i; i = i->next) {
|
for(i = dbs; i; i = i->next) {
|
||||||
alpm_pkg_t *pkg = _alpm_db_get_pkgfromcache(i->data, dep->name);
|
alpm_pkg_t *pkg = _alpm_db_get_pkgfromcache(i->data, dep->name);
|
||||||
if(pkg && _alpm_depcmp(pkg, dep) && !_alpm_pkg_find(excluding, pkg->name)) {
|
if(pkg && _alpm_depcmp_literal(pkg, dep)
|
||||||
|
&& !_alpm_pkg_find(excluding, pkg->name)) {
|
||||||
if(_alpm_pkg_should_ignore(handle, pkg)) {
|
if(_alpm_pkg_should_ignore(handle, pkg)) {
|
||||||
int install = 0;
|
int install = 0;
|
||||||
if(prompt) {
|
if(prompt) {
|
||||||
QUESTION(handle->trans, ALPM_TRANS_CONV_INSTALL_IGNOREPKG, pkg,
|
QUESTION(handle->trans, ALPM_TRANS_CONV_INSTALL_IGNOREPKG, pkg,
|
||||||
NULL, NULL, &install);
|
NULL, NULL, &install);
|
||||||
} else {
|
} else {
|
||||||
_alpm_log(handle, ALPM_LOG_WARNING, _("ignoring package %s-%s\n"), pkg->name, pkg->version);
|
_alpm_log(handle, ALPM_LOG_WARNING, _("ignoring package %s-%s\n"),
|
||||||
|
pkg->name, pkg->version);
|
||||||
}
|
}
|
||||||
if(!install) {
|
if(!install) {
|
||||||
ignored = 1;
|
ignored = 1;
|
||||||
@ -582,15 +584,18 @@ static alpm_pkg_t *resolvedep(alpm_handle_t *handle, alpm_depend_t *dep,
|
|||||||
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) {
|
||||||
alpm_pkg_t *pkg = j->data;
|
alpm_pkg_t *pkg = j->data;
|
||||||
if(_alpm_depcmp(pkg, dep) && strcmp(pkg->name, dep->name) != 0 &&
|
/* with hash != hash, we can even skip the strcmp() as we know they can't
|
||||||
!_alpm_pkg_find(excluding, pkg->name)) {
|
* possibly be the same string */
|
||||||
|
if(pkg->name_hash != dep->name_hash && _alpm_depcmp(pkg, dep)
|
||||||
|
&& !_alpm_pkg_find(excluding, pkg->name)) {
|
||||||
if(_alpm_pkg_should_ignore(handle, pkg)) {
|
if(_alpm_pkg_should_ignore(handle, pkg)) {
|
||||||
int install = 0;
|
int install = 0;
|
||||||
if(prompt) {
|
if(prompt) {
|
||||||
QUESTION(handle->trans, ALPM_TRANS_CONV_INSTALL_IGNOREPKG,
|
QUESTION(handle->trans, ALPM_TRANS_CONV_INSTALL_IGNOREPKG,
|
||||||
pkg, NULL, NULL, &install);
|
pkg, NULL, NULL, &install);
|
||||||
} else {
|
} else {
|
||||||
_alpm_log(handle, ALPM_LOG_WARNING, _("ignoring package %s-%s\n"), pkg->name, pkg->version);
|
_alpm_log(handle, ALPM_LOG_WARNING, _("ignoring package %s-%s\n"),
|
||||||
|
pkg->name, pkg->version);
|
||||||
}
|
}
|
||||||
if(!install) {
|
if(!install) {
|
||||||
ignored = 1;
|
ignored = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user