All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Roman Savchenko <gmstima@gmail.com>,
	bitbake-devel@lists.openembedded.org
Subject: Re: [PATCH] bitbake: Correct broken symlink behaviour
Date: Wed, 21 Sep 2016 22:17:24 +0100	[thread overview]
Message-ID: <1474492644.7207.340.camel@linuxfoundation.org> (raw)
In-Reply-To: <1474388588-1111-1-git-send-email-gmstima@gmail.com>

Hi,

On Tue, 2016-09-20 at 19:23 +0300, Roman Savchenko wrote:
> From: Roman Savchenko <roman.savchenko@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@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


  reply	other threads:[~2016-09-21 21:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-20 16:23 [PATCH] bitbake: Correct broken symlink behaviour Roman Savchenko
2016-09-21 21:17 ` Richard Purdie [this message]
2016-09-23  7:45 ` Roman Savchenko
2016-09-23  7:55   ` Roman Savchenko
2016-09-23 14:01     ` Richard Purdie
2016-09-27 10:22 ` Roman Savchenko
2016-09-27 10:24   ` Roman Savchenko

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=1474492644.7207.340.camel@linuxfoundation.org \
    --to=richard.purdie@linuxfoundation.org \
    --cc=bitbake-devel@lists.openembedded.org \
    --cc=gmstima@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.