| Message ID | 20260128143336.1963432-1-anibal@limonsoftware.com |
|---|---|
| State | New |
| Headers | show |
| Series | bitbake-setup: _has_local_modifications fix layer add on existing project | expand |
On Wed, 28 Jan 2026 at 15:33, Anibal Limon via lists.openembedded.org <anibal=limonsoftware.com@lists.openembedded.org> wrote: > + > + if not r_name in fixed_revisions['sources']: > + return False I'm not sure False is a correct value to return? My understanding is that the scenario you have hit is as follows: - manually clone meta-freescale into layers/ - add meta-freescale to a configuration - run bitbake-setup update At this point bitbake-setup sees that meta-freescale already exists, and it needs to decide whether to preserve it or not. As there is no record in fixed revisions of what the original revision was, should it default to preserving, so that any possible user modifications are saved? Alex
On Wed, Jan 28, 2026 at 8:49 AM Alexander Kanavin <alex.kanavin@gmail.com> wrote: > On Wed, 28 Jan 2026 at 15:33, Anibal Limon via lists.openembedded.org > <anibal=limonsoftware.com@lists.openembedded.org> wrote: > > + > > + if not r_name in fixed_revisions['sources']: > > + return False > > I'm not sure False is a correct value to return? My understanding is > that the scenario you have hit is as follows: > > - manually clone meta-freescale into layers/ > - add meta-freescale to a configuration > - run bitbake-setup update > At this point bitbake-setup sees that meta-freescale already exists, > and it needs to decide whether to preserve it or not. As there is no > record in fixed revisions of what the original revision was, should it > default to preserving, so that any possible user modifications are > saved? > Yes, so returning True and may be a different message to the user?. Anibal > > Alex >
On Wed, 28 Jan 2026 at 19:26, Anibal Limon <anibal@limonsoftware.com> wrote:
> Yes, so returning True and may be a different message to the user?.
Yes, perhaps it could issue a special warning if this is detected.
Alex
On Wed, Jan 28, 2026 at 12:26 PM Anibal Limon via lists.openembedded.org <anibal=limonsoftware.com@lists.openembedded.org> wrote: > > > On Wed, Jan 28, 2026 at 8:49 AM Alexander Kanavin <alex.kanavin@gmail.com> > wrote: > >> On Wed, 28 Jan 2026 at 15:33, Anibal Limon via lists.openembedded.org >> <anibal=limonsoftware.com@lists.openembedded.org> wrote: >> > + >> > + if not r_name in fixed_revisions['sources']: >> > + return False >> >> I'm not sure False is a correct value to return? My understanding is >> that the scenario you have hit is as follows: >> >> - manually clone meta-freescale into layers/ >> - add meta-freescale to a configuration >> - run bitbake-setup update > > Info here, - setup project with bitbake-setup - add meta-freescale layer to the config - setup project with bitbake-setup (fine) - checkout previous revision without meta-freescale - setup project with bitbake-setup (break) > >> At this point bitbake-setup sees that meta-freescale already exists, >> and it needs to decide whether to preserve it or not. As there is no >> record in fixed revisions of what the original revision was, should it >> default to preserving, so that any possible user modifications are >> saved? >> > > Yes, so returning True and may be a different message to the user?. > > Anibal > > >> >> Alex >> > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#18921): > https://lists.openembedded.org/g/bitbake-devel/message/18921 > Mute This Topic: https://lists.openembedded.org/mt/117508137/8181911 > Group Owner: bitbake-devel+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [ > anibal@limonsoftware.com] > -=-=-=-=-=-=-=-=-=-=-=- > >
On Wed, 28 Jan 2026 at 19:30, Anibal Limon <anibal@limonsoftware.com> wrote: > - setup project with bitbake-setup > - add meta-freescale layer to the config > - setup project with bitbake-setup (fine) > - checkout previous revision without meta-freescale > - setup project with bitbake-setup (break) I'm sorry but now I don't understand. Are you setting up the project twice from two different configurations? Why does the second one break if it doesn't even have meta-freescale? Alex
On Wed, Jan 28, 2026 at 12:42 PM Alexander Kanavin <alex.kanavin@gmail.com> wrote: > On Wed, 28 Jan 2026 at 19:30, Anibal Limon <anibal@limonsoftware.com> > wrote: > > - setup project with bitbake-setup > > - add meta-freescale layer to the config > > - setup project with bitbake-setup (fine) > > - checkout previous revision without meta-freescale > > - setup project with bitbake-setup (break) > > I'm sorry but now I don't understand. Are you setting up the project > twice from two different configurations? Why does the second one break > if it doesn't even have meta-freescale? > Sending v2, the case is when removing a layer from the configuration and calling bitbake-setup again, on the same directory. Anibal > > Alex >
diff --git a/bin/bitbake-setup b/bin/bitbake-setup index 4d709ed8c..46b2bff01 100755 --- a/bin/bitbake-setup +++ b/bin/bitbake-setup @@ -140,6 +140,9 @@ def checkout_layers(layers, confdir, layerdir, d): def _has_local_modifications(r_name, r_path): fixed_revisions = json.load(open(os.path.join(confdir, "sources-fixed-revisions.json"))) + + if not r_name in fixed_revisions['sources']: + return False rev = fixed_revisions['sources'][r_name]['git-remote']['rev'] status = bb.process.run('git -C {} status --porcelain'.format(r_path))[0] if status:
When a layer is add to the registry and previous project checkout exists, the sources-fixed-revisions.json not has a previous revision. Fixes: ``` File "/workspaces/ls/meta-ls/bitbake/bin/bitbake-setup", line 1137, in <module> main() ~~~~^^ File "/workspaces/ls/meta-ls/bitbake/bin/bitbake-setup", line 1130, in main args.func(top_dir, all_settings, args, d) ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/workspaces/ls/meta-ls/bitbake/bin/bitbake-setup", line 735, in build_update build_status(top_dir, settings, args, d, update=True) ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/workspaces/ls/meta-ls/bitbake/bin/bitbake-setup", line 719, in build_status update_build(new_upstream_config, confdir, setupdir, layerdir, d, ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ update_bb_conf=args.update_bb_conf) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/workspaces/ls/meta-ls/bitbake/bin/bitbake-setup", line 408, in update_build sources_fixed_revisions = checkout_layers(layer_config, confdir, layerdir, d) File "/workspaces/ls/meta-ls/bitbake/bin/bitbake-setup", line 184, in checkout_layers elif _has_local_modifications(r_name, repodir_path): ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^ File "/workspaces/ls/meta-ls/bitbake/bin/bitbake-setup", line 143, in _has_local_modifications rev = fixed_revisions['sources'][r_name]['git-remote']['rev'] ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^ KeyError: 'meta-freescale' ``` Signed-off-by: Anibal Limon <anibal@limonsoftware.com> --- bin/bitbake-setup | 3 +++ 1 file changed, 3 insertions(+)