[gnome-continuous-yocto/gnomeostree-3.28-rocko: 1414/8267] devtool: update-recipe: find and use existing files directories



commit 8be2077a38a0af3dc2b3ccd5e813e5bde840b8f0
Author: Paul Eggleton <paul eggleton linux intel com>
Date:   Thu Jul 14 09:04:19 2016 +1200

    devtool: update-recipe: find and use existing files directories
    
    devtool update-recipe was defaulting to the ${BPN} named directory when
    adding patches next to a recipe, but that meant if you already had files
    in a ${BP} named directory (i.e. name and version) or "files" then you'd
    end up with two directories next to the recipe, which is usually not
    what you want. To avoid this, look through FILESPATH and take the first
    one that's the same level or one level down from the recipe and already
    exists, if any.
    
    (From OE-Core rev: c7a8190cf8bdf86ba850b6780b8e951e90232c06)
    
    Signed-off-by: Paul Eggleton <paul eggleton linux intel com>
    Signed-off-by: Ross Burton <ross burton intel com>
    Signed-off-by: Richard Purdie <richard purdie linuxfoundation org>

 scripts/lib/devtool/standard.py |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index f2ba699..1ec31bc 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -1039,6 +1039,18 @@ def _export_local_files(srctree, rd, destdir):
     return (updated, added, removed)
 
 
+def _determine_files_dir(rd):
+    """Determine the appropriate files directory for a recipe"""
+    recipedir = rd.getVar('FILE_DIRNAME', True)
+    for entry in rd.getVar('FILESPATH', True).split(':'):
+        relpth = os.path.relpath(entry, recipedir)
+        if not os.sep in relpth:
+            # One (or zero) levels below only, so we don't put anything in machine-specific directories
+            if os.path.isdir(entry):
+                return entry
+    return os.path.join(recipedir, rd.getVar('BPN', True))
+
+
 def _update_recipe_srcrev(args, srctree, rd, config_data):
     """Implement the 'srcrev' mode of update-recipe"""
     import bb
@@ -1092,8 +1104,7 @@ def _update_recipe_srcrev(args, srctree, rd, config_data):
                     rd, args.append, files, wildcardver=args.wildcard_version,
                     extralines=patchfields, removevalues=removevalues)
         else:
-            files_dir = os.path.join(os.path.dirname(recipefile),
-                                     rd.getVar('BPN', True))
+            files_dir = _determine_files_dir(rd)
             for basepath, path in upd_f.items():
                 logger.info('Updating file %s' % basepath)
                 _move_file(os.path.join(local_files_dir, basepath), path)
@@ -1193,8 +1204,7 @@ def _update_recipe_patch(args, config, workspace, srctree, rd, config_data):
                 _move_file(patchfn, path)
                 updatefiles = True
             # Add any new files
-            files_dir = os.path.join(os.path.dirname(recipefile),
-                                     rd.getVar('BPN', True))
+            files_dir = _determine_files_dir(rd)
             for basepath, path in new_f.items():
                 logger.info('Adding new file %s' % basepath)
                 _move_file(os.path.join(local_files_dir, basepath),


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]