utils/checkpackagelib: check for Upstream trailers
Implement a check-package check for an Upstream: trailer in patches being applied to packages per a mailing list discussion [0]. No strict formatting checks are implemented for the contents within the trailer as the needed level of detail will vary patch-to-patch. Tested with: `./utils/docker-run python3 -m pytest utils/checkpackagelib` [0] https://lists.buildroot.org/pipermail/buildroot/2023-March/666016.html Signed-off-by: Vincent Fazio <vfazio@gmail.com> Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
This commit is contained in:
parent
5b00b40a05
commit
32934b526b
@ -61,3 +61,21 @@ class Sob(_CheckFunction):
|
|||||||
return ["{}:0: missing Signed-off-by in the header "
|
return ["{}:0: missing Signed-off-by in the header "
|
||||||
"({}#_format_and_licensing_of_the_package_patches)"
|
"({}#_format_and_licensing_of_the_package_patches)"
|
||||||
.format(self.filename, self.url_to_manual)]
|
.format(self.filename, self.url_to_manual)]
|
||||||
|
|
||||||
|
class Upstream(_CheckFunction):
|
||||||
|
UPSTREAM_ENTRY = re.compile(r"^Upstream: .*$")
|
||||||
|
|
||||||
|
def before(self):
|
||||||
|
self.found = False
|
||||||
|
|
||||||
|
def check_line(self, lineno, text):
|
||||||
|
if self.found:
|
||||||
|
return
|
||||||
|
if self.UPSTREAM_ENTRY.search(text):
|
||||||
|
self.found = True
|
||||||
|
|
||||||
|
def after(self):
|
||||||
|
if not self.found:
|
||||||
|
return ["{}:0: missing Upstream in the header "
|
||||||
|
"({}#_additional_patch_documentation)"
|
||||||
|
.format(self.filename, self.url_to_manual)]
|
||||||
|
@ -94,3 +94,25 @@ Sob = [
|
|||||||
def test_Sob(testname, filename, string, expected):
|
def test_Sob(testname, filename, string, expected):
|
||||||
warnings = util.check_file(m.Sob, filename, string)
|
warnings = util.check_file(m.Sob, filename, string)
|
||||||
assert warnings == expected
|
assert warnings == expected
|
||||||
|
|
||||||
|
|
||||||
|
Upstream = [
|
||||||
|
('good',
|
||||||
|
'patch',
|
||||||
|
'Upstream: https://some/amazing/patch/submission\n',
|
||||||
|
[]),
|
||||||
|
('empty',
|
||||||
|
'patch',
|
||||||
|
'',
|
||||||
|
[['patch:0: missing Upstream in the header (url#_additional_patch_documentation)']]),
|
||||||
|
('bad',
|
||||||
|
'patch',
|
||||||
|
'Subject: [PATCH 24/105] text\n',
|
||||||
|
[['patch:0: missing Upstream in the header (url#_additional_patch_documentation)']]),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize('testname,filename,string,expected', Upstream)
|
||||||
|
def test_Upstream(testname, filename, string, expected):
|
||||||
|
warnings = util.check_file(m.Upstream, filename, string)
|
||||||
|
assert warnings == expected
|
||||||
|
Loading…
Reference in New Issue
Block a user