Skip to contentSkip to conversation

bitbake-setup: _has_local_modifications fix layer add on existing project

PATCH In review Anibal Limon 2 participants 7 messages Jan 28 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bitbake-setup: _has_local_modifications fix layer add on existing project

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'
```
---
 bin/bitbake-setup | 3 +++
 1 file changed, 3 insertions(+)
bin/bitbake-setup +3 -0
index 4d709ed8c..46b2bff01 100755
@@ -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:
Signature · 1 line
2.51.0
#1 lore raw

bin/bitbake-setup def checkout_layers(layers, confdir, layerdir, d): · line 145

Quoted 3 lines · Anibal Limon via lists.openembedded.org
bin/bitbake-setup +3 -0
+
+        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

#2 lore raw
Quoted 14 lines · Alexander Kanavin

bin/bitbake-setup def checkout_layers(layers, confdir, layerdir, d): · line 145

Quoted 3 lines · Anibal Limon via lists.openembedded.org
bin/bitbake-setup +3 -0
+
+        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

Quoted 6 lines

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

Quoted 3 lines

Alex

#3 lore raw
Quoted 1 line · Anibal Limon

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

A message that is not in the archive (sent off-list or not yet received): [email protected]

#5 lore raw
Quoted 11 lines · Anibal Limon via lists.openembedded.org
Quoted 6 lines · Alexander Kanavin
Quoted 3 lines · Anibal Limon via lists.openembedded.org
bin/bitbake-setup +3 -0
+
+        if not r_name in fixed_revisions['sources']:
+            return False
Quoted 8 lines
Quoted 6 lines

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)

Quoted 28 lines
Quoted 7 lines

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

Quoted 3 lines

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: [email protected]
Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#6 lore raw
Quoted 5 lines · Anibal Limon

- 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

#7 lore raw
Quoted 8 lines · Alexander Kanavin
Quoted 5 lines · Anibal Limon

- 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)

Quoted 4 lines

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

Quoted 3 lines

Alex