From 179f8fa90130ac715f4fb3e2323ac98f6a75bb0e Mon Sep 17 00:00:00 2001 From: Sascha Kruse Date: Tue, 22 Feb 2011 08:30:12 +0100 Subject: [PATCH] Match wildcards in IgnorePkg, IgnoreGroup Signed-off-by: Sascha Kruse --- lib/libalpm/package.c | 16 ++++++++++++---- 1 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c index 0a1102c..cbb1f1f 100644 --- a/lib/libalpm/package.c +++ b/lib/libalpm/package.c @@ -30,6 +30,7 @@ #include #include #include +#include /* libalpm */ #include "package.h" @@ -559,6 +560,13 @@ pmpkg_t *_alpm_pkg_find(alpm_list_t *haystack, const char *needle) return(NULL); } +static int fnmatch_cmp(const void *pattern, const void *string) +{ + char *pat = (char *)pattern; + char *str = (char *)string; + return fnmatch(pat, str, 0); +} + /** Test if a package should be ignored. * * Checks if the package is ignored via IgnorePkg, or if the package is @@ -573,14 +581,14 @@ int _alpm_pkg_should_ignore(pmpkg_t *pkg) alpm_list_t *groups = NULL; /* first see if the package is ignored */ - if(alpm_list_find_str(handle->ignorepkg, alpm_pkg_get_name(pkg))) { + if(alpm_list_find(handle->ignorepkg, alpm_pkg_get_name(pkg), fnmatch_cmp)) { return(1); } /* next see if the package is in a group that is ignored */ - for(groups = handle->ignoregrp; groups; groups = alpm_list_next(groups)) { - char *grp = (char *)alpm_list_getdata(groups); - if(alpm_list_find_str(alpm_pkg_get_groups(pkg), grp)) { + for(groups = alpm_pkg_get_groups(pkg); groups; groups = alpm_list_next(groups)) { + const char *group = alpm_list_getdata(groups); + if(alpm_list_find(handle->ignoregrp, group, fnmatch_cmp)) { return(1); } } -- 1.7.4.1