summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2015-09-22 17:21:28 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-09-23 09:53:16 +0100
commita35ad723ce9ef75f8a7d66c05179fe0eb0e50f73 (patch)
tree8c1f8cbc409a06033d478e99650397399bdd55de /scripts
parent30c7e7ac41ba201d41613d1482abeebdbd05ae46 (diff)
downloadpoky-a35ad723ce9ef75f8a7d66c05179fe0eb0e50f73.tar.gz
recipetool: create: fix creating empty shell functions
The shell considers empty functions to be a syntax error, so for template shell functions that contain only comments (or no lines at all) then add a : to act as a no-op which avoids the syntax error. (From OE-Core rev: ff14d9e5b935b99b2efde479515e54c02ba58f6e) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/recipetool/create.py22
1 files changed, 19 insertions, 3 deletions
diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py
index c4754dbcdd..99d9cc850e 100644
--- a/scripts/lib/recipetool/create.py
+++ b/scripts/lib/recipetool/create.py
@@ -46,10 +46,26 @@ class RecipeHandler():
46 results.extend(glob.glob(os.path.join(path, spec))) 46 results.extend(glob.glob(os.path.join(path, spec)))
47 return results 47 return results
48 48
49 def genfunction(self, outlines, funcname, content): 49 def genfunction(self, outlines, funcname, content, python=False, forcespace=False):
50 outlines.append('%s () {' % funcname) 50 if python:
51 prefix = 'python '
52 else:
53 prefix = ''
54 outlines.append('%s%s () {' % (prefix, funcname))
55 if python or forcespace:
56 indent = ' '
57 else:
58 indent = '\t'
59 addnoop = not python
51 for line in content: 60 for line in content:
52 outlines.append('\t%s' % line) 61 outlines.append('%s%s' % (indent, line))
62 if addnoop:
63 strippedline = line.lstrip()
64 if strippedline and not strippedline.startswith('#'):
65 addnoop = False
66 if addnoop:
67 # Without this there'll be a syntax error
68 outlines.append('%s:' % indent)
53 outlines.append('}') 69 outlines.append('}')
54 outlines.append('') 70 outlines.append('')
55 71