From: Anibal Limon <anibal@limonsoftware.com>
To: bitbake-devel@lists.openembedded.org
Cc: alex.kanavin@gmail.com, richard.purdie@linuxfoundation.org,
Anibal Limon <anibal@limonsoftware.com>
Subject: [PATCH] bitbake-setup: _symlink_local fix case when update
Date: Mon, 22 Dec 2025 18:15:27 +0000 [thread overview]
Message-ID: <20251222181527.2424323-1-anibal@limonsoftware.com> (raw)
When run an update with setup_dir containing a local symlinked source it
fails because symlink already exists, so test for previous symlink
existance and update it if not point to the same local source directory.
Fixes,
```
$ bitbake-setup update --setup_dir /home/workspaces/ls/meta-ls/bitbake-setup/ls-master/stm32-toolchain
...
Traceback (most recent call last):
File "/home/workspaces/ls/meta-ls/bitbake/bin/bitbake-setup", line 1042, in <module>
main()
~~~~^^
File "/home/workspaces/ls/meta-ls/bitbake/bin/bitbake-setup", line 1035, in main
args.func(top_dir, all_settings, args, d)
~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/workspaces/ls/meta-ls/bitbake/bin/bitbake-setup", line 667, in build_update
build_status(top_dir, settings, args, d, update=True)
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/workspaces/ls/meta-ls/bitbake/bin/bitbake-setup", line 652, in build_status
update_build(new_upstream_config, confdir, setupdir, layerdir, d,
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
update_bb_conf=args.update_bb_conf)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/workspaces/ls/meta-ls/bitbake/bin/bitbake-setup", line 340, in update_build
sources_fixed_revisions = checkout_layers(layer_config, layerdir, d)
File "/home/workspaces/ls/meta-ls/bitbake/bin/bitbake-setup", line 132, in checkout_layers
_symlink_local(os.path.expanduser(r_local["path"]), os.path.join(layerdir,repodir))
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/workspaces/ls/meta-ls/bitbake/bin/bitbake-setup", line 114, in _symlink_local
os.symlink(src, dst)
~~~~~~~~~~^^^^^^^^^^
FileExistsError: [Errno 17] File exists: '/home/workspaces/ls/meta-ls/layers' -> '/home/workspaces/ls/meta-ls/bitbake-setup/ls-master/stm32-toolc
hain/layers/ls-layers'
```
Signed-off-by: Anibal Limon <anibal@limonsoftware.com>
---
bin/bitbake-setup | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/bin/bitbake-setup b/bin/bitbake-setup
index 1ea6796b5..378fbdc91 100755
--- a/bin/bitbake-setup
+++ b/bin/bitbake-setup
@@ -110,8 +110,19 @@ def checkout_layers(layers, layerdir, d):
layers_fixed_revisions[r_name]['git-remote']['rev'] = revision
def _symlink_local(src, dst):
- logger.plain("Making a symbolic link {} pointing to {}".format(dst, src))
- os.symlink(src, dst)
+ do_symlink = False
+
+ if os.path.islink(dst):
+ if not os.path.samefile(src, dst):
+ logger.plain("Updating symbolic link {} pointing to {}".format(dst, src))
+ os.remove(src)
+ do_symlink = True
+ else:
+ logger.plain("Making a symbolic link {} pointing to {}".format(dst, src))
+ do_symlink = True
+
+ if do_symlink:
+ os.symlink(src, dst)
layers_fixed_revisions = copy.deepcopy(layers)
repodirs = []
--
2.47.3
next reply other threads:[~2025-12-22 18:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-22 18:15 Anibal Limon [this message]
2025-12-22 19:18 ` [PATCH] bitbake-setup: _symlink_local fix case when update Alexander Kanavin
2025-12-22 19:53 ` Anibal Limon
2025-12-31 9:27 ` Alexander Kanavin
2025-12-31 14:43 ` Anibal Limon
2026-01-02 19:38 ` Alexander Kanavin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251222181527.2424323-1-anibal@limonsoftware.com \
--to=anibal@limonsoftware.com \
--cc=alex.kanavin@gmail.com \
--cc=bitbake-devel@lists.openembedded.org \
--cc=richard.purdie@linuxfoundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox