fso-autorev: drop libeflvala as it's in EFL repository now
[openembedded.git] / classes / checkbashisms.bbclass
blob1249c210dc2b92742e1950fe5859f81f801349eb
1 python do_checkbashisms () {
2     import re
3     import oe.process
4     import oe.path
6     def readline(path):
7         try:
8             return iter(open(path, "r")).next()
9         except StopIteration:
10             pass
12     shebang = re.compile("^#! */bin/sh$")
13     errors = False
14     srcdir = d.getVar("S", True)
15     for path in oe.path.find(srcdir):
16         line = readline(path)
17         if line and shebang.match(line):
18             try:
19                 output = oe_run(d, ["checkbashisms", path])
20             except oe.process.ExecutionError, exc:
21                 if not errors:
22                     errors = True
23                 bb.note(str(exc))
24             except oe.process.NotFoundError, exc:
25                 bb.fatal("checkbashisms not found, please install it in your PATH")
27     if errors:
28         bb.fatal("bashisms were identified, aborting")
30 addtask checkbashisms after do_patch
32 do_checkbashisms_all[recrdeptask] = "do_checkbashisms"
33 do_checkbashisms_all[nostamp] = "1"
34 addtask checkbashisms_all after do_checkbashisms