Bug 15026 - Unable to "devtool build <package>" in /build directory
Summary: Unable to "devtool build <package>" in /build directory
Status: IN PROGRESS REVIEW
Alias: None
Product: eSDK
Classification: Yocto Project Subprojects
Component: eSDK (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: Medium normal
Target Milestone: 5.99
Assignee: Unassigned
QA Contact: Francisco Pedraza
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2023-02-02 02:50 UTC by WeiHeng Cheng
Modified: 2025-02-14 16:48 UTC (History)
3 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: Don't know


Attachments
Patch for testing /build issue (1.67 KB, patch)
2023-02-18 01:40 UTC, Saul Wold
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description WeiHeng Cheng 2023-02-02 02:50:13 UTC
Overview: 
The "mv" command during devtool build <package> unable to execute as the directory is not empty if the eSDK is installed in /build directory. 

Steps to Reproduce: 
1) Install eSDK in any directory within /build (i.e., /build/username/yocto-esdk/nodistro_sdk)
2) Source the oe environment 
3) devtool modify <package> && devtool build <package> (i.e., python3-numpy)

Actual Results: 
Subprocess output:
mv: cannot move '/build/username/yocto-esdk/nodistro_sdk/tmp/work/riscv64-oe-linux/python3-numpy/1.22.3-r0/package/usr/src/debug/build/username/yocto-esdk/nodistro_sdk/workspace/sources/python3-numpy/build' to '/build/username/yocto-esdk/nodistro_sdk/tmp/work/riscv64-oe-linux/python3-numpy/1.22.3-r0/package/usr/src/debug/build': Directory not empty

Expected Results: 
The package should be built without any error. 

Additional Builds and Platforms: 
Using kirkstone branch for openembedded-core on Linux platform. 

Additional Information: 
The line below creates this error, which exists in openembedded-core/meta/classes/package.bbclass in kirkstone & langdale branch. This line is moved to openembedded-core/meta/lib/oe/package.py in master branch. 

cmd = "mv %s%s%s/* %s%s" % (dvar, debugsrcdir, sdir, dvar,debugsrcdir)
Comment 1 Randy MacLeod 2023-02-02 15:48:59 UTC
This is a bug but the obvious work-around is to use a different directory name.
Comment 2 WeiHeng Cheng 2023-02-03 02:17:21 UTC
(In reply to comment #1)
> This is a bug but the obvious work-around is to use a different directory
> name.

Yes, I'm aware of the workaround. However, there are systems that use /build directory. FYI, if the <package> uses a directory name same as any directory that exists in /build/username/yocto-esdk/nodistro_sdk/tmp/work/riscv64-oe-linux/<package>/<package-revision>/package/usr/src/debug/, the "devtool build <package>" will encounter the same error. 

Hence, I wonder if the line: 

cmd = "mv %s%s%s/* %s%s" % (dvar, debugsrcdir, sdir, dvar,debugsrcdir)

is replaced with:

cmd = "cp -r %s%s%s/* %s%s && rm -rf %s%s%s/*" % (dvar, debugsrcdir, sdir, dvar, debugsrcdir, dvar, debugsrcdir, sdir)

will it work without any implication? If this fix can work, I can submit a patch for this. Thanks!
Comment 3 Saul Wold 2023-02-15 00:40:46 UTC
So I tried to reproduce this using a /build/<username>/sdk

NOTE: python3-numpy: compiling from external source tree /build/swold/sdk/workspace/sources/python3-numpy

devtool modify / devool build worked correctly.

The workdir: /build/swold/sdk/tmp/work/core2-64-poky-linux/python3-numpy/1.24.1-r0

I am using the current master branch, it did not reproduce, I guess I need more details.
Comment 4 WeiHeng Cheng 2023-02-17 07:36:06 UTC
(In reply to comment #3)
> So I tried to reproduce this using a /build/<username>/sdk
> 
> NOTE: python3-numpy: compiling from external source tree
> /build/swold/sdk/workspace/sources/python3-numpy
> 
> devtool modify / devool build worked correctly.
> 
> The workdir:
> /build/swold/sdk/tmp/work/core2-64-poky-linux/python3-numpy/1.24.1-r0
> 
> I am using the current master branch, it did not reproduce, I guess I need
> more details.

Hi Saul, 

FYI previously I replicated the error using Kirkstone branch for openembedded-core. I tried to replicate the error using master branch for openembedded-core but end up with no error, as what you found out. 

So, I think you can replicate it if you use Kirkstone branch for openembedded-core. If possible, try to use bitbake version 2.0 and Kirkstone branch for all layers. 

Thanks!
Comment 5 Saul Wold 2023-02-18 01:34:59 UTC
Ok, I missed that it was kirkstone specific, you mentioned it was a line in multiple releases including master.

Please try testing that attached patch which I think helps with this specific case, yes it's a bit of a corner case due to the /build directory as Randy pointed out.

This moves the internal /usr/src/debug/build to /usr/src/debug/build.build and then does the other move.

I think you might have actually found an issue with master also, which I need to review more carefully.
Comment 6 Saul Wold 2023-02-18 01:40:31 UTC
Created attachment 4931 [details]
Patch for testing /build issue
Comment 7 Saul Wold 2023-02-19 01:30:50 UTC
Please test patch
Comment 8 WeiHeng Cheng 2023-02-19 06:11:08 UTC
(In reply to comment #5)
> Ok, I missed that it was kirkstone specific, you mentioned it was a line in
> multiple releases including master.
> 
> Please try testing that attached patch which I think helps with this
> specific case, yes it's a bit of a corner case due to the /build directory
> as Randy pointed out.
> 
> This moves the internal /usr/src/debug/build to /usr/src/debug/build.build
> and then does the other move.
> 
> I think you might have actually found an issue with master also, which I
> need to review more carefully.

Hi Saul,

The patch works fine, no issue with the "devtool build <package>" command. I also tested the image with edited recipe to make sure everything works fine, sorry for the delay. 

Regarding the issue with master that you've mentioned, do you mean that the "dvar + debugsrcdir + sdir" path is missing? 

Thanks!
Comment 9 Saul Wold 2023-02-21 02:04:17 UTC
Patch sent to list
Comment 10 Randy MacLeod 2023-10-30 15:37:32 UTC
Build move to 5.0 -- ../Randy
Comment 11 Randy MacLeod 2024-04-25 01:13:51 UTC
Bulk move of 5.0 medium importance issues to 5.99.
Move to 5.1 if you want to actively work on an issue.
Comment 12 Randy MacLeod 2024-04-25 01:23:13 UTC
Move to 5.99 since no one is actively working on this issue.
Move to 5.x if you start on a task, please.
Comment 13 Randy MacLeod 2025-02-14 16:46:23 UTC
bulk change to add Saul's non-WR address.
Comment 14 Randy MacLeod 2025-02-14 16:48:13 UTC
Bulk change: Remove Saul's old WR address.