Fixes for devtool upgrade
cover Fixes for devtool upgrade
The following changes since commit d6241e4c94a0a72acfc57e96a59918c0b2146d65:
useradd: Fix infinite build loop (2016-05-23 10:33:39 +0100)
are available in the git repository at:
git://git.openembedded.org/openembedded-core-contrib paule/devtool-upgrade-fixes
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=paule/devtool-upgrade-fixes
Paul Eggleton (3):
devtool: upgrade: handle upgrading recipes with a versioned inc file
devtool: upgrade: tweak conflict handling
devtool: upgrade: clarify help text for --srcrev option
scripts/lib/devtool/upgrade.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)
Signature · 1 line
2.5.5
PATCH 1/3 devtool: upgrade: handle upgrading recipes with a versioned inc file
The gdb recipe in OE-Core has an inc file with the version in it; since the inc file is pulled in with a "require ${PV}.inc", when upgrading the recipe we need to also rename the inc file it will fail to parse and the upgrade itself will fail.
Fixes [YOCTO #9574].
--- scripts/lib/devtool/upgrade.py | 8 ++++++++ 1 file changed, 8 insertions(+)
scripts/lib/devtool/upgrade.py +8 -0
@@ -77,11 +77,19 @@ def _recipe_contains(rd, var): def _rename_recipe_dirs(oldpv, newpv, path): for root, dirs, files in os.walk(path): + # Rename directories with the version in their name for olddir in dirs: if olddir.find(oldpv) != -1: newdir = olddir.replace(oldpv, newpv) if olddir != newdir: shutil.move(os.path.join(path, olddir), os.path.join(path, newdir)) + # Rename any inc files with the version in their name (unusual, but possible) + for oldfile in files: + if oldfile.endswith('.inc'): + if oldfile.find(oldpv) != -1: + newfile = oldfile.replace(oldpv, newpv) + if oldfile != newfile: + os.rename(os.path.join(path, oldfile), os.path.join(path, newfile)) def _rename_recipe_file(oldrecipe, bpn, oldpv, newpv, path): oldrecipe = os.path.basename(oldrecipe)
Signature · 1 line
2.5.5
PATCH 2/3 devtool: upgrade: tweak conflict handling
In reply to Paul EggletonMake a couple of changes to the rebase operation:
1) Only wrap the actual rebase command in try...except since a failure in any of the other commands should be an error, not a warning
2) If it's a conflict (which unfortunately we can only tell by checking for the keyword "conflict" since git doesn't return error codes based on the type of error) then print a message clarifying that the user needs to resolve the issue themselves to finish the upgrade.
--- scripts/lib/devtool/upgrade.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
scripts/lib/devtool/upgrade.py +9 -3
@@ -236,16 +236,22 @@ def _extract_new_source(newpv, srctree, no_patch, srcrev, branch, keep_temp, tin for patch in patches: logger.warn("%s" % os.path.basename(patch)) else: + __run('git checkout devtool-patched -b %s' % branch) + skiptag = False try: - __run('git checkout devtool-patched -b %s' % branch) __run('git rebase %s' % rev) + except bb.process.ExecutionError as e: + skiptag = True + if 'conflict' in e.stdout: + logger.warn('Command \'%s\' failed:\n%s\n\nYou will need to resolve conflicts in order to complete the upgrade.' % (e.command, e.stdout.rstrip())) + else: + logger.warn('Command \'%s\' failed:\n%s' % (e.command, e.stdout)) + if not skiptag: if uri.startswith('git://'): suffix = 'new' else: suffix = newpv __run('git tag -f devtool-patched-%s' % suffix) - except bb.process.ExecutionError as e: - logger.warn('Command \'%s\' failed:\n%s' % (e.command, e.stdout)) if tmpsrctree: if keep_temp:
Signature · 1 line
2.5.5
PATCH 3/3 devtool: upgrade: clarify help text for --srcrev option
In reply to Paul EggletonThe -S / --srcrev option must be specified if fetching from a git repository, so spell that out in the help text.
--- scripts/lib/devtool/upgrade.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/lib/devtool/upgrade.py +1 -1
@@ -385,7 +385,7 @@ def register_commands(subparsers, context): parser_upgrade.add_argument('recipename', help='Name of recipe to upgrade (just name - no version, path or extension)') parser_upgrade.add_argument('srctree', nargs='?', help='Path to where to extract the source tree. If not specified, a subdirectory of %s will be used.' % defsrctree) parser_upgrade.add_argument('--version', '-V', help='Version to upgrade to (PV)') - parser_upgrade.add_argument('--srcrev', '-S', help='Source revision to upgrade to (if fetching from an SCM such as git)') + parser_upgrade.add_argument('--srcrev', '-S', help='Source revision to upgrade to (required if fetching from an SCM such as git)') parser_upgrade.add_argument('--srcbranch', '-B', help='Branch in source repository containing the revision to use (if fetching from an SCM such as git)') parser_upgrade.add_argument('--branch', '-b', default="devtool", help='Name for new development branch to checkout (default "%(default)s")') parser_upgrade.add_argument('--no-patch', action="store_true", help='Do not apply patches from the recipe to the new source code')
Signature · 1 line
2.5.5