diff mbox series

[v2] checklayer: check for patch file upstream status

Message ID 20230224040056.2677539-1-chee.yang.lee@intel.com
State Accepted, archived
Commit 237c1b66e5014123c1e5c3e78f9ab0357bcd62dc
Headers show
Series [v2] checklayer: check for patch file upstream status | expand

Commit Message

Lee, Chee Yang Feb. 24, 2023, 4 a.m. UTC
From: Chee Yang Lee <chee.yang.lee@intel.com>

yocto-check-layer to check all .patch file in layer for
Upstream-status and list down all .patch file without Upstream-Status.

set this test as expected failure for now, so this wont fail the check
layer while still able to capture any patches with malformed or missing
Upstream-Status in report.

[YOCTO #14642]

Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
---
v2:
amended commit message
switch to oe.qa.check_upstream_status to verify upstream status

 scripts/lib/checklayer/cases/common.py | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
diff mbox series

Patch

diff --git a/scripts/lib/checklayer/cases/common.py b/scripts/lib/checklayer/cases/common.py
index 722d3cf638..97b16f78c8 100644
--- a/scripts/lib/checklayer/cases/common.py
+++ b/scripts/lib/checklayer/cases/common.py
@@ -72,6 +72,21 @@  class CommonCheckLayer(OECheckLayerTestCase):
                 self.tc.layer['name'])
             self.fail('\n'.join(msg))
 
+    @unittest.expectedFailure
+    def test_patches_upstream_status(self):
+        import sys
+        sys.path.append(os.path.join(sys.path[0], '../../../../meta/lib/'))
+        import oe.qa
+        patches = []
+        for dirpath, dirs, files in os.walk(self.tc.layer['path']):
+            for filename in files:
+                if filename.endswith(".patch"):
+                    ppath = os.path.join(dirpath, filename)
+                    if oe.qa.check_upstream_status(ppath):
+                        patches.append(ppath)
+        self.assertEqual(len(patches), 0 , \
+                msg="Found following patches with malformed or missing upstream status:\n%s" % '\n'.join([str(patch) for patch in patches]))
+
     def test_signatures(self):
         if self.tc.layer['type'] == LayerType.SOFTWARE and \
            not self.tc.test_software_layer_signatures: