[pacman-dev] [PATCH] 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> --- lib/libalpm/db.c | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c index 561967c..4bd55d2 100644 --- a/lib/libalpm/db.c +++ b/lib/libalpm/db.c @@ -397,10 +397,10 @@ alpm_list_t *_alpm_db_search(pmdb_t *db, const alpm_list_t *needles) else if (desc && regexec(®, desc, 0, 0, 0) == 0) { matched = desc; } - /* check provides */ /* TODO: should we be doing this, and should we print something * 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) { if (regexec(®, k->data, 0, 0, 0) == 0) { matched = k->data; @@ -408,6 +408,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(®, k->data, 0, 0, 0) == 0) { + matched = k->data; + break; + } + } + } if(matched != NULL) { _alpm_log(PM_LOG_DEBUG, " search target '%s' matched '%s'\n", -- 1.6.3.2
On Sat, Jun 6, 2009 at 12:31 PM, Dan McGee<dan@archlinux.org> wrote:
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>
Thoughts anyone? Even if just a +1 before I blindly pull this in.
--- lib/libalpm/db.c | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c index 561967c..4bd55d2 100644 --- a/lib/libalpm/db.c +++ b/lib/libalpm/db.c @@ -397,10 +397,10 @@ alpm_list_t *_alpm_db_search(pmdb_t *db, const alpm_list_t *needles) else if (desc && regexec(®, desc, 0, 0, 0) == 0) { matched = desc; } - /* check provides */ /* TODO: should we be doing this, and should we print something * 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) { if (regexec(®, k->data, 0, 0, 0) == 0) { matched = k->data; @@ -408,6 +408,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(®, k->data, 0, 0, 0) == 0) { + matched = k->data; + break; + } + } + }
if(matched != NULL) { _alpm_log(PM_LOG_DEBUG, " search target '%s' matched '%s'\n", -- 1.6.3.2
Dan McGee wrote:
On Sat, Jun 6, 2009 at 12:31 PM, Dan McGee<dan@archlinux.org> wrote:
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>
Thoughts anyone? Even if just a +1 before I blindly pull this in.
+1
On Sat, Jun 13, 2009 at 5:00 PM, Dan McGee<dan@archlinux.org> wrote:
On Sat, Jun 6, 2009 at 12:31 PM, Dan McGee<dan@archlinux.org> wrote:
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>
Thoughts anyone? Even if just a +1 before I blindly pull this in.
should be fine.
participants (3)
-
Allan McRae
-
Dan McGee
-
Xavier