Bug 11387 - devtool edit-recipe fails within crops/extsdk-container
Summary: devtool edit-recipe fails within crops/extsdk-container
Status: RESOLVED FIXED
Alias: None
Product: CROPS
Classification: Yocto Project Subprojects
Component: crops-default (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: Medium+ normal
Target Milestone: 2.4 M3
Assignee: brian avery
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2017-04-19 20:24 UTC by Brian Kurle
Modified: 2017-08-29 20:56 UTC (History)
3 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: Yes (doc changes required)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Brian Kurle 2017-04-19 20:24:06 UTC
Preconditions/Environment
-------------------------
 $ docker pull crops/extsdk-container
Using default tag: latest
latest: Pulling from crops/extsdk-container
Digest: sha256:a015a1d601371a9b58b3248c3a288e63116d56387d7003555ad671d1ac9e8056
Status: Image is up to date for crops/extsdk-container:latest

Triggering Action/Cause
-----------------------
devtool edit-recipe <any valid recipe>

Expectation
-----------
vi, (nor any other editor discovered) appears not to be installed within crops/extsdk-container.   Thus, devtool fails when attempting to execute subcommand edit-recipe

Expected vi or some preconfigured editor to be available when executing devtool subcommands that require an editor.

Actual Result
-------------
SDK environment now set up; additionally you may now run devtool to perform development tasks.
Run devtool --help for further details.
sdkuser@43c20f0c6d57:/workdir$ devtool edit-recipe mbedtls
/bin/sh: 1: vi: not found
Traceback (most recent call last):
  File "/workdir/sysroots/x86_64-pokysdk-linux/usr/bin/devtool", line 344, in <module>
    ret = main()
  File "/workdir/sysroots/x86_64-pokysdk-linux/usr/bin/devtool", line 331, in main
    ret = args.func(args, config, basepath, workspace)
  File "/workdir/layers/poky/scripts/lib/devtool/utilcmds.py", line 52, in edit_recipe
    return scriptutils.run_editor(recipefile)
  File "/workdir/layers/poky/scripts/lib/scriptutils.py", line 115, in run_editor
    return subprocess.check_call('%s %s' % (editor, params), shell=True)
  File "/workdir/buildtools/sysroots/x86_64-pokysdk-linux/usr/lib/python3.5/subprocess.py", line 581, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'vi "/workdir/workspace/recipes/mbedtls/mbedtls_git.bb"' returned non-zero exit status 127

Reproducibility
---------------
100%

Where:
n = total number of attempts
m = number of times the phenomenon is visible
Comment 1 Brian Kurle 2017-04-20 01:04:23 UTC
In conversation with Randy Witt, it was suggested that this be moved to documentation on the wiki of HOWTO augment the containers with the user preferred editor.  Need to know where to submit documentation (and which wiki)
Comment 2 brian avery 2017-04-20 14:59:08 UTC
adding paul.

Question how about changing "devtool edit-recipe" to "devtool find-recipe" then we would just get a path to the recipe so people can do what they want with it.  Admittedly, we would still have the problem with the inside and outside the container path being different, but if you understand the mapping it's still helpful. maybe add a --rel option so you get a relative path which might make the mapping easier if your host side editor has CWD=workdir...
Comment 3 Brian Kurle 2017-04-20 17:47:39 UTC
I would be all for devtool providing and handling relative pathing as I have been bitten with devtool runqemu as a similar issue.   It appears that the crops/extsdk-container is useful for building, but not for a general developer interactive environment.  

edit-recipe, runqemu, (et al.) fail (more spectacularly so when you try to execute the latter outside the container and the workspace is now hardcoded to /workdir).
Comment 4 brian avery 2017-04-20 19:55:40 UTC
some patches that went into 2.3 (this week) for https://bugzilla.yoctoproject.org/show_bug.cgi?id=11375 make the qemu and testimage stuff relative. That should help.
Comment 5 Paul Eggleton 2017-04-20 20:31:06 UTC
I'd rather not remove edit-recipe since it's useful outside of the container, however we can add find-recipe or something similar that just gives you the path. We can also make edit-recipe's behaviour less ugly when the EDITOR specified doesn't exist.
Comment 6 Brian Kurle 2017-04-20 23:25:14 UTC
Is the relative patch going to make it to morty?
Comment 7 brian avery 2017-07-30 13:30:53 UTC
Moving to M3
Comment 8 brian avery 2017-08-29 20:56:24 UTC
The devtool find-recipe patch is in master. It will not be backported, as features generally don't make it into dot releases. Will add a pointer in the docs to a wiki page where features like this can be better documented.