diff options
| author | Paul Barker <paul@pbarker.dev> | 2025-09-24 20:57:47 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-10-01 10:52:54 +0100 |
| commit | 9f7c6b7a096d0e2b367e7fdda7902a430a5c8705 (patch) | |
| tree | c8f26e669c66394519854803f749cfa2b25a806e /meta/lib/patchtest | |
| parent | ad8e8fe79c3ab5d35a3f0159130f92947203e9eb (diff) | |
| download | poky-9f7c6b7a096d0e2b367e7fdda7902a430a5c8705.tar.gz | |
patchtest: Use raw strings for regex patterns
This fixes several 'SyntaxWarning: invalid escape sequence' messages
printed when running patchtest.
Cc: Trevor Gamblin <tgamblin@baylibre.com>
(From OE-Core rev: c585977a6b55db93b7f432280ae4251aa9bc6b6c)
Signed-off-by: Paul Barker <paul@pbarker.dev>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/patchtest')
| -rw-r--r-- | meta/lib/patchtest/patchtest_patterns.py | 20 | ||||
| -rw-r--r-- | meta/lib/patchtest/tests/test_mbox.py | 4 |
2 files changed, 12 insertions, 12 deletions
diff --git a/meta/lib/patchtest/patchtest_patterns.py b/meta/lib/patchtest/patchtest_patterns.py index 655ecfd049..1a8db92aa5 100644 --- a/meta/lib/patchtest/patchtest_patterns.py +++ b/meta/lib/patchtest/patchtest_patterns.py | |||
| @@ -33,7 +33,7 @@ closed = 'CLOSED' | |||
| 33 | lictag_re = pyparsing.AtLineStart("License-Update:") | 33 | lictag_re = pyparsing.AtLineStart("License-Update:") |
| 34 | lic_chksum_added = pyparsing.AtLineStart("+" + metadata_chksum) | 34 | lic_chksum_added = pyparsing.AtLineStart("+" + metadata_chksum) |
| 35 | lic_chksum_removed = pyparsing.AtLineStart("-" + metadata_chksum) | 35 | lic_chksum_removed = pyparsing.AtLineStart("-" + metadata_chksum) |
| 36 | add_mark = pyparsing.Regex('\\+ ') | 36 | add_mark = pyparsing.Regex(r'\+ ') |
| 37 | patch_max_line_length = 200 | 37 | patch_max_line_length = 200 |
| 38 | metadata_src_uri = "SRC_URI" | 38 | metadata_src_uri = "SRC_URI" |
| 39 | metadata_summary = "SUMMARY" | 39 | metadata_summary = "SUMMARY" |
| @@ -51,20 +51,20 @@ auh_email = 'auh@yoctoproject.org' | |||
| 51 | 51 | ||
| 52 | invalid_submitters = [pyparsing.Regex("^Upgrade Helper.+"), | 52 | invalid_submitters = [pyparsing.Regex("^Upgrade Helper.+"), |
| 53 | pyparsing.Regex(auh_email), | 53 | pyparsing.Regex(auh_email), |
| 54 | pyparsing.Regex("uh@not\.set"), | 54 | pyparsing.Regex(r"uh@not\.set"), |
| 55 | pyparsing.Regex("\S+@example\.com")] | 55 | pyparsing.Regex(r"\S+@example\.com")] |
| 56 | 56 | ||
| 57 | mbox_bugzilla = pyparsing.Regex('\[\s?YOCTO.*\]') | 57 | mbox_bugzilla = pyparsing.Regex(r'\[\s?YOCTO.*\]') |
| 58 | mbox_bugzilla_validation = pyparsing.Regex('\[(\s?YOCTO\s?#\s?(\d+)\s?,?)+\]') | 58 | mbox_bugzilla_validation = pyparsing.Regex(r'\[(\s?YOCTO\s?#\s?(\d+)\s?,?)+\]') |
| 59 | mbox_revert_shortlog_regex = pyparsing.Regex('Revert\s+".*"') | 59 | mbox_revert_shortlog_regex = pyparsing.Regex(r'Revert\s+".*"') |
| 60 | mbox_shortlog_maxlength = 90 | 60 | mbox_shortlog_maxlength = 90 |
| 61 | # based on https://stackoverflow.com/questions/30281026/regex-parsing-github-usernames-javascript | 61 | # based on https://stackoverflow.com/questions/30281026/regex-parsing-github-usernames-javascript |
| 62 | mbox_github_username = pyparsing.Regex('\B(?<!\${)@([a-z0-9](?:-(?=[a-z0-9])|[a-z0-9]){0,38}(?<=[a-z0-9]))') | 62 | mbox_github_username = pyparsing.Regex(r'\B(?<!\${)@([a-z0-9](?:-(?=[a-z0-9])|[a-z0-9]){0,38}(?<=[a-z0-9]))') |
| 63 | 63 | ||
| 64 | # patch | 64 | # patch |
| 65 | 65 | ||
| 66 | cve = pyparsing.Regex("CVE\-\d{4}\-\d+") | 66 | cve = pyparsing.Regex(r"CVE\-\d{4}\-\d+") |
| 67 | cve_payload_tag = pyparsing.Regex("\+CVE:(\s+CVE\-\d{4}\-\d+)+") | 67 | cve_payload_tag = pyparsing.Regex(r"\+CVE:(\s+CVE\-\d{4}\-\d+)+") |
| 68 | upstream_status_regex = pyparsing.AtLineStart("+" + "Upstream-Status") | 68 | upstream_status_regex = pyparsing.AtLineStart("+" + "Upstream-Status") |
| 69 | 69 | ||
| 70 | # shortlog | 70 | # shortlog |
| @@ -78,7 +78,7 @@ shortlog = line_start + shortlog_target + colon + shortlog_summary + line_end | |||
| 78 | email_pattern = pyparsing.Regex(r"(?P<user>[A-Za-z0-9._%+-]+)@(?P<hostname>[A-Za-z0-9.-]+)\.(?P<domain>[A-Za-z]{2,})") | 78 | email_pattern = pyparsing.Regex(r"(?P<user>[A-Za-z0-9._%+-]+)@(?P<hostname>[A-Za-z0-9.-]+)\.(?P<domain>[A-Za-z]{2,})") |
| 79 | 79 | ||
| 80 | signed_off_by_prefix = pyparsing.Literal("Signed-off-by:") | 80 | signed_off_by_prefix = pyparsing.Literal("Signed-off-by:") |
| 81 | signed_off_by_name = pyparsing.Regex('\S+.*(?= <)') | 81 | signed_off_by_name = pyparsing.Regex(r'\S+.*(?= <)') |
| 82 | signed_off_by_email = lessthan + email_pattern + greaterthan | 82 | signed_off_by_email = lessthan + email_pattern + greaterthan |
| 83 | signed_off_by = pyparsing.AtLineStart(signed_off_by_prefix + signed_off_by_name + signed_off_by_email) | 83 | signed_off_by = pyparsing.AtLineStart(signed_off_by_prefix + signed_off_by_name + signed_off_by_email) |
| 84 | patch_signed_off_by = pyparsing.AtLineStart("+" + signed_off_by_prefix + signed_off_by_name + signed_off_by_email) | 84 | patch_signed_off_by = pyparsing.AtLineStart("+" + signed_off_by_prefix + signed_off_by_name + signed_off_by_email) |
diff --git a/meta/lib/patchtest/tests/test_mbox.py b/meta/lib/patchtest/tests/test_mbox.py index 714c9b30af..5cf02af7bd 100644 --- a/meta/lib/patchtest/tests/test_mbox.py +++ b/meta/lib/patchtest/tests/test_mbox.py | |||
| @@ -71,7 +71,7 @@ class TestMbox(base.Base): | |||
| 71 | def test_shortlog_length(self): | 71 | def test_shortlog_length(self): |
| 72 | for commit in self.commits: | 72 | for commit in self.commits: |
| 73 | # no reason to re-check on revert shortlogs | 73 | # no reason to re-check on revert shortlogs |
| 74 | shortlog = re.sub('^(\[.*?\])+ ', '', commit.shortlog) | 74 | shortlog = re.sub(r'^(\[.*?\])+ ', '', commit.shortlog) |
| 75 | if shortlog.startswith('Revert "'): | 75 | if shortlog.startswith('Revert "'): |
| 76 | continue | 76 | continue |
| 77 | l = len(shortlog) | 77 | l = len(shortlog) |
| @@ -109,7 +109,7 @@ class TestMbox(base.Base): | |||
| 109 | 109 | ||
| 110 | # a meta project may be indicted in the message subject, if this is the case, just fail | 110 | # a meta project may be indicted in the message subject, if this is the case, just fail |
| 111 | # TODO: there may be other project with no-meta prefix, we also need to detect these | 111 | # TODO: there may be other project with no-meta prefix, we also need to detect these |
| 112 | project_regex = pyparsing.Regex("\[(?P<project>meta-.+)\]") | 112 | project_regex = pyparsing.Regex(r"\[(?P<project>meta-.+)\]") |
| 113 | for commit in self.commits: | 113 | for commit in self.commits: |
| 114 | match = project_regex.search_string(commit.subject) | 114 | match = project_regex.search_string(commit.subject) |
| 115 | if match: | 115 | if match: |
