update: handle if there is no origin/master branch in bitbake repo

It's been reported to me that it's possible in a custom setup to have a
bitbake repo that intentionally doesn't have a master branch, so pick
up the bitbake branch from the master Branch record if it exists and the
bitbake_branch field is set.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
Paul Eggleton 2018-10-11 16:59:38 +13:00
parent 631116a1c4
commit 4acb0b2c91

View File

@ -309,6 +309,12 @@ def main():
update_actual_branch(layerquery, fetchdir, branches[0], options, update_bitbake, bitbakepath) update_actual_branch(layerquery, fetchdir, branches[0], options, update_bitbake, bitbakepath)
return return
# Get a safe bitbake branch to call into from this script (used later on)
safe_bitbake_branch = 'origin/master'
master_branch = Branch.objects.filter(name='master').first()
if master_branch and master_branch.bitbake_branch:
safe_bitbake_branch = 'origin/' + master_branch.bitbake_branch
# Process and extract data from each layer # Process and extract data from each layer
# We now do this by calling out to a separate script; doing otherwise turned out to be # We now do this by calling out to a separate script; doing otherwise turned out to be
# unreliable due to leaking memory (we're using bitbake internals in a manner in which # unreliable due to leaking memory (we're using bitbake internals in a manner in which
@ -440,7 +446,7 @@ def main():
# We need to check this out because we're using stuff from bb.utils # We need to check this out because we're using stuff from bb.utils
# below, and if we don't it might be a python 2 revision which would # below, and if we don't it might be a python 2 revision which would
# be an issue # be an issue
utils.checkout_repo(bitbakepath, 'origin/master', logger=logger) utils.checkout_repo(bitbakepath, safe_bitbake_branch, logger=logger)
deps_dict = utils.explode_dep_versions2(bitbakepath, deps) deps_dict = utils.explode_dep_versions2(bitbakepath, deps)
recs_dict = utils.explode_dep_versions2(bitbakepath, recs) recs_dict = utils.explode_dep_versions2(bitbakepath, recs)