insane.bbclass: lock down pending patches
RFC PATCH 1/1 insane.bbclass: lock down pending patches
Misuse of 'Pending' patch status has been a problem for a long time; let's disallow that in any newly added patches. Please do the upsream submission at the same time as you submit the patch to oe-core.
--- meta/classes/insane.bbclass | 11 + meta/files/pending-patches-lockdown.txt | 368 ++++++++++++++++++++++++ 2 files changed, 379 insertions(+) create mode 100644 meta/files/pending-patches-lockdown.txt
meta/classes/insane.bbclass +11 -0
@@ -1172,6 +1172,10 @@ python do_qa_patch() { import re from oe import patch + locked_pending = [] + for locked_p in open(os.path.join(d.getVar('COREBASE'),'meta/files/pending-patches-lockdown.txt')).readlines(): + locked_pending.append(os.path.join(d.getVar('COREBASE'), locked_p.split()[0])) + for url in patch.src_patches(d): (_, _, fullpath, _, _, _) = bb.fetch.decodeurl(url)
@@ -1184,10 +1188,17 @@ python do_qa_patch() { content = open(fullpath, encoding='utf-8', errors='ignore').read() kinda_status_re = re.compile(r"^.*upstream.*status.*$", re.IGNORECASE | re.MULTILINE) strict_status_re = re.compile(r"^Upstream-Status: (Pending|Submitted|Denied|Accepted|Inappropriate|Backport)( .+)?$", re.MULTILINE) + pending_status_re = re.compile(r"^Upstream-Status: Pending( .+)?$", re.MULTILINE) match_kinda = kinda_status_re.search(content) match_strict = strict_status_re.search(content) + match_pending = pending_status_re.search(content) guidelines = "https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines#Patch_Header_Recommendations:_Upstream-Status" + if match_pending and not fullpath in locked_pending: + bb.error("Pending status is not allowed in patch\n%s\nPlease submit the patch upstream or otherwise set the status according to %s ." % (fullpath, guidelines)) + if not match_pending and fullpath in locked_pending: + bb.error("Please delete patch\n%s\n from meta/files/pending-patches-lockdown.txt" % (fullpath)) + if not match_strict: if match_kinda: bb.error("Malformed Upstream-Status in patch\n%s\nPlease correct according to %s :\n%s" % (fullpath, guidelines, match_kinda.group(0)))
meta/files/pending-patches-lockdown.txt new file +368 -0
368 lines not on this page · raw message
Signature · 1 line
2.20.1
Quoted 3 lines · Alexander Kanavin
Misuse of 'Pending' patch status has been a problem for a long time; let's disallow that in any newly added patches. Please do the upsream submission at the same time as you submit the patch to oe-core.
As much as I hate pending patches, and I really do hate patches that sit in pending, there are situations where you know the problem, can work around it, but still want to push it upstream at some point pending further discussion.
"Inappropriate" would mean the patch wouldn't be looked at again, "Submitted" means an upstreamable solution has been formulated, and "Pending" is that middle ground.
Yes, we should push back, and if a new patch is added with Pending status that is clearly good for upstream we should be asking the submitter to do that. But I don't think that effectively banning Pending patches in core is the right way forwards.
Ross
Quoted 6 lines · Ross Burton
As much as I hate pending patches, and I really do hate patches that sit in pending, there are situations where you know the problem, can work around it, but still want to push it upstream at some point pending further discussion.
These situations are rare and you know it. Almost all of the time it's laziness and abuse of pending so that submission can be avoided altogether or pushed onto maintainers, e.g. me, not a 'need for further discussion'.
Quoted 5 lines
Yes, we should push back, and if a new patch is added with Pending status that is clearly good for upstream we should be asking the submitter to do that. But I don't think that effectively banning Pending patches in core is the right way forwards.
But this doesn't ban them completely. If someone has a genuine reason to not submit yet, they can add the patch to lockdown list, and provide a better explanation for why it should be there. Almost all of the time when someone submits a Pending patch, they do not bother to explain why it isn't yet submitted, and no one has time or willpower to argue with it. Conversely, from the submitter's perspective, it's a lot harder to argue with an error message that sets policy than it is to argue with core maintainers expressing opinion. I do think the lockdown shifts the balance towards a more disciplined approach.
Alex
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 9 lines · Alexander Kanavin via lists.openembedded.org
Quoted 6 lines · Ross Burton
As much as I hate pending patches, and I really do hate patches that sit in pending, there are situations where you know the problem, can work around it, but still want to push it upstream at some point pending further discussion.
Quoted 4 lines
These situations are rare and you know it. Almost all of the time it's laziness and abuse of pending so that submission can be avoided altogether or pushed onto maintainers, e.g. me, not a 'need for further discussion'.
I want to add something: if there's truly a need for further discussion, that need is typically with upstream, and so the patch can be marked as Inappropriate [link to upstream discussion]. If the patch isn't that good, file a ticket instead and link to it.
Alex
Quoted 17 lines · Alexander Kanavin
Quoted 9 lines · Alexander Kanavin via lists.openembedded.org
Quoted 6 lines · Ross Burton
As much as I hate pending patches, and I really do hate patches that sit in pending, there are situations where you know the problem, can work around it, but still want to push it upstream at some point pending further discussion.
Quoted 4 lines
These situations are rare and you know it. Almost all of the time it's laziness and abuse of pending so that submission can be avoided altogether or pushed onto maintainers, e.g. me, not a 'need for further discussion'.
Quoted 4 lines
I want to add something: if there's truly a need for further discussion, that need is typically with upstream, and so the patch can be marked as Inappropriate [link to upstream discussion]. If the patch isn't that good, file a ticket instead and link to it.
Ross has a point here. If we go this route we'll just push people to mark patches as Inappropriate instead. People will know Pending isn't acceptable so they'll just use Inappropriate and we'll lose the ability to see things which may be discussed with upstream and those which realistically never can. We'll have to review patches marked as Inappropriate even more carefully.
We don't just want to reduce our Pending patches, my own aim is to reduce the total of patches we have.
Backported patches eventually fall out the system so those don't worry me. Submitted stand some chance. Pending are the unknowns but a high number of Inappropriate will be the next issue.
We need to keep the end goal in sight here - not to carry patches at all ideally.
Cheers,
Richard
Quoted 9 lines · Richard Purdie
Ross has a point here. If we go this route we'll just push people to mark patches as Inappropriate instead. People will know Pending isn't acceptable so
they'll just use Inappropriate and we'll lose the ability to see things which
may be discussed with upstream and those which realistically never can. We'll
have to review patches marked as Inappropriate even more carefully.
Right, but what can we do then to make it more clear that new Pending patches aren't welcome? I don't want them to keep slipping through into master, and I certainly do not want to argue with what is essentially laziness on the part of the submitter. I guess a mailing list nag-bot that spots those submissions could help here.
Alex
Quoted 11 lines · Alexander Kanavin
Quoted 8 lines · Richard Purdie
Ross has a point here. If we go this route we'll just push people to mark patches as Inappropriate instead. People will know Pending isn't acceptable so
they'll just use Inappropriate and we'll lose the ability to see things which
may be discussed with upstream and those which realistically never can. We'll
have to review patches marked as Inappropriate even more carefully.
Quoted 5 lines
Right, but what can we do then to make it more clear that new Pending patches aren't welcome? I don't want them to keep slipping through into master, and I certainly do not want to argue with what is essentially laziness on the part of the submitter. I guess a mailing list nag-bot that spots those submissions could help here.
First, we should ask if we have a problem. Ross had some metrics/graphs which he was kind enough to find and update:
http://www.burtonini.com/yoctometrics/
Whilst there are blips, it does clearly show that our number of patches in OE- Core has steadily decreased over the last 5 years (~1900 -> 1266). Also, the number in pending status had dropped from 816 to ~490 recently and thanks to the recent push, 374 (and likely less again when more merges).
I have pushed occasionally to get things cleaned up and we are slowly winning as the trend is downwards. I believe I have pushed back on Pending patches a bit more over time and I think it is working. As we lower the numbers, it becomes harder for people to justify adding them too.
Reproducibility did add to the patch backlog and we sometimes trade features for patch overhead, it is all an inexact science but I think the overall picture is promising.
We've also some known problem areas. I've long felt guilty about the state of the libtool and gcc patchsets. Those are in a bit better state now and I know many other areas are thanks to your work.
Finally, I'd add that the "pending" legacy was there from when we first started to mark up the patches and their status as we simply couldn't handle every patch when we started marking up patches. Many of the pending ones are old and badly documented, we have significantly increased the patch documentation requirement since then based upon experience. This should make it hard to end up in such a mess again.
Cheers,
Richard