Having seen DaveJ’s recent comment on RHEL-4 kernel having over thousand patches applied, I had this nasty feeling I’d seen a comment somewhere in the %prep parsing of rpmbuild stating “we can only handle 1024 patches!” And sure enough, there it is in parsePrep.c… yet all the 1076 patches are applied.
Turns out there’s a little known feature in the %patch “macro”: it can take several patch numbers at once, and that’s what the 1024 patch limit is about. You can use it like this: “%patch -p1 1 2 3 4” instead of having four separate %patch lines.
Except that it’ll probably tell you “error: No patch number 0” because %patch is treated as %patch0. So the above should be “%patch1 -p1 2 3 4” to actually work. What a wonderfully broken feature, ugh.