Skip to contentSkip to conversation

binman: Handle tool paths containing '~' correctly

PATCH New Simon Glass 2 participants 4 messages Nov 9, 2020 – Nov 30, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 binman: Handle tool paths containing '~' correctly

At present if CROSS_COMPILE contains a tilde, such as ~/.buildman-toolchains/gcc-7.3.0-nolibc/i386-linux/bin/i386-linux-gcc then binman gives a confusing error:

binman: Error 255 running '~/..buildman-toolchains/gcc-7.3.0- ...

Fix this by expanding it out before running the tool.

---

 tools/patman/tools.py | 1 +
 1 file changed, 1 insertion(+)
tools/patman/tools.py +1 -0
index bbb157da873..05b1a1d4b08 100644
@@ -333,6 +333,7 @@ def Run(name, *args, **kwargs):
         elif for_host:
             name, extra_args = GetHostCompileTool(name)
             args = tuple(extra_args) + args
+        name = os.path.expanduser(name)  # Expand paths containing ~
         all_args = (name,) + args
         result = command.RunPipe([all_args], capture=True, capture_stderr=True,
                                  env=env, raise_on_error=False, binary=binary)
Signature · 1 line
2.29.2.222.g5d2a92d10f8-goog
#1 lore raw

PATCH 1/1 binman: Handle tool paths containing '~' correctly

Quoted 9 lines · Simon Glass

At present if CROSS_COMPILE contains a tilde, such as ~/.buildman-toolchains/gcc-7.3.0-nolibc/i386-linux/bin/i386-linux-gcc then binman gives a confusing error:

   binman: Error 255 running '~/..buildman-toolchains/gcc-7.3.0- ...

Fix this by expanding it out before running the tool.

Arguably, whatever is passing CROSS_COMPILE to binman should have expanded that; how are you passing it? If that's from shell you could use one of CROSS_COMPILE="$HOME/..." or ~/"..." (the "~/..." form isn't expanded), if it's read from e.g. ~/.buildman then the config parser should be expanding it at read-time.

#2 lore raw

PATCH 1/1 binman: Handle tool paths containing '~' correctly

Hi Alper,

Quoted 10 lines · Alper Nebi Yasak
Quoted 8 lines · Simon Glass

At present if CROSS_COMPILE contains a tilde, such as ~/.buildman-toolchains/gcc-7.3.0-nolibc/i386-linux/bin/i386-linux-gcc then binman gives a confusing error:

   binman: Error 255 running '~/..buildman-toolchains/gcc-7.3.0- ...

Fix this by expanding it out before running the tool.

Quoted 7 lines
Quoted 1 line

Arguably, whatever is passing CROSS_COMPILE to binman should have expanded that; how are you passing it? If that's from shell you could use one of CROSS_COMPILE="$HOME/..." or ~/"..." (the "~/..." form isn't expanded), if it's read from e.g. ~/.buildman then the config parser should be expanding it at read-time.

This is actually happening in my lab because tbot is set to use the home directory for the toolchains. It is set up in the 'lab.py' Python file and uses ~ to avoid hard-coding it to a particular machine.

Regards,
Simon

#3 lore raw

PATCH 1/1 binman: Handle tool paths containing '~' correctly

Hi Alper,

Quoted 10 lines · Alper Nebi Yasak
Quoted 8 lines · Simon Glass

At present if CROSS_COMPILE contains a tilde, such as ~/.buildman-toolchains/gcc-7.3.0-nolibc/i386-linux/bin/i386-linux-gcc then binman gives a confusing error:

   binman: Error 255 running '~/..buildman-toolchains/gcc-7.3.0- ...

Fix this by expanding it out before running the tool.

Quoted 7 lines
Quoted 1 line

Arguably, whatever is passing CROSS_COMPILE to binman should have expanded that; how are you passing it? If that's from shell you could use one of CROSS_COMPILE="$HOME/..." or ~/"..." (the "~/..." form isn't expanded), if it's read from e.g. ~/.buildman then the config parser should be expanding it at read-time.

This is actually happening in my lab because tbot is set to use the home directory for the toolchains. It is set up in the 'lab.py' Python file and uses ~ to avoid hard-coding it to a particular machine.

Regards,
Simon

Applied to u-boot-dm, thanks!