aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/lib/recipetool/create.py
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-03-09 17:48:54 +1300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-03-09 16:59:57 +0000
commit334b9451111b7e3efbb43b3a4eecebcab8ec6f0e (patch)
tree26cd514870612615bce363e755973bcf0a8883ac /scripts/lib/recipetool/create.py
parenta08d12ad867c292f7474731a0fe5e51e712446d6 (diff)
downloadopenembedded-core-contrib-334b9451111b7e3efbb43b3a4eecebcab8ec6f0e.tar.gz
recipetool: create: support creation of additional files by plugins
Allow plugins to create additional files to go alongside the recipe. The plugins don't know what the output filename is going to be, so they need to put the files in a temporary location and add them to an "extrafiles" dict within extravalues where the destination filename is the key and the temporary path is the value. devtool add was also extended to ensure these files get moved in and preserved upon reset if they've been edited by the user. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/recipetool/create.py')
-rw-r--r--scripts/lib/recipetool/create.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py
index 1d48e36462..1649e406e9 100644
--- a/scripts/lib/recipetool/create.py
+++ b/scripts/lib/recipetool/create.py
@@ -560,6 +560,8 @@ def create_recipe(args):
for handler in handlers:
handler.process(srctree_use, classes, lines_before, lines_after, handled, extravalues)
+ extrafiles = extravalues.pop('extrafiles', {})
+
if not realpv:
realpv = extravalues.get('PV', None)
if realpv:
@@ -601,6 +603,15 @@ def create_recipe(args):
logger.error('Output file %s already exists' % outfile)
sys.exit(1)
+ # Move any extra files the plugins created to a directory next to the recipe
+ if outfile == '-':
+ extraoutdir = pn
+ else:
+ extraoutdir = os.path.join(os.path.dirname(outfile), pn)
+ bb.utils.mkdirhier(extraoutdir)
+ for destfn, extrafile in extrafiles.iteritems():
+ shutil.move(extrafile, os.path.join(extraoutdir, destfn))
+
lines = lines_before
lines_before = []
skipblank = True