Message ID | 20231107152641.1043-8-jermain.horsman@nedap.com |
---|---|
State | New |
Headers | show |
Series | bitbake-layers: Add update-layers-setup | expand |
I think adding this field can be avoided if remote and branch are combined with / separator in the already existig 'rev' field? E.g. 'git checkout poky-contrib/master' and 'git checkout origin/master' both work here. The idea is that 'rev' contains basically what we give to 'git checkout' in the setup-layers script. Can be a tag too. Will that cause issues? Alex On Tue, 7 Nov 2023 at 16:28, Jermain Horsman <jermain.horsman@nedap.com> wrote: > > From: Jermain Horsman <jermain.horsman@nedap.com> > > Having a default remote present allows for the checkout of a > branch in the case multiple remotes are available. > > This requires an update to the json-schema and associated checks. > > Signed-off-by: Jermain Horsman <jermain.horsman@nedap.com> > --- > meta/files/layers.example.json | 5 ++++- > meta/files/layers.schema.json | 8 ++++++-- > meta/lib/bblayers/makesetup.py | 1 + > meta/lib/bblayers/setupwriters/oe-setup-layers.py | 2 +- > scripts/oe-setup-layers | 2 +- > 5 files changed, 13 insertions(+), 5 deletions(-) > > diff --git a/meta/files/layers.example.json b/meta/files/layers.example.json > index 0a6a6a7b48..06ba196cf6 100644 > --- a/meta/files/layers.example.json > +++ b/meta/files/layers.example.json > @@ -4,6 +4,7 @@ > "contains_this_file": true, > "git-remote": { > "branch": "master", > + "default-remote": "remote-alex", > "describe": "", > "remotes": { > "remote-alex": { > @@ -17,6 +18,7 @@ > "meta-intel": { > "git-remote": { > "branch": "master", > + "default-remote": "origin", > "describe": "15.0-hardknott-3.3-310-g0a96edae", > "remotes": { > "origin": { > @@ -30,6 +32,7 @@ > "poky": { > "git-remote": { > "branch": "akanavin/setup-layers", > + "default-remote": "poky-contrib", > "describe": "4.1_M1-374-g9dda719b2a", > "remotes": { > "origin": { > @@ -44,5 +47,5 @@ > "path": "poky" > } > }, > - "version": "1.0" > + "version": "1.1" > } > diff --git a/meta/files/layers.schema.json b/meta/files/layers.schema.json > index 659ee8da49..06a34656e5 100644 > --- a/meta/files/layers.schema.json > +++ b/meta/files/layers.schema.json > @@ -7,8 +7,8 @@ > ], > "properties": { > "version": { > - "description": "The version of this document; currently '1.0'", > - "enum": ["1.0"] > + "description": "The version of this document; currently '1.1'", > + "enum": ["1.1"] > }, > "sources": { > "description": "The dict of layer sources", > @@ -41,6 +41,10 @@ > "description": "The git branch to fetch (optional)", > "type": "string" > }, > + "default-remote": { > + "description": "The default git remote", > + "type": "string" > + }, > "rev": { > "description": "The git revision to checkout", > "type": "string" > diff --git a/meta/lib/bblayers/makesetup.py b/meta/lib/bblayers/makesetup.py > index d24470dc83..0d0e42e1d0 100644 > --- a/meta/lib/bblayers/makesetup.py > +++ b/meta/lib/bblayers/makesetup.py > @@ -62,6 +62,7 @@ class MakeSetupPlugin(LayerPlugin): > 'rev':l_rev, > 'branch':l_branch, > 'remotes':self._get_remotes_with_url(repo_path), > + 'default-remote':oe.buildcfg.get_metadata_git_default_remote(repo_path), > 'describe':oe.buildcfg.get_metadata_git_describe(repo_path)}} > if repo_path == destdir_repo: > repos[repo_path]['contains_this_file'] = True > diff --git a/meta/lib/bblayers/setupwriters/oe-setup-layers.py b/meta/lib/bblayers/setupwriters/oe-setup-layers.py > index d5bc19a8cb..4e0c780eab 100644 > --- a/meta/lib/bblayers/setupwriters/oe-setup-layers.py > +++ b/meta/lib/bblayers/setupwriters/oe-setup-layers.py > @@ -36,7 +36,7 @@ class OeSetupLayersWriter(): > if not os.path.exists(args.destdir): > os.makedirs(args.destdir) > repos = parent.make_repo_config(args.destdir) > - json = {"version":"1.0","sources":repos} > + json = {"version":"1.1","sources":repos} > if not repos: > raise Exception("Could not determine layer sources") > output = args.output_prefix or "setup-layers" > diff --git a/scripts/oe-setup-layers b/scripts/oe-setup-layers > index ac9a9f139b..4622c264f9 100755 > --- a/scripts/oe-setup-layers > +++ b/scripts/oe-setup-layers > @@ -191,7 +191,7 @@ args = parser.parse_args() > with open(args.jsondata) as f: > json_f = json.load(f) > > -supported_versions = ["1.0"] > +supported_versions = ["1.0", "1.1"] > if json_f["version"] not in supported_versions: > raise Exception("File {} has version {}, which is not in supported versions: {}".format(args.jsondata, json_f["version"], supported_versions)) > > -- > 2.42.0.windows.2 > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#190296): https://lists.openembedded.org/g/openembedded-core/message/190296 > Mute This Topic: https://lists.openembedded.org/mt/102444611/1686489 > Group Owner: openembedded-core+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com] > -=-=-=-=-=-=-=-=-=-=-=- >
-----Original Message----- From: Alexander Kanavin <alex.kanavin@gmail.com> Sent: Wednesday, November 8, 2023 12:24 PM > I think adding this field can be avoided if remote and branch are > combined with / separator in the already existig 'rev' field? > > E.g. 'git checkout poky-contrib/master' and 'git checkout > origin/master' both work here. The idea is that 'rev' contains > basically what we give to 'git checkout' in the setup-layers script. > Can be a tag too. > > Will that cause issues? This is certainly a possibility, there isn't really any issue with this, however, it will checkout using a detached head which can be a bit of an annoyance if you do a subsequent create-layers-setup as all the branches will have changed to 'HEAD' instead of their previous <branch> value. One could argue that the branch field could be dropped as well, it isn't really used currently, nor would it be used if we decide to use remote/branch. Sincerely, Jermain Horsman
On Wed, 8 Nov 2023 at 16:03, Jermain Horsman <jermain.horsman@nedap.com> wrote: > This is certainly a possibility, there isn't really any issue with this, > however, it will checkout using a detached head which can be a > bit of an annoyance if you do a subsequent create-layers-setup > as all the branches will have changed to 'HEAD' instead of their > previous <branch> value. > > One could argue that the branch field could be dropped as well, > it isn't really used currently, nor would it be used if we decide to > use remote/branch. I'm fine with that. Can you tweak the tools? Alex
-----Original Message----- From: Alexander Kanavin <alex.kanavin@gmail.com> Sent: Tuesday, November 14, 2023 2:28 PM > I'm fine with that. Can you tweak the tools? Yeah I will, just need some time to work on this, so it might take a bit of time. Sincerely, Jermain Horsman
diff --git a/meta/files/layers.example.json b/meta/files/layers.example.json index 0a6a6a7b48..06ba196cf6 100644 --- a/meta/files/layers.example.json +++ b/meta/files/layers.example.json @@ -4,6 +4,7 @@ "contains_this_file": true, "git-remote": { "branch": "master", + "default-remote": "remote-alex", "describe": "", "remotes": { "remote-alex": { @@ -17,6 +18,7 @@ "meta-intel": { "git-remote": { "branch": "master", + "default-remote": "origin", "describe": "15.0-hardknott-3.3-310-g0a96edae", "remotes": { "origin": { @@ -30,6 +32,7 @@ "poky": { "git-remote": { "branch": "akanavin/setup-layers", + "default-remote": "poky-contrib", "describe": "4.1_M1-374-g9dda719b2a", "remotes": { "origin": { @@ -44,5 +47,5 @@ "path": "poky" } }, - "version": "1.0" + "version": "1.1" } diff --git a/meta/files/layers.schema.json b/meta/files/layers.schema.json index 659ee8da49..06a34656e5 100644 --- a/meta/files/layers.schema.json +++ b/meta/files/layers.schema.json @@ -7,8 +7,8 @@ ], "properties": { "version": { - "description": "The version of this document; currently '1.0'", - "enum": ["1.0"] + "description": "The version of this document; currently '1.1'", + "enum": ["1.1"] }, "sources": { "description": "The dict of layer sources", @@ -41,6 +41,10 @@ "description": "The git branch to fetch (optional)", "type": "string" }, + "default-remote": { + "description": "The default git remote", + "type": "string" + }, "rev": { "description": "The git revision to checkout", "type": "string" diff --git a/meta/lib/bblayers/makesetup.py b/meta/lib/bblayers/makesetup.py index d24470dc83..0d0e42e1d0 100644 --- a/meta/lib/bblayers/makesetup.py +++ b/meta/lib/bblayers/makesetup.py @@ -62,6 +62,7 @@ class MakeSetupPlugin(LayerPlugin): 'rev':l_rev, 'branch':l_branch, 'remotes':self._get_remotes_with_url(repo_path), + 'default-remote':oe.buildcfg.get_metadata_git_default_remote(repo_path), 'describe':oe.buildcfg.get_metadata_git_describe(repo_path)}} if repo_path == destdir_repo: repos[repo_path]['contains_this_file'] = True diff --git a/meta/lib/bblayers/setupwriters/oe-setup-layers.py b/meta/lib/bblayers/setupwriters/oe-setup-layers.py index d5bc19a8cb..4e0c780eab 100644 --- a/meta/lib/bblayers/setupwriters/oe-setup-layers.py +++ b/meta/lib/bblayers/setupwriters/oe-setup-layers.py @@ -36,7 +36,7 @@ class OeSetupLayersWriter(): if not os.path.exists(args.destdir): os.makedirs(args.destdir) repos = parent.make_repo_config(args.destdir) - json = {"version":"1.0","sources":repos} + json = {"version":"1.1","sources":repos} if not repos: raise Exception("Could not determine layer sources") output = args.output_prefix or "setup-layers" diff --git a/scripts/oe-setup-layers b/scripts/oe-setup-layers index ac9a9f139b..4622c264f9 100755 --- a/scripts/oe-setup-layers +++ b/scripts/oe-setup-layers @@ -191,7 +191,7 @@ args = parser.parse_args() with open(args.jsondata) as f: json_f = json.load(f) -supported_versions = ["1.0"] +supported_versions = ["1.0", "1.1"] if json_f["version"] not in supported_versions: raise Exception("File {} has version {}, which is not in supported versions: {}".format(args.jsondata, json_f["version"], supported_versions))