FS#20360 - IgnorePkg, IgnoreGroup: match wildcards

Attached to Project: Pacman
Opened by Matthew (piezoelectric) - Wednesday, 04 August 2010, 01:59 GMT
Last edited by Dave Reisner (falconindy) - Sunday, 13 November 2011, 19:46 GMT
Task Type Feature Request
Category General
Status Closed
Assigned To Dave Reisner (falconindy)
Architecture All
Severity Very Low
Priority Normal
Reported Version 3.4.0
Due in Version 4.1.0
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Wild cards would be nice for IgnorePkg (and IgnoreGroup I guess).

IgnorePkg = texlive-*

for example
This task depends upon

Closed by  Dave Reisner (falconindy)
Sunday, 13 November 2011, 19:46 GMT
Reason for closing:  Implemented
Additional comments about closing:  see comments
Comment by Sascha Kruse (knopwob) - Tuesday, 22 February 2011, 08:31 GMT
Here's a patch.
Comment by Dan McGee (toofishes) - Tuesday, 22 February 2011, 19:51 GMT
1. Not a huge fan of the too-similar underscore prefixed name. Choose a different name that is indicative of what this function does, rather than trying not to clash with the fnmatch() function name.
2. The casts are ugly- if you have to write a function anyway, make its declaration match the alpm_list_fn_cmp spec and drop the cast, please, doing them inside the function instead (something like _alpm_pkg_cmp).
3. Bonus- perhaps we should invert the groups loop so we only need one fnmatch comparator. So instead:
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);
}
}
Comment by Sascha Kruse (knopwob) - Tuesday, 22 February 2011, 20:54 GMT
Thank you for the review. Here's a second try.
Comment by Dan McGee (toofishes) - Tuesday, 22 February 2011, 21:09 GMT
Looks good now- just one minor tweak, you shouldn't cast away the const; pat and str are most definitely const. C also doesn't require he right hand side casts AFAIK; so you can probably do without those- the assignment enough is an explicit cast. Documentation updates would be great too.

const char *pat = pattern;
const char *str = string;
Comment by Sascha Kruse (knopwob) - Wednesday, 23 February 2011, 01:31 GMT
Documentation added and casting fixed.
The second patch is the same as the other one + the same idea applied to HoldPkg. I don't know, whether there's any need for wildcards in HoldPkg or not, but it wouldn't hurt either, i guess.
Comment by Dave Reisner (falconindy) - Sunday, 13 November 2011, 19:46 GMT

Loading...