[oe-commits] [openembedded-core] 40/41: recipetool: create: support creation of additional files by plugins

git at git.openembedded.org git at git.openembedded.org
Wed Mar 9 16:59:24 UTC 2016


rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit b277218cb455d08d52af71097fbeceac15f2eb7a
Author: Paul Eggleton <paul.eggleton at linux.intel.com>
AuthorDate: Wed Mar 9 17:48:54 2016 +1300

    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 at linux.intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 scripts/lib/devtool/standard.py  |  6 +++++-
 scripts/lib/recipetool/create.py | 11 +++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index 5f83a91..b344001 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -189,6 +189,9 @@ def add(args, config, basepath, workspace):
                     raise DevtoolError('Couldn\'t find source tree created by recipetool')
             bb.utils.mkdirhier(recipedir)
             shutil.move(recipes[0], recipefile)
+            # Move any additional files created by recipetool
+            for fn in os.listdir(tempdir):
+                shutil.move(os.path.join(tempdir, fn), recipedir)
         else:
             raise DevtoolError('Command \'%s\' did not create any recipe file:\n%s' % (e.command, e.stdout))
         attic_recipe = os.path.join(config.workspace_path, 'attic', recipename, os.path.basename(recipefile))
@@ -199,7 +202,8 @@ def add(args, config, basepath, workspace):
             shutil.rmtree(tmpsrcdir)
         shutil.rmtree(tempdir)
 
-    _add_md5(config, recipename, recipefile)
+    for fn in os.listdir(recipedir):
+        _add_md5(config, recipename, os.path.join(recipedir, fn))
 
     if args.fetch and not args.no_git:
         setup_git_repo(srctree, args.version, 'devtool')
diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py
index 1d48e36..1649e40 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

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list