diff options
author | Ricardo Martincoski <ricardo.martincoski@gmail.com> | 2017-02-19 19:17:17 -0300 |
---|---|---|
committer | Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | 2017-04-08 16:15:31 +0200 |
commit | 111132903d397551e384c101ea35720205415a58 (patch) | |
tree | 4ab65d7440e3fc7091d32c488230ec730a6d82b1 /support/scripts/checkpackagelib.py | |
parent | 6e432d5ecb46959f3c27dbbca48e41512bb40a70 (diff) | |
download | buildroot-111132903d397551e384c101ea35720205415a58.tar.gz buildroot-111132903d397551e384c101ea35720205415a58.zip |
support/scripts/check-package: new script
Create the infra to check the style of new packages before submitting.
The overall function of the script is described inside a txt file.
It is designed to process the actual files and NOT the patch files
generated by git format-patch.
Also add the first check function, to warn if a file (Config.*, *.mk,
*.hash, *.patch) has no newline at the last line of the file, see [1].
Basic usage for simple packages:
support/scripts/check-package -vvv package/newpackage/*
Basic usage for packages with subdirs:
support/scripts/check-package -vvv $(find package/newpackage/ -type f)
See "checkpackage" in [2].
[1] http://patchwork.ozlabs.org/patch/631129/
[2] http://elinux.org/Buildroot#Todo_list
Signed-off-by: Ricardo Martincoski <ricardo.martincoski@gmail.com>
Cc: Thomas De Schampheleire <patrickdepinguin@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'support/scripts/checkpackagelib.py')
-rw-r--r-- | support/scripts/checkpackagelib.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/support/scripts/checkpackagelib.py b/support/scripts/checkpackagelib.py new file mode 100644 index 0000000000..1a49041839 --- /dev/null +++ b/support/scripts/checkpackagelib.py @@ -0,0 +1,19 @@ +# See support/scripts/check-package.txt before editing this file. + +from checkpackagebase import _CheckFunction + + +class NewlineAtEof(_CheckFunction): + def before(self): + self.lastlineno = 0 + self.lastline = "\n" + + def check_line(self, lineno, text): + self.lastlineno = lineno + self.lastline = text + + def after(self): + if self.lastline == self.lastline.rstrip("\r\n"): + return ["{}:{}: missing newline at end of file" + .format(self.filename, self.lastlineno), + self.lastline] |