It is possible to have a parameter for patches in series
files like e.g. "-p0". This case will not work when parsing
the patches when generating the sbom, since the whole
string is taken to check in the path.exists check.

If the patch has parameters we skip those and only check for
the file which is always set first.

Signed-off-by: Michael Grzeschik <[email protected]>
---
 scripts/report/sbom.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/scripts/report/sbom.py b/scripts/report/sbom.py
index 17acbe5e8..576197ce0 100644
--- a/scripts/report/sbom.py
+++ b/scripts/report/sbom.py
@@ -88,6 +88,8 @@ class SbomGenerator(Generator):
                     tag = m.group(1)
                 if line.startswith('#'):
                     continue
+                if len(line.split()) > 1:
+                    line = line.split()[0]
                 patch = path.join(patch_dir, line.rstrip())
                 if not path.exists(patch):
                     raise ReportException(
-- 
2.47.3


Reply via email to