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

Search package groups when searching a DB

See FS#13099. This makes sense especially for the pacman frontend, as we
show groups in the search output.

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2009-06-06 12:30:30 -05:00
parent 8bbaf045b9
commit 8c8fa2d82c

View File

@ -398,10 +398,10 @@ alpm_list_t *_alpm_db_search(pmdb_t *db, const alpm_list_t *needles)
else if (desc && regexec(&reg, desc, 0, 0, 0) == 0) { else if (desc && regexec(&reg, desc, 0, 0, 0) == 0) {
matched = desc; matched = desc;
} }
/* check provides */
/* TODO: should we be doing this, and should we print something /* TODO: should we be doing this, and should we print something
* differently when we do match it since it isn't currently printed? */ * differently when we do match it since it isn't currently printed? */
else { if(!matched) {
/* check provides */
for(k = alpm_pkg_get_provides(pkg); k; k = k->next) { for(k = alpm_pkg_get_provides(pkg); k; k = k->next) {
if (regexec(&reg, k->data, 0, 0, 0) == 0) { if (regexec(&reg, k->data, 0, 0, 0) == 0) {
matched = k->data; matched = k->data;
@ -409,6 +409,15 @@ alpm_list_t *_alpm_db_search(pmdb_t *db, const alpm_list_t *needles)
} }
} }
} }
if(!matched) {
/* check groups */
for(k = alpm_pkg_get_groups(pkg); k; k = k->next) {
if (regexec(&reg, k->data, 0, 0, 0) == 0) {
matched = k->data;
break;
}
}
}
if(matched != NULL) { if(matched != NULL) {
_alpm_log(PM_LOG_DEBUG, " search target '%s' matched '%s'\n", _alpm_log(PM_LOG_DEBUG, " search target '%s' matched '%s'\n",