@@ -89,6 +89,33 @@ def _write_layer_list(dest, repodirs):
with open(layers_f, 'w') as f:
json.dump({"version":"1.0","layers":layers}, f, sort_keys=True, indent=4)
+def _get_remotes(r_remote):
+ remotes = {}
+
+ if not 'remotes' in r_remote and not 'uri' in r_remote:
+ raise Exception("Expected key(s): 'remotes', 'uri'")
+
+ if 'remotes' in r_remote:
+ remotes = r_remote['remotes'].copy()
+
+ if 'uri' in r_remote:
+ r_name = ''
+
+ if 'remotes' in r_remote:
+ if not 'bitbake-setup-uri' in r_remote['remotes']:
+ r_name = 'bitbake-setup-uri'
+ else:
+ idx = 1
+ while 'bitbake-setup-uri_{}'.format(idx) in r_remote['remotes']:
+ idx += 1
+ r_name = 'bitbake-setup-uri_{}'.format(idx)
+ else:
+ r_name = 'bitbake-setup-uri'
+
+ remotes.update({r_name: {'uri': r_remote['uri']}})
+
+ return remotes
+
def checkout_layers(layers, layerdir, d):
layers_fixed_revisions = copy.deepcopy(layers)
repodirs = []
@@ -102,7 +129,8 @@ def checkout_layers(layers, layerdir, d):
r_remote = r_data['git-remote']
rev = r_remote['rev']
branch = r_remote.get('branch', None)
- remotes = r_remote['remotes']
+
+ remotes = _get_remotes(r_remote)
for remote in remotes:
prot,host,path,user,pswd,params = bb.fetch.decodeurl(remotes[remote]["uri"])
@@ -571,7 +599,8 @@ def are_layers_changed(layers, layerdir, d):
r_remote = r_data['git-remote']
rev = r_remote['rev']
branch = r_remote.get('branch', None)
- remotes = r_remote['remotes']
+
+ remotes = _get_remotes(r_remote)
for remote in remotes:
type,host,path,user,pswd,params = bb.fetch.decodeurl(remotes[remote]["uri"])
Most of the time, when we describe a remote, a bitbake-setup source looks like this: "bitbake": { "git-remote": { "remotes": { "origin": { "uri": "https://git.openembedded.org/bitbake" } }, ... } } i.e. an URI with the common name 'origin'. Alternatively, we could simplify this, by using a shorter structure with the property 'uri' only: "bitbake": { "git-remote": { "uri": "https://git.openembedded.org/bitbake", ... } } These properties can be used together. Signed-off-by: Corentin Guillevic <corentin.guillevic@smile.fr> --- Changes in v2: - The keys are complementary, rather than mutually exclusive - Updated configurations in default-registry/configurations/ bin/bitbake-setup | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-)