From 747f7e2b038783828ebe5c08131e818bc450fe09 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 --- doc/pacman.conf.5.txt | 4 ++-- lib/libalpm/package.c | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/doc/pacman.conf.5.txt b/doc/pacman.conf.5.txt index cb4c589..876f548 100644 --- a/doc/pacman.conf.5.txt +++ b/doc/pacman.conf.5.txt @@ -81,7 +81,7 @@ Options *IgnorePkg =* package ...:: Instructs pacman to ignore any upgrades for this package when performing - a '\--sysupgrade'. + a '\--sysupgrade'. Shell-like wildcards will get expanded. *SyncFirst =* package ...:: Instructs pacman to check for newer version of these packages before any @@ -94,7 +94,7 @@ Options *IgnoreGroup =* group ...:: Instructs pacman to ignore any upgrades for all packages in this - group when performing a '\--sysupgrade'. + group when performing a '\--sysupgrade'. Shell-like wildcards will get expanded. *Include =* path:: Include another config file. This file can include repositories or diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c index 0a1102c..818a0c5 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) +{ + const char *pat = pattern; + const char *str = 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