Bug 7587

Summary: devtool: add ability to turn changes into a bbappend
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Paul Eggleton <bluelightning>
Component: devtools / tool chainAssignee: Paul Eggleton <bluelightning>
Status: VERIFIED FIXED QA Contact: Costin <costin.c.constantin>
Severity: enhancement    
Priority: High CC: alexandru.c.georgescu, meta.mr.watcher, meta.watcher
Version: 1.8   
Target Milestone: 1.9 M1   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Yes (doc changes required)
Bug Depends on: 7648    
Bug Blocks:    

Description Paul Eggleton 2015-04-09 13:24:32 UTC
Some changes people will want to apply as part of a devtool workflow will be customisations that would be best placed in their own layer and thus need to be applied as a bbappend. Right now, devtool update-recipe will update the original recipe, it doesn't really work with bbappends. So we need to do two things:

1) Ensure that when you update a commit that came from a patch applied by a bbappend in a separate layer, and then run devtool update-recipe, that by default the patch is correctly updated in the other layer. (I strongly suspect this doesn't work at the moment.)

2) Add the ability to update-recipe to redirect a change to another layer such that a bbappend gets created/updated as needed and the patch is written to the right place.
Comment 1 Paul Eggleton 2015-06-18 14:03:19 UTC
The implementation for #2 was merged to master a couple of weeks ago:

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=7539c1f8892e5f7467e3fe8cf8cf7a5a23033e4d

Documentation updates for the dev manual are still TBD - I've emailed Scott the details.
Comment 2 Paul Eggleton 2015-06-18 17:11:30 UTC
I've just tested and #1 does in fact work, at least in master.
Comment 3 Paul Eggleton 2015-07-08 13:35:00 UTC
Scott has made the appropriate documentation changes, I'm now marking this as resolved.
Comment 4 Costin 2015-10-20 14:06:48 UTC
Hello,

I tried both for a recipe with git and without in SRC_URI.

tested on master: 8578bc17b54da97d42b257b3c8f398ac52b91a9f on an Ubuntu 15.04 OS 

Steps performed, are inspired from Paul's comment#1 test cases. Recipes used are the same as those in the test cases; for non git recipe ---> mdadm and for git recipe ---> mtd-utils.

Steps i followed:
1) have a clean build env. (source oe-init-build-env 1build)
2) create a temporary directory 
user@ubnt:/tmp/devtoolqaCz6ZwS$ ls
layer  source  source1
 
BBPATH .= ":${LAYERDIR}"
BBFILES += "${LAYERDIR}/recipe*/*.bb \
            ${LAYERDIR}/recipe*/*.bbappend"
user@ubnt:vi layer/conf/layer.conf
BBFILE_COLLECTIONS += "selftestupdaterecipe"
BBFILE_PATTERN_selftestupdaterecipe = "^${LAYERDIR}/"
BBFILE_PRIORITY_selftestupdaterecipe = "999"
BBFILE_PATTERN_IGNORE_EMPTY_selftestupdaterecipe = "1"

3) get source code for the recipes:
user@ubnt:/media/yp_builds/2poky/1build$ devtool modify mtd-utils -x /tmp/devtoolqaCz6ZwS/source1  # for the mtd-utils
and
user@ubnt:/media/yp_builds/2poky/1build$ devtool modify mdadm -x /tmp/devtoolqaCz6ZwS/source # for mdadm

and check source code is under the /tmp/devtoolqaCz6ZwS/source and /tmp/devtoolqaCz6ZwS/source1 respectively

4) do some changes to the source code and commit them:
git commit -a -m "Added a new line" # for mdadm
 
git commit -a -m "Change the Makefile" # for mtd-utils

5) update the recipes:
user@ubnt:/media/yp_builds/2poky/1build$ devtool update-recipe mtd-utils -a /tmp/devtoolqaCz6ZwS/layer 
and 
user@ubnt:/media/yp_builds/2poky/1build$ devtool update-recipe mdadm -a /tmp/devtoolqaCz6ZwS/layer

6) observe results:
user@ubnt:/tmp/devtoolqaCz6ZwS/layer/recipes-extended/mdadm$ cat mdadm_3.3.4.bbappend 
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"

SRC_URI += "file://0001-Added-a-new-line.patch"

and

user@ubnt:/tmp/devtoolqaCz6ZwS/layer/recipes-devtools/mtd$ cat mtd-utils_git.bbappend 
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"

SRC_URI += "file://0001-Change-the-Makefile.patch"

Marking as verified