[bitbake-devel] [PATCH] bitbake: Correct broken symlink behaviour
Richard Purdie
richard.purdie at linuxfoundation.org
Wed Sep 21 21:17:24 UTC 2016
Hi,
On Tue, 2016-09-20 at 19:23 +0300, Roman Savchenko wrote:
> From: Roman Savchenko <roman.savchenko at attocapital.com>
>
> Unlink broken symlink.
This really needs a few more details about the problem and how an issue
occurs. I can understand from reading the patch but not from the commit
message.
> Signed-off-by: Roman Savchenko <gmstima at gmail.com>
> ---
> bitbake/lib/bb/fetch2/__init__.py | 21 +++++++++++++--------
> 1 file changed, 13 insertions(+), 8 deletions(-)
>
> diff --git a/bitbake/lib/bb/fetch2/__init__.py
> b/bitbake/lib/bb/fetch2/__init__.py
> index 6ef0c6f..a752c6c 100644
> --- a/bitbake/lib/bb/fetch2/__init__.py
> +++ b/bitbake/lib/bb/fetch2/__init__.py
> @@ -925,6 +925,17 @@ def rename_bad_checksum(ud, suffix):
> bb.utils.movefile(ud.localpath, new_localpath)
>
>
> +def try_symlink(source, link_name):
> + """
> + Tries to make link to passed source if link name does not
> + exist.
> + """
> + if not os.path.exists(link_name):
> + if os.path.islink(link_name):
> + os.unlink(link_name)
> +
> + os.symlink(source, link_name)
> +
I don't think the function name is right. "try" implies its fine if it
doesn't work out. In reality its more like "symlink if its invalid".
"create_valid_symlink" whilst long is probably more reflective of what
it does but I'm sure we could still do better :/.
You could add "or the symlink is invalid" to the function description
too.
Cheers,
Richard
More information about the bitbake-devel
mailing list