diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2016-03-09 17:48:54 +1300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-03-09 17:00:29 +0000 |
commit | 309b2e6c571248a3b77c432ed96dfb976cb840bc (patch) | |
tree | 394e94cd0e8c02d5ce0709148df88ff3d4c9adc7 /scripts/lib/recipetool | |
parent | 2279eb2a4cb82dc7033fcca97ecbed3ae09de902 (diff) | |
download | poky-309b2e6c571248a3b77c432ed96dfb976cb840bc.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.
(From OE-Core rev: 334b9451111b7e3efbb43b3a4eecebcab8ec6f0e)
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')
-rw-r--r-- | scripts/lib/recipetool/create.py | 11 |
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): | |||
560 | for handler in handlers: | 560 | for handler in handlers: |
561 | handler.process(srctree_use, classes, lines_before, lines_after, handled, extravalues) | 561 | handler.process(srctree_use, classes, lines_before, lines_after, handled, extravalues) |
562 | 562 | ||
563 | extrafiles = extravalues.pop('extrafiles', {}) | ||
564 | |||
563 | if not realpv: | 565 | if not realpv: |
564 | realpv = extravalues.get('PV', None) | 566 | realpv = extravalues.get('PV', None) |
565 | if realpv: | 567 | if realpv: |
@@ -601,6 +603,15 @@ def create_recipe(args): | |||
601 | logger.error('Output file %s already exists' % outfile) | 603 | logger.error('Output file %s already exists' % outfile) |
602 | sys.exit(1) | 604 | sys.exit(1) |
603 | 605 | ||
606 | # Move any extra files the plugins created to a directory next to the recipe | ||
607 | if outfile == '-': | ||
608 | extraoutdir = pn | ||
609 | else: | ||
610 | extraoutdir = os.path.join(os.path.dirname(outfile), pn) | ||
611 | bb.utils.mkdirhier(extraoutdir) | ||
612 | for destfn, extrafile in extrafiles.iteritems(): | ||
613 | shutil.move(extrafile, os.path.join(extraoutdir, destfn)) | ||
614 | |||
604 | lines = lines_before | 615 | lines = lines_before |
605 | lines_before = [] | 616 | lines_before = [] |
606 | skipblank = True | 617 | skipblank = True |