diff options
author | Alexander Kanavin <alex.kanavin@gmail.com> | 2022-02-21 10:28:12 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-02-21 21:53:52 +0000 |
commit | 8f4b84c98cbe962a3c432b404c7d66b8e518cd40 (patch) | |
tree | e84d63617d09f0a7c68a03477e86d316c7749189 /scripts/lib/devtool/upgrade.py | |
parent | e4c8f51dd54203203dcc8cc8e1e5f59c877238d9 (diff) | |
download | poky-8f4b84c98cbe962a3c432b404c7d66b8e518cd40.tar.gz |
devtool: explicitly set main or master branches in upgrades when available
In particular this resolves devtool's inability to pick a branch
when the same tagged commit is avaiable in main and in a release maintenance
branch.
Thanks to Peter Kjellerstedt for the suggestion.
(From OE-Core rev: bcb21ee2760a2c76039412a56c6cda43fbf96fd0)
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/devtool/upgrade.py')
-rw-r--r-- | scripts/lib/devtool/upgrade.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/scripts/lib/devtool/upgrade.py b/scripts/lib/devtool/upgrade.py index 826a3f955f..0357ec07bf 100644 --- a/scripts/lib/devtool/upgrade.py +++ b/scripts/lib/devtool/upgrade.py | |||
@@ -192,14 +192,15 @@ def _extract_new_source(newpv, srctree, no_patch, srcrev, srcbranch, branch, kee | |||
192 | get_branch = [x.strip() for x in check_branch.splitlines()] | 192 | get_branch = [x.strip() for x in check_branch.splitlines()] |
193 | # Remove HEAD reference point and drop remote prefix | 193 | # Remove HEAD reference point and drop remote prefix |
194 | get_branch = [x.split('/', 1)[1] for x in get_branch if not x.startswith('origin/HEAD')] | 194 | get_branch = [x.split('/', 1)[1] for x in get_branch if not x.startswith('origin/HEAD')] |
195 | if 'master' in get_branch: | 195 | if len(get_branch) == 1: |
196 | # If it is master, we do not need to append 'branch=master' as this is default. | 196 | # If srcrev is on only ONE branch, then use that branch |
197 | # Even with the case where get_branch has multiple objects, if 'master' is one | ||
198 | # of them, we should default take from 'master' | ||
199 | srcbranch = '' | ||
200 | elif len(get_branch) == 1: | ||
201 | # If 'master' isn't in get_branch and get_branch contains only ONE object, then store result into 'srcbranch' | ||
202 | srcbranch = get_branch[0] | 197 | srcbranch = get_branch[0] |
198 | elif 'main' in get_branch: | ||
199 | # If srcrev is on multiple branches, then choose 'main' if it is one of them | ||
200 | srcbranch = 'main' | ||
201 | elif 'master' in get_branch: | ||
202 | # Otherwise choose 'master' if it is one of the branches | ||
203 | srcbranch = 'master' | ||
203 | else: | 204 | else: |
204 | # If get_branch contains more than one objects, then display error and exit. | 205 | # If get_branch contains more than one objects, then display error and exit. |
205 | mbrch = '\n ' + '\n '.join(get_branch) | 206 | mbrch = '\n ' + '\n '.join(get_branch) |