Skip to contentSkip to conversation

patchtest: warn if Upstream-Status is after patch scissors

PATCH In review Aditya GS 2 participants 3 messages Jun 11 – Jun 15

lore
Share & tools
lore

Aditya GS

author
#0 lore raw

PATCH v3 1/1 patchtest: warn if Upstream-Status is after patch scissors

[YOCTO #15940]

Detect cases where Upstream-Status is placed after the patch scissors ("---") and emit a warning instead of failing.

Such placement may be intentional in some workflows to avoid including the tag in upstream commits.

v3:
- Fix indentation issues from previous version
- Keep changes minimal and avoid unrelated formatting changes
- Retain intended warning behavior

---
 meta/lib/patchtest/tests/test_patch.py | 24 +++++++++---------------
 1 file changed, 9 insertions(+), 15 deletions(-)
meta/lib/patchtest/tests/test_patch.py +9 -15
index 3b33b5a199..598a2234aa 100644
@@ -67,13 +67,10 @@ class TestPatch(base.Base):
 
             if not header_has_upstream:
                 if body_has_upstream:
-                    self.fail(
-                        'Upstream-Status is present only after the patch scissors. '
-                        "It must be placed in the patch header before the scissors line.",
-                        data=[
-                            ("Standard format", self.standard_format),
-                            ("Valid status", self.valid_status),
-                        ],
+                    print(
+                        "WARNING: Upstream-Status is present only after the patch scissors. "
+                        "It may be ignored by git and lost during patch refresh. "
+                        "Consider placing it before the scissors line."
                     )
                 else:
                     self.fail(
@@ -92,15 +89,12 @@ class TestPatch(base.Base):
                     continue
 
                 if scissors_index is not None and idx > scissors_index:
-                    self.fail(
-                        'Upstream-Status must be placed in the patch header before the scissors line, '
-                        "but was found afterwards.",
-                        data=[
-                            ("Current", line.lstrip("+")),
-                            ("Standard format", self.standard_format),
-                            ("Valid status", self.valid_status),
-                        ],
+                    print(
+                        "WARNING: Upstream-Status found after patch scissors. "
+                        "It may be ignored by git and lost during patch refresh. "
+                        "Consider placing it before the scissors line."
                     )
+                    continue
 
                 if patchtest_patterns.inappropriate.searchString(line):
                     try:
Signature · 1 line
2.34.1
#1 lore raw
Quoted 8 lines · Aditya GS via lists.openembedded.org

[YOCTO #15940]

Detect cases where Upstream-Status is placed after the patch scissors ("---") and emit a warning instead of failing.

Such placement may be intentional in some workflows to avoid including the tag in upstream commits.

I'm afraid there has been a confusion here, and the patch is not correct.

The bug was already addressed in oe-core earlier:

commit 2156ef9e6defa3ec9087789fcea25fb4fee7b83c

Author: Luka Krstic <[email protected]>
Date:   Thu Dec 18 10:11:38 2025 +0100

patchtest: reject Upstream-Status after scissors

but the bugzilla ticket was never closed.

Then https://bugzilla.yoctoproject.org/show_bug.cgi?id=15940#c1 was interpreted as a request to downgrade it to a warning, but we should not be doing that: it means patchtest will not longer actually notify of the issue on the oe-core mailing list.

I understand some other layers intentionally put it after the scissors; if they're using patchtest, they can disable this particular test or configure it to produce some kind of soft fail, but in oe-core it should remain a hard fail.

Alex

author
#2 lore raw

Hi Alex,

Thanks for the clarification.

I understand now that the behavior should remain a hard failure in oe-core, and that the earlier interpretation was incorrect.

I'll drop the patch that downgrades the check to a warning.

Thanks for pointing out the existing commit in oe-core as well that helps clear up the confusion.

Regards,
Aditya

Quoted 35 lines · Alexander Kanavin
Quoted 8 lines · Aditya GS via lists.openembedded.org

[YOCTO #15940]

Detect cases where Upstream-Status is placed after the patch scissors ("---") and emit a warning instead of failing.

Such placement may be intentional in some workflows to avoid including the tag in upstream commits.

I'm afraid there has been a confusion here, and the patch is not correct.

The bug was already addressed in oe-core earlier:

commit 2156ef9e6defa3ec9087789fcea25fb4fee7b83c

Author: Luka Krstic <[email protected]>
Date:   Thu Dec 18 10:11:38 2025 +0100

patchtest: reject Upstream-Status after scissors

but the bugzilla ticket was never closed.

Then https://bugzilla.yoctoproject.org/show_bug.cgi?id=15940#c1 was interpreted as a request to downgrade it to a warning, but we should not be doing that: it means patchtest will not longer actually notify of the issue on the oe-core mailing list.

I understand some other layers intentionally put it after the scissors; if they're using patchtest, they can disable this particular test or configure it to produce some kind of soft fail, but in oe-core it should remain a hard fail.

Alex