<p>Actually, we ended up solving this different in cooker, where in stead of patching rpm for support,  but rather by adding support for %{_specfile}, we got the patch numbers differently:<br>
%apply_patches %{lua:<br>
f = io.open(rpm.expand("%{_specfile}"))<br>
if f then<br>
for l in f:lines() do<br>
match,b,num = string.find(string.lower(l), "^%s<em>patch(%d+)%s</em>:.*$")<br>
if match then print(rpm.expand("%patch"..num.." -p1 -b "..string.format(".%04d~",num).." \\n")); end<br>
end<br>
f:close()<br>
end<br>
}</p>
<p>(Notice that we also made sure to reuse the traditional %patch macro to fully achieve same functionality of without maintaining two sets of different patch macros.</p>
<p>IMO. this is the cleanest,  least complex and easiest way to maintain it..</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/rpm-software-management/rpm/commit/1d7b45e484883f3a340f40610b060cc100f62caa#commitcomment-20654362">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ANb804jRV4aXh2SM1vDg5GsJY_bfNs_aks5rXJd2gaJpZM4Lwyt2">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/ANb804XPnQcZVxux0n5-eUDUFCwkSVgLks5rXJd2gaJpZM4Lwyt2.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/rpm-software-management/rpm/commit/1d7b45e484883f3a340f40610b060cc100f62caa#commitcomment-20654362"></link>
  <meta itemprop="name" content="View Commit"></meta>
</div>
<meta itemprop="description" content="View this Commit on GitHub"></meta>
</div>

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/rpm-software-management/rpm","title":"rpm-software-management/rpm","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/rpm-software-management/rpm"}},"updates":{"snippets":[{"icon":"PERSON","message":"@proyvind on 1d7b45e: Actually, we ended up solving this different in cooker, where in stead of patching rpm for support,  but rather by adding support for %{_specfile}, we got the patch numbers differently:\r\n%apply_patches %{lua:\\\r\nf = io.open(rpm.expand(\"%{_specfile}\"))\\\r\nif f then\\\r\n  for l in f:lines() do\\\r\n    match,b,num = string.find(string.lower(l), \"^%s*patch(%d+)%s*:.*$\")\\\r\n    if match then print(rpm.expand(\"%patch\"..num..\" -p1 -b \"..string.format(\".%04d~\",num)..\" \\\\\\n\")); end\\\r\n  end\\\r\n  f:close()\\\r\nend\\\r\n}\r\n\r\n(Notice that we also made sure to reuse the traditional %patch macro to fully achieve same functionality of without maintaining two sets of different patch macros.\r\n\r\nIMO. this is the cleanest,  least complex and easiest way to maintain it.."}],"action":{"name":"View Commit","url":"https://github.com/rpm-software-management/rpm/commit/1d7b45e484883f3a340f40610b060cc100f62caa#commitcomment-20654362"}}}</script>