devtool: add upgrade feature

Upgrades a recipe to a particular version and downloads the source code
into a folder. User can avoid patching the source code.

These are the general steps of the upgrade function:

   - Extract current recipe source code into srctree and create a branch
   - Extract upgrade recipe source code into srctree and rebase with
     previous branch. In case the rebase is not correctly applied, source
     code will not be deleted, so user correct the patches
   - Creates the new recipe under the workspace

[YOCTO #7642]

(From OE-Core rev: 4020f5d91b3e4d011150d5081d36215f8eab732e)

Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Leonardo Sandoval
2015-09-08 11:39:09 +01:00
committed by Richard Purdie
parent 7cde0ebd59
commit 8be95c5fbe
7 changed files with 445 additions and 1 deletions

View File

@@ -178,6 +178,8 @@ def extract(args, config, basepath, workspace):
srctree = os.path.abspath(args.srctree)
initial_rev = _extract_source(srctree, args.keep_temp, args.branch, rd)
logger.info('Source tree extracted to %s' % srctree)
if initial_rev:
return 0
else:
@@ -351,7 +353,6 @@ def _extract_source(srctree, keep_temp, devbranch, d):
bb.process.run('git checkout patches', cwd=srcsubdir)
shutil.move(srcsubdir, srctree)
logger.info('Source tree extracted to %s' % srctree)
finally:
bb.logger.setLevel(origlevel)
@@ -451,6 +452,7 @@ def modify(args, config, basepath, workspace):
initial_rev = _extract_source(args.srctree, False, args.branch, rd)
if not initial_rev:
return 1
logger.info('Source tree extracted to %s' % srctree)
# Get list of commits since this revision
(stdout, _) = bb.process.run('git rev-list --reverse %s..HEAD' % initial_rev, cwd=args.srctree)
commits = stdout.split()