See bug 430288.
So, we'd use a regular expression to identify epatch calls. Then we'd expand variables like ${FILESDIR} and ${PV} in the arguments, and try to resolve them to files. If the calls use relative paths that rely on the current working directory, would we just ignore them?
it's IMO extremely hard to do this I wrote an implementation a long time ago for Prefix, but with a lot of evals, and more (to support full bash syntax of expansions), it's still missing some cases due to variables being set, loops being used, etc. (example: mpfr)
I was thinking about this after making the comment on the referenced bug, and I agree it would be extremely hard to implement. In that particular case a direct string match would have caught it since there were no variables other than "${FILESDIR}" in use. But even that would be tricky to pull off without evaluating the string to be sure there's no variable or command substitution taking place. You'd end up with a very complicated check that would catch a small subset of patches.
I fell over this (committing an ebuild with a missing patch) a few days ago and already wanted to open a feature request, just to find out there already is this one. I wonder if we should review this, because in the meantime things got easier. Most ebuilds don't use epatch any more, they use the PATCHES variable. It shouldn't be too hard to parse PATCHES and check if all referenced patches in FILESDIR are actually there and committed.
repoman support has been removed per bug 835013. Please file a new bug (or, I suppose, reopen this one) if you feel this check is still applicable to pkgcheck and doesn't already exist.
I think we could do this by: * having it off-by-default (like PerlCheck) * parsing PATCHES if it's in global scope (not in a phase) * only bother if FILESDIR is in the element name (maybe even bail if there's any non-FILESDIR in the array at all) * perhaps even check the element is a simple pattern (nothing fancy, maybe ${PN} or ${P} at most) Something is better than nothing here, maybe? The other thing ofc is we can tell people to maybe use a git hook to warn on unstaged files.