diff mbox series

[RFC] bitbake-setup: local sources add oe.path.expendvars

Message ID 20251221004750.35128-1-anibal@limonsoftware.com
State New
Headers show
Series [RFC] bitbake-setup: local sources add oe.path.expendvars | expand

Commit Message

Anibal Limon Dec. 21, 2025, 12:47 a.m. UTC
Allow environment variables to be expanded on local sources, allow users
specify layers location using custom environment variables.

Signed-off-by: Anibal Limon <anibal@limonsoftware.com>
---
 bin/bitbake-setup | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Alexander Kanavin Dec. 22, 2025, 11:36 a.m. UTC | #1
On Sun, 21 Dec 2025 at 01:48, Anibal Limon via lists.openembedded.org
<anibal=limonsoftware.com@lists.openembedded.org> wrote:
> -            _symlink_local(os.path.expanduser(r_local["path"]), os.path.join(layerdir,repodir))
> +            _symlink_local(os.path.expandvars(os.path.expanduser(r_local["path"])), os.path.join(layerdir,repodir))

What happens if the variable isn't set? This may introduce a usability
problem when users forget to set the needed variable, or are oblivious
to needing to set it, and get cryptic path-related fails.

I'd rather use a -L command line switch to override the default value,
and, if needed, place the environment variable into that:

bitbake-setup init -L openembedded-core $SOME_CUSTOM_PATH/openembedded-core

Alex
Anibal Limon Dec. 22, 2025, 4:19 p.m. UTC | #2
Hi Alex,

Thanks for pointing out the -L option; it covers my use-case.

Anibal

On Mon, Dec 22, 2025 at 5:36 AM Alexander Kanavin <alex.kanavin@gmail.com>
wrote:

> On Sun, 21 Dec 2025 at 01:48, Anibal Limon via lists.openembedded.org
> <anibal=limonsoftware.com@lists.openembedded.org> wrote:
> > -            _symlink_local(os.path.expanduser(r_local["path"]),
> os.path.join(layerdir,repodir))
> > +
> _symlink_local(os.path.expandvars(os.path.expanduser(r_local["path"])),
> os.path.join(layerdir,repodir))
>
> What happens if the variable isn't set? This may introduce a usability
> problem when users forget to set the needed variable, or are oblivious
> to needing to set it, and get cryptic path-related fails.
>
> I'd rather use a -L command line switch to override the default value,
> and, if needed, place the environment variable into that:
>
> bitbake-setup init -L openembedded-core $SOME_CUSTOM_PATH/openembedded-core
>
> Alex
>
diff mbox series

Patch

diff --git a/bin/bitbake-setup b/bin/bitbake-setup
index 73f734e73..d19aee971 100755
--- a/bin/bitbake-setup
+++ b/bin/bitbake-setup
@@ -129,7 +129,7 @@  def checkout_layers(layers, layerdir, d):
         if r_remote:
             _checkout_git_remote(r_remote, repodir, layers_fixed_revisions)
         if r_local:
-            _symlink_local(os.path.expanduser(r_local["path"]), os.path.join(layerdir,repodir))
+            _symlink_local(os.path.expandvars(os.path.expanduser(r_local["path"])), os.path.join(layerdir,repodir))
 
         if os.path.exists(os.path.join(layerdir, repodir, 'scripts/oe-setup-build')):
             oesetupbuild = os.path.join(layerdir, repodir, 'scripts/oe-setup-build')