1 # See support/scripts/checkpackagelib/readme.txt before editing this file.
2 # The format of the patch files is tested during the build, so below check
3 # functions don't need to check for things already checked by running
4 # "make package-dirclean package-patch".
8 from base import _CheckFunction
9 # Notice: ignore 'imported but unused' from pyflakes for check functions.
10 from lib import NewlineAtEof
13 class ApplyOrder(_CheckFunction):
14 APPLY_ORDER = re.compile("/\d{1,4}-[^/]*$")
17 if not self.APPLY_ORDER.search(self.filename):
18 return ["{}:0: use name <number>-<description>.patch "
19 "({}#_providing_patches)"
20 .format(self.filename, self.url_to_manual)]
23 class NumberedSubject(_CheckFunction):
24 NUMBERED_PATCH = re.compile("Subject:\s*\[PATCH\s*\d+/\d+\]")
27 self.git_patch = False
31 def check_line(self, lineno, text):
32 if text.startswith("diff --git"):
35 if self.NUMBERED_PATCH.search(text):
40 if self.git_patch and self.text:
41 return ["{}:{}: generate your patches with 'git format-patch -N'"
42 .format(self.filename, self.lineno),
46 class Sob(_CheckFunction):
47 SOB_ENTRY = re.compile("^Signed-off-by: .*$")
52 def check_line(self, lineno, text):
55 if self.SOB_ENTRY.search(text):
60 return ["{}:0: missing Signed-off-by in the header "
61 "({}#_format_and_licensing_of_the_package_patches)"
62 .format(self.filename, self.url_to_manual)]