Skip to contentSkip to conversation

devtool: modify command fails to ignore source files

PATCH Superseded Stephano Cetola 2 participants 3 messages Oct 2, 2016

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 devtool: modify command fails to ignore source files

With recent changes to recipeutils, the list of local files returned by get_recipe_local_files could possibly include source files. This only happens when the recipe contains a SRC_URI using subdir= to put files in the source tree. These files should be ignored when populating the list of local files for oe-local-files directory.

---
 scripts/lib/devtool/standard.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
scripts/lib/devtool/standard.py +5 -1
index 8319145..c7a5712 100644
@@ -568,8 +568,12 @@ def _extract_source(srctree, keep_temp, devbranch, sync, d):
         recipe_patches = [os.path.basename(patch) for patch in
                           oe.recipeutils.get_recipe_patches(crd)]
         local_files = oe.recipeutils.get_recipe_local_files(crd)
+
+        # Ignore local files with subdir={BP}
+        srcdirname = os.path.basename(os.path.normpath(srcsubdir))
         local_files = [fname for fname in local_files if
-                       os.path.exists(os.path.join(workdir, fname))]
+                       os.path.exists(os.path.join(workdir, fname)) and
+                       srcdirname not in fname]
         if local_files:
             for fname in local_files:
                 _move_file(os.path.join(workdir, fname),
Signature · 1 line
2.10.0
#1 lore raw

Hi Stephano,

Thanks for looking into this, a few things:

Quoted 5 lines · On Sun, 02 Oct 2016 13:55:06 Stephano Cetola wrote:

With recent changes to recipeutils, the list of local files returned by get_recipe_local_files could possibly include source files. This only happens when the recipe contains a SRC_URI using subdir= to put files in the source tree. These files should be ignored when populating the list of local files for oe-local-files directory.

You should include "Fixes [YOCTO #10326]." here. Also, if a patch fixes a regression that we've been able to track down, as part of the commit message I like to mention which revision caused it, and in this case it would be OE-Core revision 9069fef5dad5a873c8a8f720f7bcbc7625556309.

Quoted 13 lines
---
 scripts/lib/devtool/standard.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/scripts/lib/devtool/standard.py index 8319145..c7a5712 100644

scripts/lib/devtool/standard.py +0 -0
@@ -568,8 +568,12 @@ def _extract_source(srctree, keep_temp, devbranch,

sync, d): recipe_patches = [os.path.basename(patch) for patch in
oe.recipeutils.get_recipe_patches(crd)]
local_files = oe.recipeutils.get_recipe_local_files(crd)

scripts/lib/devtool/standard.py def _extract_source(srctree, keep_temp, devbranch, sync, d): · line 576

Quoted 7 lines
scripts/lib/devtool/standard.py +5 -1
+
+        # Ignore local files with subdir={BP}
+        srcdirname = os.path.basename(os.path.normpath(srcsubdir))
         local_files = [fname for fname in local_files if
-                       os.path.exists(os.path.join(workdir, fname))]
+                       os.path.exists(os.path.join(workdir, fname)) and
+                       srcdirname not in fname]

This seems likely to false-trigger quite easily - you're only looking for the basename and whether it appears anywhere in the path rather than at the start. I'd suggest getting the absolute path to the source directory and check if it starts with that (I think that's how I dealt with that elsewhere).

Cheers,
Paul

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre
#2 lore raw
Quoted 11 lines · Paul Eggleton

Hi Stephano,

Thanks for looking into this, a few things:

Quoted 5 lines · On Sun, 02 Oct 2016 13:55:06 Stephano Cetola wrote:

With recent changes to recipeutils, the list of local files returned by get_recipe_local_files could possibly include source files. This only happens when the recipe contains a SRC_URI using subdir= to put files in the source tree. These files should be ignored when populating the list of local files for oe-local-files directory.

Quoted 4 lines

You should include "Fixes [YOCTO #10326]." here. Also, if a patch fixes a regression that we've been able to track down, as part of the commit message I like to mention which revision caused it, and in this case it would be OE-Core revision 9069fef5dad5a873c8a8f720f7bcbc7625556309.

Ops,thanks for catching that. Also, thanks for the notes on regressions.

Quoted 18 lines
Quoted 18 lines
---
 scripts/lib/devtool/standard.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/scripts/lib/devtool/standard.py index 8319145..c7a5712 100644

scripts/lib/devtool/standard.py +0 -0
@@ -568,8 +568,12 @@ def _extract_source(srctree, keep_temp, devbranch,

sync, d): recipe_patches = [os.path.basename(patch) for patch in
oe.recipeutils.get_recipe_patches(crd)]
local_files = oe.recipeutils.get_recipe_local_files(crd)

scripts/lib/devtool/standard.py +3 -0
+
+        # Ignore local files with subdir={BP}
+        srcdirname = os.path.basename(os.path.normpath(srcsubdir))
         local_files = [fname for fname in local_files if
Quoted 8 lines

scripts/lib/devtool/standard.py def _extract_source(srctree, keep_temp, devbranch, sync, d): · line 576

Quoted 3 lines
scripts/lib/devtool/standard.py +2 -1
-                       os.path.exists(os.path.join(workdir, fname))]
+                       os.path.exists(os.path.join(workdir, fname)) and
+                       srcdirname not in fname]

This seems likely to false-trigger quite easily - you're only looking for the basename and whether it appears anywhere in the path rather than at the start. I'd suggest getting the absolute path to the source directory and check if it starts with that (I think that's how I dealt with that elsewhere).

Ah okay, I think I see what you're saying. I'll fix this and resubmit.

Quoted 8 lines

Cheers,
Paul

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre